1
0

string_nocasecmp.c 944 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * string_nocasecmp.c
  3. */
  4. #include "private.h"
  5. #include "lub/ctype.h"
  6. /*--------------------------------------------------------- */
  7. int
  8. lub_string_nocasecmp(const char *cs,
  9. const char *ct)
  10. {
  11. int result = 0;
  12. while( (0==result) && *cs && *ct)
  13. {
  14. /*lint -e155 Ignoring { }'ed sequence within an expression, 0 assumed
  15. * MACRO implementation uses braces to prevent multiple increments
  16. * when called.
  17. */
  18. int s = lub_ctype_tolower(*cs++);
  19. int t = lub_ctype_tolower(*ct++);
  20. result = s - t;
  21. }
  22. /*lint -e774 Boolean within 'if' always evealuates to True
  23. * not the case because of tolower() evaluating to 0 under lint
  24. * (see above)
  25. */
  26. if(0 == result)
  27. {
  28. /* account for different string lengths */
  29. result = *cs - *ct;
  30. }
  31. return result;
  32. }
  33. /*--------------------------------------------------------- */