On Tue, Jul 10, 2018 at 05:00:15PM +0200, Theo Buehler wrote: > Had these Ms in my trees for a while. > > Does not fix all warnings, but a few simple ones: > > Use "%s" to print modifiable strings, add a couple of braces, ansify a > few functions and remove a few extra parens.
Looks good to me! OK > Index: diff/diff3.c > =================================================================== > RCS file: /var/cvs/src/gnu/usr.bin/cvs/diff/diff3.c,v > retrieving revision 1.1.1.6 > diff -u -p -r1.1.1.6 diff3.c > --- diff/diff3.c 28 Sep 2001 22:45:41 -0000 1.1.1.6 > +++ diff/diff3.c 29 Jun 2018 08:47:56 -0000 > @@ -1502,7 +1502,7 @@ output_diff3 (diff, mapping, rev_mapping > line = 0; > do > { > - printf_output (line_prefix); > + printf_output ("%s", line_prefix); > cp = D_RELNUM (ptr, realfile, line); > length = D_RELLEN (ptr, realfile, line); > write_output (cp, length); > @@ -1554,11 +1554,12 @@ undotlines (leading_dot, start, num) > int leading_dot, start, num; > { > write_output (".\n", 2); > - if (leading_dot) > + if (leading_dot) { > if (num == 1) > printf_output ("%ds/^\\.//\n", start); > else > printf_output ("%d,%ds/^\\.//\n", start, start + num - 1); > + } > } > > /* > @@ -1749,11 +1750,12 @@ output_diff3_merge (infile, diff, mappin > do > { > c = getc (infile); > - if (c == EOF) > + if (c == EOF) { > if (ferror (infile)) > diff3_perror_with_exit ("input file"); > else if (feof (infile)) > diff3_fatal ("input file shrank"); > + } > cc = c; > write_output (&cc, 1); > } > @@ -1803,7 +1805,7 @@ output_diff3_merge (infile, diff, mappin > linesread += i; > while (0 <= --i) > while ((c = getc (infile)) != '\n') > - if (c == EOF) > + if (c == EOF) { > if (ferror (infile)) > diff3_perror_with_exit ("input file"); > else if (feof (infile)) > @@ -1812,6 +1814,7 @@ output_diff3_merge (infile, diff, mappin > diff3_fatal ("input file shrank"); > return conflicts_found; > } > + } > } > /* Copy rest of common file. */ > while ((c = getc (infile)) != EOF || !(ferror (infile) | feof (infile))) > Index: diff/side.c > =================================================================== > RCS file: /var/cvs/src/gnu/usr.bin/cvs/diff/side.c,v > retrieving revision 1.1.1.2 > diff -u -p -r1.1.1.2 side.c > --- diff/side.c 22 Aug 1998 20:52:06 -0000 1.1.1.2 > +++ diff/side.c 29 Jun 2018 08:49:17 -0000 > @@ -122,7 +122,7 @@ print_half_line (line, indent, out_bound > break; > > case '\b': > - if (in_position != 0 && --in_position < out_bound) > + if (in_position != 0 && --in_position < out_bound) { > if (out_position <= in_position) > /* Add spaces to make up for suppressed tab past out_bound. */ > for (; out_position < in_position; out_position++) > @@ -133,6 +133,7 @@ print_half_line (line, indent, out_bound > cc = c; > write_output (&cc, 1); > } > + } > break; > > case '\f': > Index: lib/getline.c > =================================================================== > RCS file: /var/cvs/src/gnu/usr.bin/cvs/lib/getline.c,v > retrieving revision 1.2 > diff -u -p -r1.2 getline.c > --- lib/getline.c 4 Mar 2012 04:05:15 -0000 1.2 > +++ lib/getline.c 29 Jun 2018 12:46:26 -0000 > @@ -46,13 +46,8 @@ char *malloc (), *realloc (); > error. */ > > int > -getstr (lineptr, n, stream, terminator, offset, limit) > - char **lineptr; > - size_t *n; > - FILE *stream; > - char terminator; > - int offset; > - int limit; > +getstr (char **lineptr, size_t *n, FILE *stream, char terminator, int offset, > + int limit) > { > int nchars_avail; /* Allocated but unused chars in *LINEPTR. */ > char *read_pos; /* Where we're reading into *LINEPTR. */ > @@ -154,20 +149,13 @@ getstr (lineptr, n, stream, terminator, > } > > int > -get_line (lineptr, n, stream) > - char **lineptr; > - size_t *n; > - FILE *stream; > +get_line (char **lineptr, size_t *n, FILE *stream) > { > return getstr (lineptr, n, stream, '\n', 0, GETLINE_NO_LIMIT); > } > > int > -getline_safe (lineptr, n, stream, limit) > - char **lineptr; > - size_t *n; > - FILE *stream; > - int limit; > +getline_safe (char **lineptr, size_t *n, FILE *stream, int limit) > { > return getstr (lineptr, n, stream, '\n', 0, limit); > } > Index: lib/regex.c > =================================================================== > RCS file: /var/cvs/src/gnu/usr.bin/cvs/lib/regex.c,v > retrieving revision 1.1.1.7 > diff -u -p -r1.1.1.7 regex.c > --- lib/regex.c 10 Feb 2001 18:57:25 -0000 1.1.1.7 > +++ lib/regex.c 29 Jun 2018 08:45:19 -0000 > @@ -2514,11 +2514,12 @@ regex_compile (pattern, size, syntax, bu > case ')': > if (syntax & RE_NO_BK_PARENS) goto normal_backslash; > > - if (COMPILE_STACK_EMPTY) > + if (COMPILE_STACK_EMPTY) { > if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) > goto normal_backslash; > else > FREE_STACK_RETURN (REG_ERPAREN); > + } > > handle_close: > if (fixup_alt_jump) > @@ -2534,11 +2535,12 @@ regex_compile (pattern, size, syntax, bu > } > > /* See similar code for backslashed left paren above. */ > - if (COMPILE_STACK_EMPTY) > + if (COMPILE_STACK_EMPTY) { > if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) > goto normal_char; > else > FREE_STACK_RETURN (REG_ERPAREN); > + } > > /* Since we just checked for an empty stack above, this > ``can't happen''. */ > Index: src/admin.c > =================================================================== > RCS file: /var/cvs/src/gnu/usr.bin/cvs/src/admin.c,v > retrieving revision 1.3 > diff -u -p -r1.3 admin.c > --- src/admin.c 31 Aug 2016 13:16:47 -0000 1.3 > +++ src/admin.c 29 Jun 2018 08:50:06 -0000 > @@ -776,7 +776,7 @@ admin_fileproc (callerdat, finfo) > if (delta->other_delta == NULL) > delta->other_delta = getlist(); > > - if (n = findnode (delta->other_delta, "commitid")) > + if ((n = findnode (delta->other_delta, "commitid"))) > { > error (0, 0, "%s: revision %s already has commitid %s", > rcs->path, rev, n->data); > Index: src/hash.c > =================================================================== > RCS file: /var/cvs/src/gnu/usr.bin/cvs/src/hash.c,v > retrieving revision 1.1.1.11 > diff -u -p -r1.1.1.11 hash.c > --- src/hash.c 10 Feb 2001 18:57:40 -0000 1.1.1.11 > +++ src/hash.c 29 Jun 2018 08:53:31 -0000 > @@ -306,7 +306,7 @@ findnode (list, key) > /* This probably should be "assert (list != NULL)" (or if not we > should document the current behavior), but only if we check all > the callers to see if any are relying on this behavior. */ > - if ((list == (List *) NULL)) > + if (list == (List *) NULL) > return ((Node *) NULL); > > assert (key != NULL); >