| 15030 | |
| 15031 | |
| 15032 | static int l_strcmp (const TString *ls, const TString *rs) { |
| 15033 | const char *l = getstr(ls); |
| 15034 | size_t ll = ls->tsv.len; |
| 15035 | const char *r = getstr(rs); |
| 15036 | size_t lr = rs->tsv.len; |
| 15037 | for (;;) { |
| 15038 | int temp = strcoll(l, r); |
| 15039 | if (temp != 0) return temp; |
| 15040 | else { /* strings are equal up to a `\0' */ |
| 15041 | size_t len = strlen(l); /* index of first `\0' in both strings */ |
| 15042 | if (len == lr) /* r is finished? */ |
| 15043 | return (len == ll) ? 0 : 1; |
| 15044 | else if (len == ll) /* l is finished? */ |
| 15045 | return -1; /* l is smaller than r (because r is not finished) */ |
| 15046 | /* both strings longer than `len'; go on comparing (after the `\0') */ |
| 15047 | len++; |
| 15048 | l += len; ll -= len; r += len; lr -= len; |
| 15049 | } |
| 15050 | } |
| 15051 | } |
| 15052 | |
| 15053 | |
| 15054 | int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { |
no outgoing calls
no test coverage detected