Hi Alejandro,
> I still see some uses of strcmp(3) within gnulib. Is there a reason for
> them? Should we replace them too?
> lib/unistr/u32-strcmp.c:32:u32_strcmp (const uint32_t *s1, const uint32_t *s2)
> lib/unistr/u8-strcmp.c:34:u8_strcmp (const uint8_t *s1, const uint8_t *s2)
> lib/unistr/u16-strcmp.c:32:u16_strcmp (const uint16_t *s1, const uint16_t *s2)
> lib/fstrcmp.c:52: fstrcmp(). */
> lib/fstrcmp.h:31:extern double fstrcmp (const char *s1, const char *s2);
> lib/fstrcmp.h:39:#define fstrcmp(s1,s2) fstrcmp_bounded (s1, s2, 0.0)
> lib/unistr.in.h:865:/* Avoid a collision with the u8_strcmp() function in
> Solaris 11 libc. */
> lib/unistr.in.h:872: u8_strcmp (const uint8_t *s1, const uint8_t *s2)
> lib/unistr.in.h:876: u16_strcmp (const uint16_t *s1, const uint16_t *s2)
> lib/unistr.in.h:879: u32_strcmp (const uint32_t *s1, const uint32_t *s2)
These are not strcmp, but other functions.
> lib/wcsxfrm-impl.h:65: Since strcmp() compares the elements as
> 'unsigned char' values,
> lib/astrxfrm.h:32: and astrxfrm(S2) with strcmp().
> lib/unistr.in.h:863:/* Similar to strcmp(), wcscmp(). */
> lib/stackvma.c:1826: /* && strcmp (u.sysname, "AIX") == 0 */
> lib/localcharset.c:1012: strcmp (table[i].alias, codeset)
> == 0. */
> lib/localcharset.c:1086: strcmp (table[i].locale, locale) ==
> 0. */
> lib/setlocale.c:639: strcmp (language_table[i].code, string) ==
> 0.
> lib/setlocale.c:667: strcmp (language_table[i].code, string) == > 0
> lib/streq.h:32: strcmp (s, "EUC-KR") == 0
These are merely comments.
> lib/unistr/u8-strcmp.c:37: return strcmp ((const char *) s1, (const char *)
> s2);
> lib/setlocale.c:631: int cmp = strcmp (table[mid].code, string);
> lib/localcharset.c:1004: int cmp = strcmp (table[mid].alias,
> codeset);
> lib/localcharset.c:1078: int cmp = strcmp (table[mid].locale, locale);
> lib/setlocale.c:1401: return strcmp (territory1, territory2);
These are uses of strcmp which are not compared for == 0 or != 0.
> lib/gen-uni-tables.c:73: return !strcmp (s1, s2);
This is source code that is not compiled with other gnulib modules.
> lib/strftime.c:1119: if (strcmp (locale_charset (), "UTF-8") == 0)
> lib/strftime.c:1574: (strcmp (locale, "C") == 0 || strcmp (locale,
> "POSIX") == 0);
> lib/strptime.c:307: && strcmp (_NL_CURRENT (LC_TIME,
> DAY_1 + cnt),
> lib/strptime.c:315: && strcmp (_NL_CURRENT (LC_TIME,
> ABDAY_1 + cnt),
> lib/strptime.c:348: && strcmp (_NL_CURRENT (LC_TIME,
> MON_1 + cnt),
> lib/strptime.c:356: && strcmp (_NL_CURRENT (LC_TIME,
> ABMON_1 + cnt),
> lib/strptime.c:391: strcmp (_NL_CURRENT (LC_TIME,
> D_T_FMT), HERE_D_T_FMT))
> lib/strptime.c:439: && strcmp (_NL_CURRENT (LC_TIME,
> D_FMT), HERE_D_FMT))
> lib/strptime.c:500: if (strcmp (_NL_CURRENT (LC_TIME,
> AM_STR), HERE_AM_STR))
> lib/strptime.c:506: if (strcmp (_NL_CURRENT (LC_TIME,
> PM_STR), HERE_PM_STR))
> lib/strptime.c:545: strcmp (_NL_CURRENT (LC_TIME,
> T_FMT_AMPM),
> lib/strptime.c:600: if (strcmp (_NL_CURRENT (LC_TIME,
> T_FMT), HERE_T_FMT))
> lib/strptime.c:737: if (strcmp (fmt, HERE_D_T_FMT))
> lib/strptime.c:902: if (strcmp (fmt, HERE_D_FMT))
> lib/strptime.c:928: if (strcmp (fmt, HERE_T_FMT))
> lib/regcomp.c:840: && strcmp (_NL_CURRENT (LC_CTYPE,
> _NL_CTYPE_CODESET_NAME), "UTF-8") == 0)
> lib/regcomp.c:849: && strcmp (codeset_name + 3 + (codeset_name[3] ==
> '-'), "8") == 0)
> lib/regcomp.c:3481: && (strcmp (name, "upper") == 0 || strcmp (name,
> "lower") == 0))
> lib/regcomp.c:3516: if (strcmp (name, "alnum") == 0)
> lib/regcomp.c:3518: else if (strcmp (name, "cntrl") == 0)
> lib/regcomp.c:3520: else if (strcmp (name, "lower") == 0)
> lib/regcomp.c:3522: else if (strcmp (name, "space") == 0)
> lib/regcomp.c:3524: else if (strcmp (name, "alpha") == 0)
> lib/regcomp.c:3526: else if (strcmp (name, "digit") == 0)
> lib/regcomp.c:3528: else if (strcmp (name, "print") == 0)
> lib/regcomp.c:3530: else if (strcmp (name, "upper") == 0)
> lib/regcomp.c:3532: else if (strcmp (name, "blank") == 0)
> lib/regcomp.c:3534: else if (strcmp (name, "graph") == 0)
> lib/regcomp.c:3536: else if (strcmp (name, "punct") == 0)
> lib/regcomp.c:3538: else if (strcmp (name, "xdigit") == 0)
> lib/tmpdir.c:138: else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists
> ("/tmp"))
> lib/error.c:311: && strcmp (old_file_name, file_name) == 0)))
This is source code that is shared with glibc.
> lib/string.in.h:812: return !strcmp (__s1, __s2);
> lib/setenv.c:446:# define STREQ(a, b) (strcmp (a, b) == 0)
> lib/streq.h:177: (strcmp (s1, s2) == 0)
> lib/dfa.c:54:# define streq(a, b) (strcmp (a, b) == 0)
These are definitions of streq or STREQ or STREQ_OPT.
> lib/relocatable.c:136: && strcmp (orig_prefix_arg, curr_prefix_arg) != 0)
> lib/relocatable.c:352: && strcmp (shared_library_fullname,
> location) == 0))
> lib/setenv.c:381: if (strcmp (existing_value, value) == 0)
This source code is part of 'relocatable-prog-wrapper', which
better avoids too many Gnulib module dependencies.
> lib/exclude.c:333: : strcmp (pattern, f));
streq could be used here, but it's a judgement call.
Bruno