Changeset 0c8e692 in mainline for generic/src/lib/func.c
- Timestamp:
- 2005-12-11T19:55:56Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3550c393
- Parents:
- 54aff98
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/lib/func.c
r54aff98 r0c8e692 80 80 * @param len Maximal length for comparison. 81 81 * 82 * @return 0 if the strings are equal, 1 otherwise.82 * @return 0 if the strings are equal, -1 if first is smaller, 1 if second smaller. 83 83 * 84 84 */ … … 88 88 89 89 i = 0; 90 while ((i < len) && (src[i] == dst[i])) { 91 if ((i == len - 1) || (src[i] == '\0')) 92 return 0; 93 i++; 90 for (;*src && *dst && i < len;src++,dst++,i++) { 91 if (*src < *dst) 92 return -1; 93 if (*src > *dst) 94 return 1; 94 95 } 96 if (i == len || *src == *dst) 97 return 0; 98 if (*src < *dst) 99 return -1; 95 100 return 1; 96 101 }
Note:
See TracChangeset
for help on using the changeset viewer.