bug-inetutils
[Top][All Lists]
Advanced

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

Re: [bug-inetutils] [PATCH] Remove unused variables and add ARG_UNUSED


From: Jeff Bailey
Subject: Re: [bug-inetutils] [PATCH] Remove unused variables and add ARG_UNUSED
Date: Tue, 20 May 2008 11:56:59 -0700

lgtm, but I still don't understand why, especially in the applications
we don't just remove the extra args.  Is it just more of a pain to
find all the callers?

On Tue, May 20, 2008 at 2:02 AM, Debarshi Ray <address@hidden> wrote:
> Here is a patch that removes occurrences of unused variables, and adds
> ARG_UNUSED wherever applicable. This brings down the number of
> warnings by some amount, but a good number still remains.
>
> diff -urNp inetutils/ChangeLog inetutils-build/ChangeLog
> --- inetutils/ChangeLog 2008-05-14 12:32:22.000000000 +0530
> +++ inetutils-build/ChangeLog   2008-05-20 14:22:20.000000000 +0530
> @@ -1,3 +1,13 @@
> +2008-05-20  Debarshi Ray <address@hidden>
> +
> +       * ftp/cmds.c, ftp/ftp.c, ftp/main.c, ftpd/ftpd.c, ftpd/popen.c,
> +       inetd/inetd.c, libinetutils/argcv.c, libls/ls.c, ping/ping6.c,
> +       rcp/util.c, rexecd/rexecd.c, rlogind/rlogind.c, rsh/rsh.c,
> +       talk/get_names.c, talk/invite.c, talk/look_up.c, talkd/talkd.c,
> +       telnet/commands.c, telnet/utilities.c, telnetd/utility.c,
> +       uucpd/uucpd.c: Remove unused variables and add ARG_UNUSED
> +       attribute to unused function arguments.
> +
>  2008-05-13  Debarshi Ray <address@hidden>
>
>        * libls/bsdport, libls/cmp.c, libls/ls.c, libls/print.c,
> diff -urNp inetutils/ftp/cmds.c inetutils-build/ftp/cmds.c
> --- inetutils/ftp/cmds.c        2007-09-06 08:45:56.000000000 +0530
> +++ inetutils-build/ftp/cmds.c  2008-05-14 16:05:09.000000000 +0530
> @@ -640,7 +640,7 @@ mput (argc, argv)
>     }
>   for (i = 1; i < argc; i++)
>     {
> -      char **cpp, **gargs;
> +      char **cpp;
>       glob_t gl;
>       int flags;
>
> @@ -898,8 +898,8 @@ mget (argc, argv)
>      char **argv;
>  {
>   sig_t oldintr;
> -  int ch, ointer;
> -  char *cp, *tp, *tp2;
> +  int ointer;
> +  char *cp, *tp;
>
>   if (argc < 2 && !another (&argc, &argv, "remote-files"))
>     {
> @@ -969,7 +969,7 @@ remglob (argv, doswitch)
>   int sofar = 0;
>   int oldverbose, oldhash;
>   int fd;
> -  char *cp, *mode, *end;
> +  char *cp, *mode;
>
>   if (!mflag)
>     {
> diff -urNp inetutils/ftp/ftp.c inetutils-build/ftp/ftp.c
> --- inetutils/ftp/ftp.c 2007-09-05 09:35:51.000000000 +0530
> +++ inetutils-build/ftp/ftp.c   2008-05-14 16:06:30.000000000 +0530
> @@ -1634,7 +1634,7 @@ gunique (local)
>  {
>   static char *new = 0;
>   char *cp;
> -  int d, count = 0;
> +  int count = 0;
>   char ext = '1';
>
>   if (new)
> diff -urNp inetutils/ftp/main.c inetutils-build/ftp/main.c
> --- inetutils/ftp/main.c        2007-09-05 09:35:51.000000000 +0530
> +++ inetutils-build/ftp/main.c  2008-05-14 16:07:25.000000000 +0530
> @@ -136,7 +136,7 @@ static struct argp argp = {argp_options,
>  int
>  main (int argc, char *argv[])
>  {
> -  int ch, top;
> +  int top;
>   int index;
>   struct passwd *pw = NULL;
>   char *cp;
> diff -urNp inetutils/ftpd/ftpd.c inetutils-build/ftpd/ftpd.c
> --- inetutils/ftpd/ftpd.c       2007-06-11 22:45:40.000000000 +0530
> +++ inetutils-build/ftpd/ftpd.c 2008-05-16 11:01:42.000000000 +0530
> @@ -578,7 +578,6 @@ sigquit (int signo)
>  static RETSIGTYPE
>  lostconn (int signo ARG_UNUSED)
>  {
> -  signo;
>   if (debug)
>     syslog (LOG_DEBUG, "lost connection");
>   dologout (-1);
> diff -urNp inetutils/ftpd/popen.c inetutils-build/ftpd/popen.c
> --- inetutils/ftpd/popen.c      2006-10-21 23:38:45.000000000 +0530
> +++ inetutils-build/ftpd/popen.c        2008-05-16 11:13:20.000000000 +0530
> @@ -198,7 +198,7 @@ int
>  ftpd_pclose (FILE * iop)
>  {
>   struct file_pid *fpid = file_pids, *prev_fpid = 0;
> -  int fdes, status;
> +  int status;
>  #ifdef HAVE_SIGACTION
>   sigset_t sigs, osigs;
>  #else
> diff -urNp inetutils/inetd/inetd.c inetutils-build/inetd/inetd.c
> --- inetutils/inetd/inetd.c     2007-06-29 21:59:32.000000000 +0530
> +++ inetutils-build/inetd/inetd.c       2008-05-14 17:31:15.000000000 +0530
> @@ -648,13 +648,12 @@ run_service (int ctrl, struct servtab *s
>  }
>
>  void
> -reapchild (int signo)
> +reapchild (int signo ARG_UNUSED)
>  {
>   int status;
>   pid_t pid;
>   struct servtab *sep;
>
> -  signo;                       /* shutup gcc */
>   for (;;)
>     {
>  #ifdef HAVE_WAIT3
> @@ -689,8 +688,6 @@ config (int signo)
>   struct stat stats;
>   struct servtab *sep;
>
> -  signo;                       /* Shutup gcc.  */
> -
>   for (sep = servtab; sep; sep = sep->se_next)
>     sep->se_checked = 0;
>
> @@ -871,11 +868,10 @@ nextconfig (const char *file)
>  }
>
>  void
> -retry (int signo)
> +retry (int signo ARG_UNUSED)
>  {
>   struct servtab *sep;
>
> -  signo;                       /* shutup gcc */
>   timingout = 0;
>   for (sep = servtab; sep; sep = sep->se_next)
>     if (sep->se_fd == -1 && !ISMUX (sep))
> @@ -1397,7 +1393,6 @@ echo_dg (int s, struct servtab *sep)
>   struct sockaddr sa;
>  #endif
>
> -  sep;
>   size = sizeof sa;
>   i = recvfrom (s, buffer, sizeof buffer, 0, (struct sockaddr *) &sa, &size);
>   if (i < 0)
> @@ -1428,7 +1423,7 @@ void
>  discard_dg (int s, struct servtab *sep)
>  {
>   char buffer[BUFSIZE];
> -  sep;                         /* shutup gcc */
> +
>   read (s, buffer, sizeof buffer);
>  }
>
> @@ -1497,7 +1492,6 @@ chargen_dg (int s, struct servtab *sep)
>   socklen_t size;
>   char text[LINESIZ + 2];
>
> -  sep;                         /* shutup gcc */
>   if (endring == 0)
>     {
>       initring ();
> @@ -1551,7 +1545,6 @@ machtime_stream (int s, struct servtab *
>  {
>   long result;
>
> -  sep;                         /* shutup gcc */
>   result = machtime ();
>   write (s, (char *) &result, sizeof result);
>  }
> @@ -1567,7 +1560,6 @@ machtime_dg (int s, struct servtab *sep)
>  #endif
>   socklen_t size;
>
> -  sep;                         /* shutup gcc */
>   size = sizeof sa;
>   if (recvfrom (s, (char *) &result, sizeof result, 0,
>                (struct sockaddr *) &sa, &size) < 0)
> @@ -1584,7 +1576,6 @@ daytime_stream (int s, struct servtab *s
>   char buffer[256];
>   time_t lclock;
>
> -  sep;                         /*shutup gcc */
>   lclock = time ((time_t *) 0);
>
>   sprintf (buffer, "%.24s\r\n", ctime (&lclock));
> @@ -1604,7 +1595,6 @@ daytime_dg (int s, struct servtab *sep)
>  #endif
>   socklen_t size;
>
> -  sep;                         /* shutup gcc */
>   lclock = time ((time_t *) 0);
>
>   size = sizeof sa;
> diff -urNp inetutils/libinetutils/argcv.c inetutils-build/libinetutils/argcv.c
> --- inetutils/libinetutils/argcv.c      2007-06-29 21:59:31.000000000 +0530
> +++ inetutils-build/libinetutils/argcv.c        2008-05-14 16:13:14.000000000 
> +0530
> @@ -66,7 +66,7 @@ int
>  argcv_get (const char *command, const char *delim, int *argc, char ***argv)
>  {
>   int len = strlen (command);
> -  int i = 0, j = 0;
> +  int i = 0;
>   int start, end, save;
>
>   *argc = 0;
> diff -urNp inetutils/libls/ls.c inetutils-build/libls/ls.c
> --- inetutils/libls/ls.c        2008-05-14 12:32:22.000000000 +0530
> +++ inetutils-build/libls/ls.c  2008-05-14 17:11:02.000000000 +0530
> @@ -107,7 +107,7 @@ ls_main (argc, argv)
>  {
>   static char dot[] = ".", *dotav[] = { dot, NULL };
>   struct winsize win;
> -  int ch, fts_options, notused;
> +  int ch, fts_options;
>   int kflag = 0;
>   char *p;
>
> diff -urNp inetutils/ping/ping6.c inetutils-build/ping/ping6.c
> --- inetutils/ping/ping6.c      2008-05-06 15:52:50.000000000 +0530
> +++ inetutils-build/ping/ping6.c        2008-05-14 17:14:31.000000000 +0530
> @@ -167,7 +167,6 @@ int
>  main (int argc, char **argv)
>  {
>   int index;
> -  u_char pattern[16];
>
>   if (getuid () == 0)
>     is_root = true;
> diff -urNp inetutils/rcp/util.c inetutils-build/rcp/util.c
> --- inetutils/rcp/util.c        2006-10-21 23:38:45.000000000 +0530
> +++ inetutils-build/rcp/util.c  2008-05-16 10:54:35.000000000 +0530
> @@ -109,7 +109,7 @@ int
>  susystem (char *s, int userid)
>  {
>   sig_t istat, qstat;
> -  int status, w;
> +  int status;
>   pid_t pid;
>
>   pid = vfork ();
> diff -urNp inetutils/rexecd/rexecd.c inetutils-build/rexecd/rexecd.c
> --- inetutils/rexecd/rexecd.c   2006-10-21 23:38:45.000000000 +0530
> +++ inetutils-build/rexecd/rexecd.c     2008-05-16 11:28:33.000000000 +0530
> @@ -326,7 +326,6 @@ void
>  error (const char *fmt, ...)
>  {
>   va_list ap;
> -  int len;
>   char buf[BUFSIZ];
>  #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__
>   va_start (ap, fmt);
> diff -urNp inetutils/rlogind/rlogind.c inetutils-build/rlogind/rlogind.c
> --- inetutils/rlogind/rlogind.c 2007-06-29 21:59:30.000000000 +0530
> +++ inetutils-build/rlogind/rlogind.c   2008-05-16 11:19:10.000000000 +0530
> @@ -1246,10 +1246,6 @@ protocol (int f, int p, struct auth_data
>   int cc, nfd, n;
>   char cntl;
>
> -#ifdef TIOCPKT
> -  int tiocpkt_on = 0;
> -#endif
> -
>   /*
>    * Must ignore SIGTTOU, otherwise we'll stop
>    * when we try and set slave pty's window shape
> @@ -1457,12 +1453,10 @@ control (int pty, char *cp, size_t n)
>  }
>
>  RETSIGTYPE
> -cleanup (int signo)
> +cleanup (int signo ARG_UNUSED)
>  {
>   char *p;
>
> -  signo;
> -
>   p = line + sizeof (PATH_DEV) - 1;
>  #ifdef UTMPX
>   utmp_logout (p);
> diff -urNp inetutils/rsh/rsh.c inetutils-build/rsh/rsh.c
> --- inetutils/rsh/rsh.c 2006-10-26 01:46:58.000000000 +0530
> +++ inetutils-build/rsh/rsh.c   2008-05-16 10:48:57.000000000 +0530
> @@ -728,7 +728,10 @@ void
>  sendsig (int sig)
>  {
>   char signo;
> +
> +#if defined(SHISHI) && defined (ENCRYPTION)
>   int n;
> +#endif
>
>   signo = sig;
>  #ifdef KERBEROS
> diff -urNp inetutils/talk/get_names.c inetutils-build/talk/get_names.c
> --- inetutils/talk/get_names.c  2006-10-21 23:38:45.000000000 +0530
> +++ inetutils-build/talk/get_names.c    2008-05-16 11:05:50.000000000 +0530
> @@ -57,7 +57,7 @@ get_names (int argc, char *argv[])
>  {
>   char *his_name, *my_name;
>   char *my_machine_name, *his_machine_name;
> -  char *my_tty, *his_tty;
> +  char *his_tty;
>   register char *cp;
>
>   if (argc < 2)
> diff -urNp inetutils/talk/invite.c inetutils-build/talk/invite.c
> --- inetutils/talk/invite.c     2006-10-21 23:38:45.000000000 +0530
> +++ inetutils-build/talk/invite.c       2008-05-14 17:16:14.000000000 +0530
> @@ -75,7 +75,7 @@ jmp_buf invitebuf;
>  int
>  invite_remote ()
>  {
> -  int nfd, read_mask, template, new_sockt;
> +  int new_sockt;
>   struct itimerval itimer;
>   CTL_RESPONSE response;
>
> diff -urNp inetutils/talk/look_up.c inetutils-build/talk/look_up.c
> --- inetutils/talk/look_up.c    2006-10-21 23:38:45.000000000 +0530
> +++ inetutils-build/talk/look_up.c      2008-05-16 10:51:33.000000000 +0530
> @@ -100,8 +100,6 @@ int
>  look_for_invite (rp)
>      CTL_RESPONSE *rp;
>  {
> -  struct in_addr machine_addr;
> -
>   current_state = "Checking for invitation on caller's machine";
>   ctl_transact (his_machine_addr, msg, LOOK_UP, rp);
>   /* the switch is for later options, such as multiple invitations */
> diff -urNp inetutils/talkd/talkd.c inetutils-build/talkd/talkd.c
> --- inetutils/talkd/talkd.c     2007-06-29 21:59:29.000000000 +0530
> +++ inetutils-build/talkd/talkd.c       2008-05-16 11:10:44.000000000 +0530
> @@ -82,7 +82,7 @@ parse_opt (int key, char *arg, struct ar
>       break;
>
>     default:
> -      ARGP_ERR_UNKNOWN;
> +      return ARGP_ERR_UNKNOWN;
>     }
>
>   return 0;
> diff -urNp inetutils/telnet/commands.c inetutils-build/telnet/commands.c
> --- inetutils/telnet/commands.c 2007-06-04 22:57:02.000000000 +0530
> +++ inetutils-build/telnet/commands.c   2008-05-16 10:58:06.000000000 +0530
> @@ -322,7 +322,6 @@ sendcmd (int argc, char **argv)
>  {
>   int count;                   /* how many bytes we are going to need to send 
> */
>   int i;
> -  int question = 0;            /* was at least one argument a question */
>   struct sendlist *s;          /* pointer to current command */
>   int success = 0;
>   int needconnect = 0;
> diff -urNp inetutils/telnet/utilities.c inetutils-build/telnet/utilities.c
> --- inetutils/telnet/utilities.c        2006-10-21 23:38:45.000000000 +0530
> +++ inetutils-build/telnet/utilities.c  2008-05-16 11:04:18.000000000 +0530
> @@ -139,7 +139,6 @@ Dump (char direction, unsigned char *buf
>  #define min(x,y)       ((x<y)? x:y)
>   unsigned char *pThis;
>   int offset;
> -  extern pettydump;
>
>   offset = 0;
>
> @@ -330,9 +329,12 @@ void
>  printsub (char direction, unsigned char *pointer, int length)
>  {
>   register int i;
> -  char buf[512];
>   extern int want_status_response;
>
> +#if defined(AUTHENTICATION) && defined(ENCRYPTION)
> +  char buf[512];
> +#endif
> +
>   if (showoptions || direction == 0 ||
>       (want_status_response && (pointer[0] == TELOPT_STATUS)))
>     {
> @@ -924,7 +926,6 @@ printsub (char direction, unsigned char
>                        break;
>
>                      default:
> -                     def_case:
>                        if (isprint (pointer[i]) && pointer[i] != '"')
>                          {
>                            if (noquote)
> diff -urNp inetutils/telnetd/utility.c inetutils-build/telnetd/utility.c
> --- inetutils/telnetd/utility.c 2007-06-29 21:59:28.000000000 +0530
> +++ inetutils-build/telnetd/utility.c   2008-05-16 11:12:25.000000000 +0530
> @@ -886,7 +886,10 @@ void
>  printsub (int direction, unsigned char *pointer, int length)
>  {
>   register int i;
> +
> +#if defined(AUTHENTICATION) && defined(ENCRYPTION)
>   char buf[512];
> +#endif
>
>   if (direction)
>     {
> @@ -1319,7 +1322,6 @@ printsub (int direction, unsigned char *
>                    break;
>
>                  default:
> -                 def_case:
>                    if (isprint (pointer[i]) && pointer[i] != '"')
>                      {
>                        if (noquote)
> diff -urNp inetutils/uucpd/uucpd.c inetutils-build/uucpd/uucpd.c
> --- inetutils/uucpd/uucpd.c     2006-10-21 23:38:45.000000000 +0530
> +++ inetutils-build/uucpd/uucpd.c       2008-05-16 11:21:55.000000000 +0530
> @@ -103,7 +103,10 @@ int
>  main (int argc, char **argv)
>  {
>  #ifndef BSDINETD
> -  register int s, tcp_socket;
> +  register int s;
> +# ifdef BSD4_2
> +  register int tcp_socket;
> +# endif
>   struct servent *sp;
>  #endif /* !BSDINETD */
>   extern int errno;
> @@ -318,7 +321,7 @@ dologin (struct passwd *pw, struct socka
>  {
>   char line[32];
>   char remotehost[32];
> -  int wtmp, f;
> +  int f;
>   struct hostent *hp = gethostbyaddr ((char *) &sin->sin_addr,
>                                      sizeof (struct in_addr), AF_INET);
>
> Comments?
>
> Happy hacking,
> Debarshi
> --
> "From what we get, we can make a living; what we give, however, makes a life."
>  -- Arthur Ashe
>
>
> _______________________________________________
> bug-inetutils mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-inetutils
>



-- 
Jeff Bailey - http://www.raspberryginger.com/jbailey/
"Gay marriage will encourage people to be gay, in the same way that
hanging around tall people will make you tall."
 - Peter Gallagher




reply via email to

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