bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/5] libpager: improve the pager_demuxer function


From: Samuel Thibault
Subject: Re: [PATCH 2/5] libpager: improve the pager_demuxer function
Date: Mon, 24 Feb 2014 22:38:06 -0500
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Justus Winter, le Mon 24 Feb 2014 15:41:53 +0100, a écrit :
> Handle multiple request types as recommended by the Mach Server
> Writer's Guide section 4, subsection "Handling Multiple Request
> Types".  This avoids initializing the reply message in every X_server
> function.  The reply message has already been properly initialized in
> libports, so there is no need to call mig_reply_setup.

Ack, with GG's comment about the dup :)

> * libpager/demuxer.c (pager_demuxer): Improve the demuxer function.
> ---
>  libpager/demuxer.c | 25 ++++++++++++++-----------
>  1 file changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/libpager/demuxer.c b/libpager/demuxer.c
> index 79c0ddc..9a847fb 100644
> --- a/libpager/demuxer.c
> +++ b/libpager/demuxer.c
> @@ -19,22 +19,25 @@
>  #include "memory_object_S.h"
>  #include "notify_S.h"
>  
> +#include "memory_object_S.h"
> +#include "notify_S.h"
> +
>  /* Demultiplex a single message directed at a pager port; INP is the
>     message received; fill OUTP with the reply.  */
>  int
>  pager_demuxer (mach_msg_header_t *inp,
>              mach_msg_header_t *outp)
>  {
> -  extern int _pager_seqnos_memory_object_server (mach_msg_header_t *inp,
> -                                       mach_msg_header_t *outp);
> -  extern int _pager_seqnos_notify_server (mach_msg_header_t *inp,
> -                                       mach_msg_header_t *outp);
> +  mig_routine_t routine;
> +  if ((routine = _pager_seqnos_memory_object_server_routine (inp)) ||
> +      (routine = _pager_seqnos_notify_server_routine (inp)))
> +    {
> +      (*routine) (inp, outp);
> +      return TRUE;
> +    }
>  
> -  int result = _pager_seqnos_memory_object_server (inp, outp)
> -    || _pager_seqnos_notify_server (inp, outp);
> -  if (!result)
> -    /* Synchronize our bookkeeping of the port's seqno with the one consumed 
> by
> -       this bogus message.  */
> -    _pager_update_seqno (inp->msgh_local_port, inp->msgh_seqno);
> -  return result;
> +  /* Synchronize our bookkeeping of the port's seqno with the one
> +     consumed by this bogus message.  */
> +  _pager_update_seqno (inp->msgh_local_port, inp->msgh_seqno);
> +  return FALSE;
>  }
> -- 
> 1.8.5.2
> 

-- 
Samuel
<N>  sl  -  display animations aimed to correct users who accidentally enter
<N>        sl instead of ls.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]