/* * ### FASTER STRING ROUTINES REPLACING STRING.H ONES (may be an incomplete implementation) * Copyright (c)2007 Daniel Mealha Cabrita * * Released under the GNU General Public License v2 or later version. */ #include "fstring.h" #ifdef USE_CUSTOM_STRING_ROUTINES /* returns ==0 equal, !=0 different */ int custom_strncasecmp (const unsigned char *src1, const unsigned char *src2, int len) { int retcode = 0; while (len--) { if (lowercase_table [*(src1++)] != lowercase_table [*(src2++)]) { retcode = 1; len = 0; } } return (retcode); } /* returns ==0 equal, !=0 different */ int custom_strncmp (const unsigned char *src1, const unsigned char *src2, int len) { int retcode = 0; while (len--) { if (*(src1++) != *(src2++)) { retcode = 1; len = 0; } } return (retcode); } int custom_strlen (const unsigned char *src) { int srclen = 0; while (*(src++) != '\0') srclen++; return (srclen); } #endif