| 210 | |
| 211 | |
| 212 | static int l_strcmp (const TString *ls, const TString *rs) { |
| 213 | const char *l = getstr(ls); |
| 214 | size_t ll = ls->tsv.len; |
| 215 | const char *r = getstr(rs); |
| 216 | size_t lr = rs->tsv.len; |
| 217 | for (;;) { |
| 218 | int temp = strcoll(l, r); |
| 219 | if (temp != 0) return temp; |
| 220 | else { /* strings are equal up to a `\0' */ |
| 221 | size_t len = strlen(l); /* index of first `\0' in both strings */ |
| 222 | if (len == lr) /* r is finished? */ |
| 223 | return (len == ll) ? 0 : 1; |
| 224 | else if (len == ll) /* l is finished? */ |
| 225 | return -1; /* l is smaller than r (because r is not finished) */ |
| 226 | /* both strings longer than `len'; go on comparing (after the `\0') */ |
| 227 | len++; |
| 228 | l += len; ll -= len; r += len; lr -= len; |
| 229 | } |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | |
| 234 | /* COMDB2 MODIFICATION */ |
no test coverage detected