MCPcopy Create free account
hub / github.com/F-Stack/f-stack / l_strcmp

Function l_strcmp

freebsd/contrib/openzfs/module/lua/lvm.c:210–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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