MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / l_strcmp

Function l_strcmp

third-party/lua-5.2.4/src/lvm.c:209–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

luaV_lessthanFunction · 0.70
luaV_lessequalFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected