ole32: Void functions should not return a value

James Hawkins truiken at gmail.com
Thu Apr 12 19:01:48 CDT 2007


On 4/12/07, Brian Gerst <bgerst at didntduck.org> wrote:
> Andrew Talbot wrote:
> > Robert Shearman wrote:
> >
> >> Andrew Talbot wrote:
> >>> diff -urN a/dlls/ole32/rpc.c b/dlls/ole32/rpc.c
> >>> --- a/dlls/ole32/rpc.c       2007-03-28 12:43:32.000000000 +0100
> >>> +++ b/dlls/ole32/rpc.c       2007-04-12 20:20:48.000000000 +0100
> >>> @@ -1352,7 +1352,7 @@
> >>>      TRACE("ipid = %s, iMethod = %d\n", debugstr_guid(&ipid),
> >>>      msg->ProcNum);
> >>>
> >>>      params = HeapAlloc(GetProcessHeap(), 0, sizeof(*params));
> >>> -    if (!params) return RpcRaiseException(E_OUTOFMEMORY);
> >>> +    if (!params) RpcRaiseException(E_OUTOFMEMORY);
> >>>
> >>>      hr = ipid_get_dispatch_params(&ipid, &apt, &params->stub,
> >>>      &params->chan,
> >>>                                    &params->iid, &params->iface);
> >>> @@ -1360,7 +1360,7 @@
> >>>      {
> >>>          ERR("no apartment found for ipid %s\n", debugstr_guid(&ipid));
> >>>          HeapFree(GetProcessHeap(), 0, params);
> >>> -        return RpcRaiseException(hr);
> >>> +        RpcRaiseException(hr);
> >>>      }
> >>>
> >>>      params->msg = (RPCOLEMESSAGE *)msg;
> >>>
> >> You've changed the code paths here.
> >>
> >
> > Hi Rob,
> >
> > I'm not quite sure what you mean. Are you implying that I need return
> > statements after the RpcRaiseException() calls? Can one not just rely on
> > the fact that RpcRaiseException() does not return to the caller?
> >
>
> You completely removed the return from the function at those two points,
> allowing it to fall through.
>

Read Andrew's last sentence.  Technically no return is needed, but it
can be added for aesthetics.

-- 
James Hawkins



More information about the wine-devel mailing list