Changeset 3762
- Timestamp:
- Mar 15, 2012, 2:40:59 AM (13 years ago)
- Location:
- trunk/libc/src/fbsdlibc/string
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libc/src/fbsdlibc/string/wcscmp.c
r1748 r3762 54 54 const wchar_t *s1, *s2; 55 55 { 56 56 #if 0 /* bird: Original FreeBSD code */ 57 57 while (*s1 == *s2++) 58 58 if (*s1++ == 0) … … 60 60 /* XXX assumes wchar_t = int */ 61 61 return (*(const unsigned int *)s1 - *(const unsigned int *)--s2); 62 #else /* bird: Should be safe and correct for all wchar_t types. */ 63 wchar_t wc1; 64 while ((wc1 = *s1) == *s2) 65 { 66 if (!wc1) 67 return 0; 68 s1++; 69 s2++; 70 } 71 return wc1 < *s2 ? -1 : 1; 72 #endif 62 73 } -
trunk/libc/src/fbsdlibc/string/wcsncmp.c
r1748 r3762 49 49 size_t n; 50 50 { 51 51 #if 0 /* Original FreeBSD code. */ 52 52 if (n == 0) 53 53 return (0); … … 61 61 break; 62 62 } while (--n != 0); 63 #else /* bird: Should be safe and correct for all wchar_t types. */ 64 while (n > 0) 65 { 66 wchar_t wc1 = *s1; 67 if (wc1 != *s2) 68 return wc1 < *s2 ? -1 : 1; 69 if (!wc1) 70 break; 71 s2++; 72 s1++; 73 n--; 74 } 75 #endif 63 76 return (0); 64 77 }
Note:
See TracChangeset
for help on using the changeset viewer.