Changeset 272 for trunk/src/slib.c


Ignore:
Timestamp:
Jan 27, 2010, 10:52:20 PM (15 years ago)
Author:
katerina
Message:

Fixes tickets #190, #191, #192, #193, and #194.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/slib.c

    r252 r272  
    10801080  if (a != NULL && b != NULL)
    10811081    return (strncmp(a, b, n));
     1082  else if (a == NULL && b != NULL)
     1083    return (-1);
     1084  else if (a != NULL && b == NULL)
     1085    return (1);
     1086  else
     1087    return (-7); /* default to not equal */
     1088}
     1089
     1090int sl_strncasecmp(const char * a, const char * b, size_t n)
     1091{
     1092#ifdef SL_FAIL_ON_ERROR
     1093  SL_REQUIRE (a != NULL, _("a != NULL"));
     1094  SL_REQUIRE (b != NULL, _("b != NULL"));
     1095  SL_REQUIRE (n > 0, _("n > 0"));
     1096#endif
     1097
     1098  if (a != NULL && b != NULL)
     1099    return (strncasecmp(a, b, n));
    10821100  else if (a == NULL && b != NULL)
    10831101    return (-1);
Note: See TracChangeset for help on using the changeset viewer.