[BusyBox] warning in uniq_main() !?

Steven Scholz steven.scholz at imc-berlin.de
Wed Aug 13 10:33:31 UTC 2003


Hi there,

uniq_main() contains the comment

         /* Note: Ignore the warning about dups and e0 possibly being uninitialized.
          * They will be initialized on the fist pass of the loop (since s0 is NULL). */
why not do just

diff -u -r1.21 uniq.c
--- ./coreutils/uniq.c  19 Mar 2003 09:11:34 -0000      1.21
+++ ./coreutils/uniq.c  13 Aug 2003 10:31:50 -0000
@@ -38,8 +38,8 @@
         FILE *in, *out;
         /* Note: Ignore the warning about dups and e0 possibly being uninitialized.
          * They will be initialized on the fist pass of the loop (since s0 is NULL). */
-       unsigned long dups, skip_fields, skip_chars, i;
-       const char *s0, *e0, *s1, *e1, *input_filename;
+       unsigned long dups=0, skip_fields, skip_chars, i;
+       const char *s0, *e0=NULL, *s1, *e1, *input_filename;
         int opt;
         int uniq_flags = 6;             /* -u */

to avoid this warning?

(Or is it just me who don't like red and blue lines in the compiler output?)

Thanks,

Steven





More information about the busybox mailing list