Ross L Richardson(open...@rlr.id.au) on 2020.08.03 15:25:05 +1000:
> cppcheck reports that proc_iev and proc_ispeer are unused.
> 
> Unless they are wanted for consistency with other versions of proc.c,
> tbey can be removed.

Yes, proc.c should stay the same across 

./sbin/iked/proc.c
./usr.sbin/httpd/proc.c
./usr.sbin/relayd/proc.c
./usr.sbin/snmpd/proc.c
./usr.sbin/switchd/proc.c
./usr.sbin/vmd/proc.c

and i would have taken care of doing that with your other diff touching it.

These functions are used elsewhere, so lets keep them.

/Benno

> 
> Ross
> 
> 
> Index: httpd.h
> ===================================================================
> RCS file: /cvs/src/usr.sbin/httpd/httpd.h,v
> retrieving revision 1.148
> diff -u -p -r1.148 httpd.h
> --- httpd.h   30 Jul 2020 21:06:19 -0000      1.148
> +++ httpd.h   3 Aug 2020 05:21:39 -0000
> @@ -803,8 +803,6 @@ int        proc_forward_imsg(struct privsep *,
>           enum privsep_procid, int);
>  struct imsgbuf *
>        proc_ibuf(struct privsep *, enum privsep_procid, int);
> -struct imsgev *
> -      proc_iev(struct privsep *, enum privsep_procid, int);
>  int   proc_flush_imsg(struct privsep *, enum privsep_procid, int);
>  void  imsg_event_add(struct imsgev *);
>  int   imsg_compose_event(struct imsgev *, uint16_t, uint32_t,
> Index: proc.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/httpd/proc.c,v
> retrieving revision 1.38
> diff -u -p -r1.38 proc.c
> --- proc.c    9 Sep 2018 21:06:51 -0000       1.38
> +++ proc.c    3 Aug 2020 05:21:39 -0000
> @@ -43,24 +43,11 @@ void       proc_open(struct privsep *, int, i
>  void  proc_accept(struct privsep *, int, enum privsep_procid,
>           unsigned int);
>  void  proc_close(struct privsep *);
> -int   proc_ispeer(struct privsep_proc *, unsigned int, enum privsep_procid);
>  void  proc_shutdown(struct privsep_proc *);
>  void  proc_sig_handler(int, short, void *);
>  void  proc_range(struct privsep *, enum privsep_procid, int *, int *);
>  int   proc_dispatch_null(int, struct privsep_proc *, struct imsg *);
>  
> -int
> -proc_ispeer(struct privsep_proc *procs, unsigned int nproc,
> -    enum privsep_procid type)
> -{
> -     unsigned int    i;
> -
> -     for (i = 0; i < nproc; i++)
> -             if (procs[i].p_id == type)
> -                     return (1);
> -     return (0);
> -}
> -
>  enum privsep_procid
>  proc_getid(struct privsep_proc *procs, unsigned int nproc,
>      const char *proc_name)
> @@ -819,15 +806,6 @@ proc_ibuf(struct privsep *ps, enum privs
>  
>       proc_range(ps, id, &n, &m);
>       return (&ps->ps_ievs[id][n].ibuf);
> -}
> -
> -struct imsgev *
> -proc_iev(struct privsep *ps, enum privsep_procid id, int n)
> -{
> -     int      m;
> -
> -     proc_range(ps, id, &n, &m);
> -     return (&ps->ps_ievs[id][n]);
>  }
>  
>  /* This function should only be called with care as it breaks async I/O */
> 

Reply via email to