* Like strcmp(), but also return the offset of the first change. * If strings are equal, return the length. */
| 1087 | * If strings are equal, return the length. |
| 1088 | */ |
| 1089 | int strcmp_offset(const char *s1, const char *s2, size_t *first_change) |
| 1090 | { |
| 1091 | size_t k; |
| 1092 | |
| 1093 | if (!first_change) |
| 1094 | return strcmp(s1, s2); |
| 1095 | |
| 1096 | for (k = 0; s1[k] == s2[k]; k++) |
| 1097 | if (s1[k] == '\0') |
| 1098 | break; |
| 1099 | |
| 1100 | *first_change = k; |
| 1101 | return (unsigned char)s1[k] - (unsigned char)s2[k]; |
| 1102 | } |
| 1103 | |
| 1104 | /* |
| 1105 | * Do we have another file with a pathname that is a proper |
no outgoing calls
no test coverage detected