… | |
… | |
62 | return TRUE; |
62 | return TRUE; |
63 | } |
63 | } |
64 | #endif |
64 | #endif |
65 | #endif |
65 | #endif |
66 | |
66 | |
67 | char * fptools_id = "$Id: fptools.c,v 1.14 2020/12/11 20:27:00 root Exp $"; |
67 | char * fptools_id = "$Id: fptools.c,v 1.15 2020/12/11 21:59:30 root Exp $"; |
68 | |
68 | |
69 | /* |
69 | /* |
70 | * some versions of free can't handle a NULL pointer properly |
70 | * some versions of free can't handle a NULL pointer properly |
71 | * (ANSI says, free ignores a NULL pointer, but some machines |
71 | * (ANSI says, free ignores a NULL pointer, but some machines |
72 | * prefer to SIGSEGV on it) |
72 | * prefer to SIGSEGV on it) |
… | |
… | |
176 | #endif |
176 | #endif |
177 | |
177 | |
178 | int TOOLEXPORT |
178 | int TOOLEXPORT |
179 | FP_strnicmp_fast (const char *str1, const char *str2, int count) |
179 | FP_strnicmp_fast (const char *str1, const char *str2, int count) |
180 | { |
180 | { |
181 | if (str1==NULL || str2==NULL) |
181 | if (!str1 || !str2) |
182 | return -1; |
182 | return -1; |
183 | |
183 | |
184 | while (*str1 && count) { |
184 | while (*str1 && count) { |
185 | if ((*str1 ^ *str2) & 0xdf) |
185 | if ((*str1 ^ *str2) & 0xdf) |
186 | break; |
186 | break; |
… | |
… | |
280 | /* |
280 | /* |
281 | * Nice fake of the real (non-standard) one |
281 | * Nice fake of the real (non-standard) one |
282 | */ |
282 | */ |
283 | |
283 | |
284 | char * TOOLEXPORT |
284 | char * TOOLEXPORT |
285 | FP_strrstr (char *ptr, char *str) |
285 | FP_strrstr (const char *ptr, const char *str) |
286 | { |
286 | { |
287 | char *found=NULL, *new, *iter=ptr; |
287 | const char *found=NULL, *new, *iter=ptr; |
288 | |
288 | |
289 | if (ptr==NULL || str==NULL) |
289 | if (ptr==NULL || str==NULL) |
290 | return NULL; |
290 | return NULL; |
291 | |
291 | |
292 | if (*str == '\0') |
292 | if (*str == '\0') |
293 | return ptr; |
293 | return (char *)ptr; |
294 | |
294 | |
295 | while ((new = FP_strstr (iter, str)) != NULL) { |
295 | while ((new = FP_strstr (iter, str)) != NULL) { |
296 | found = new; |
296 | found = new; |
297 | iter = new + 1; |
297 | iter = new + 1; |
298 | } |
298 | } |
|
|
299 | |
299 | return found; |
300 | return (char *)found; |
300 | } |
301 | } |
301 | |
302 | |
302 | char * TOOLEXPORT |
303 | char * TOOLEXPORT |
303 | FP_strirstr (char *ptr, char *str) |
304 | FP_strirstr (char *ptr, char *str) |
304 | { |
305 | { |