ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-UUlib/uulib/fptools.c
(Generate patch)

Comparing Convert-UUlib/uulib/fptools.c (file contents):
Revision 1.13 by root, Fri Dec 11 20:09:23 2020 UTC vs.
Revision 1.14 by root, Fri Dec 11 20:27:00 2020 UTC

62 return TRUE; 62 return TRUE;
63} 63}
64#endif 64#endif
65#endif 65#endif
66 66
67char * fptools_id = "$Id: fptools.c,v 1.13 2020/12/11 20:09:23 root Exp $"; 67char * fptools_id = "$Id: fptools.c,v 1.14 2020/12/11 20:27:00 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)
120/* 120/*
121 * duplicate a memory area 121 * duplicate a memory area
122 */ 122 */
123 123
124void * TOOLEXPORT 124void * TOOLEXPORT
125FP_memdup (void *ptr, int len) 125FP_memdup (const void *ptr, int len)
126{ 126{
127 void *result; 127 void *result;
128 128
129 if (ptr == NULL) 129 if (ptr == NULL)
130 return NULL; 130 return NULL;
172 count--; 172 count--;
173 } 173 }
174 return count ? (tolower (*str1) - tolower (*str2)) : 0; 174 return count ? (tolower (*str1) - tolower (*str2)) : 0;
175} 175}
176#endif 176#endif
177
178int TOOLEXPORT
179FP_strnicmp_fast (const char *str1, const char *str2, int count)
180{
181 if (str1==NULL || str2==NULL)
182 return -1;
183
184 while (*str1 && count) {
185 if ((*str1 ^ *str2) & 0xdf)
186 break;
187
188 str1++;
189 str2++;
190 count--;
191 }
192
193 return (*str1 & 0xdf) - (*str2 & 0xdf);
194}
177 195
178char * TOOLEXPORT 196char * TOOLEXPORT
179FP_strpbrk (char *str, char *accept) 197FP_strpbrk (char *str, char *accept)
180{ 198{
181 char *ptr; 199 char *ptr;
365 383
366 return 1; 384 return 1;
367} 385}
368 386
369char * TOOLEXPORT 387char * TOOLEXPORT
370FP_strrchr (char *string, int tc) 388FP_strrchr (const char *string, int tc)
371{ 389{
372 char *ptr; 390 const char *ptr;
373 391
374 if (string == NULL || !*string) 392 if (string == NULL || !*string)
375 return NULL; 393 return NULL;
376 394
377 ptr = string + strlen (string) - 1; 395 ptr = string + strlen (string) - 1;
378 396
379 while (ptr != string && *ptr != tc) 397 while (ptr != string && *ptr != tc)
380 ptr--; 398 ptr--;
381 399
382 if (*ptr == tc) 400 if (*ptr == tc)
383 return ptr; 401 return (char *)ptr;
384 402
385 return NULL; 403 return NULL;
386} 404}
387 405
388/* 406/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines