Changeset 28ecadb in mainline for boot/generic/string.c
- Timestamp:
- 2006-09-22T21:44:54Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5d684e4
- Parents:
- 16529d5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/generic/string.c
r16529d5 r28ecadb 58 58 * Do a char-by-char comparison of two NULL terminated strings. 59 59 * The strings are considered equal iff they consist of the same 60 * characters on the minimum of their lengths. 61 * 62 * @param src First string to compare. 63 * @param dst Second string to compare. 64 * 65 * @return 0 if the strings are equal, -1 if first is smaller, 1 if second smaller. 66 * 67 */ 68 int strcmp(const char *src, const char *dst) 69 { 70 for (; *src && *dst; src++, dst++) { 71 if (*src < *dst) 72 return -1; 73 if (*src > *dst) 74 return 1; 75 } 76 if (*src == *dst) 77 return 0; 78 if (!*src) 79 return -1; 80 return 1; 81 } 82 83 84 /** Compare two NULL terminated strings 85 * 86 * Do a char-by-char comparison of two NULL terminated strings. 87 * The strings are considered equal iff they consist of the same 60 88 * characters on the minimum of their lengths and specified maximal 61 89 * length. … … 72 100 int i; 73 101 74 i = 0; 75 for (;*src && *dst && i < len;src++,dst++,i++) { 102 for (i = 0; *src && *dst && i < len; src++, dst++, i++) { 76 103 if (*src < *dst) 77 104 return -1;
Note:
See TracChangeset
for help on using the changeset viewer.