[svn:parrot] r49419 - in trunk: compilers/pirc/src src src/ops src/pmc src/string src/string/encoding
nwellnhof at svn.parrot.org
nwellnhof at svn.parrot.org
Sat Oct 2 22:27:21 UTC 2010
Author: nwellnhof
Date: Sat Oct 2 22:27:21 2010
New Revision: 49419
URL: https://trac.parrot.org/parrot/changeset/49419
Log:
[str] Switch to STRING_compare macro
Move the whole 'compare' logic into the string vtable functions
Modified:
trunk/compilers/pirc/src/bcgen.c
trunk/src/debug.c
trunk/src/ops/cmp.ops
trunk/src/ops/core_ops.c
trunk/src/pmc/scalar.pmc
trunk/src/pmc/string.pmc
trunk/src/string/api.c
trunk/src/string/encoding/shared.c
Modified: trunk/compilers/pirc/src/bcgen.c
==============================================================================
--- trunk/compilers/pirc/src/bcgen.c Sat Oct 2 22:26:47 2010 (r49418)
+++ trunk/compilers/pirc/src/bcgen.c Sat Oct 2 22:27:21 2010 (r49419)
@@ -1079,7 +1079,7 @@
cur_name = sub->name;
out_name = Parrot_str_new(interp, outername, len);
- if (Parrot_str_compare(interp, cur_name, out_name) == 0)
+ if (STRING_equal(interp, cur_name, out_name))
return current;
return NULL;
Modified: trunk/src/debug.c
==============================================================================
--- trunk/src/debug.c Sat Oct 2 22:26:47 2010 (r49418)
+++ trunk/src/debug.c Sat Oct 2 22:27:21 2010 (r49419)
@@ -1990,17 +1990,17 @@
n = REG_STR(interp, *(int *)condition->value);
if (((condition->type & PDB_cond_gt) &&
- (Parrot_str_compare(interp, m, n) > 0)) ||
+ (STRING_compare(interp, m, n) > 0)) ||
((condition->type & PDB_cond_ge) &&
- (Parrot_str_compare(interp, m, n) >= 0)) ||
+ (STRING_compare(interp, m, n) >= 0)) ||
((condition->type & PDB_cond_eq) &&
- (Parrot_str_compare(interp, m, n) == 0)) ||
+ (STRING_compare(interp, m, n) == 0)) ||
((condition->type & PDB_cond_ne) &&
- (Parrot_str_compare(interp, m, n) != 0)) ||
+ (STRING_compare(interp, m, n) != 0)) ||
((condition->type & PDB_cond_le) &&
- (Parrot_str_compare(interp, m, n) <= 0)) ||
+ (STRING_compare(interp, m, n) <= 0)) ||
((condition->type & PDB_cond_lt) &&
- (Parrot_str_compare(interp, m, n) < 0)))
+ (STRING_compare(interp, m, n) < 0)))
return 1;
return 0;
Modified: trunk/src/ops/cmp.ops
==============================================================================
--- trunk/src/ops/cmp.ops Sat Oct 2 22:26:47 2010 (r49418)
+++ trunk/src/ops/cmp.ops Sat Oct 2 22:27:21 2010 (r49419)
@@ -280,7 +280,7 @@
}
op lt(in STR, in STR, inconst LABEL) :base_core {
- if (Parrot_str_compare(interp, $1, $2) < 0) {
+ if (STRING_compare(interp, $1, $2) < 0) {
goto OFFSET($3);
}
}
@@ -310,7 +310,7 @@
}
op lt(invar PMC, in STR, inconst LABEL) :base_core {
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, $1), $2) < 0) {
+ if (STRING_compare(interp, VTABLE_get_string(interp, $1), $2) < 0) {
goto OFFSET($3);
}
}
@@ -364,7 +364,7 @@
}
op le(in STR, in STR, inconst LABEL) :base_core {
- if (Parrot_str_compare(interp, $1, $2) <= 0) {
+ if (STRING_compare(interp, $1, $2) <= 0) {
goto OFFSET($3);
}
}
@@ -394,7 +394,7 @@
}
op le(invar PMC, in STR, inconst LABEL) :base_core {
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, $1), $2) <= 0) {
+ if (STRING_compare(interp, VTABLE_get_string(interp, $1), $2) <= 0) {
goto OFFSET($3);
}
}
@@ -454,7 +454,7 @@
}
op gt(invar PMC, in STR, inconst LABEL) :base_core {
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, $1), $2) > 0) {
+ if (STRING_compare(interp, VTABLE_get_string(interp, $1), $2) > 0) {
goto OFFSET($3);
}
}
@@ -514,7 +514,7 @@
}
op ge(invar PMC, in STR, inconst LABEL) :base_core {
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, $1), $2) >= 0) {
+ if (STRING_compare(interp, VTABLE_get_string(interp, $1), $2) >= 0) {
goto OFFSET($3);
}
}
@@ -627,7 +627,7 @@
}
inline op cmp(out INT, in STR, in STR) :base_core {
- $1 = Parrot_str_compare(interp, $2, $3);
+ $1 = STRING_compare(interp, $2, $3);
}
inline op cmp(out INT, invar PMC, invar PMC) :base_core {
@@ -650,7 +650,7 @@
inline op cmp(out INT, invar PMC, in STR) :base_core {
STRING* const l = VTABLE_get_string(interp, $2);
- $1 = Parrot_str_compare(interp, l, $3);
+ $1 = STRING_compare(interp, l, $3);
}
inline op cmp_str(out INT, invar PMC, invar PMC) :base_core {
@@ -801,7 +801,7 @@
}
inline op isle(out INT, in STR, in STR) {
- $1 = Parrot_str_compare(interp, $2, $3) <= 0;
+ $1 = STRING_compare(interp, $2, $3) <= 0;
}
inline op isle(out INT, invar PMC, invar PMC) {
@@ -829,7 +829,7 @@
}
inline op islt(out INT, in STR, in STR) {
- $1 = Parrot_str_compare(interp, $2, $3) < 0;
+ $1 = STRING_compare(interp, $2, $3) < 0;
}
inline op islt(out INT, invar PMC, invar PMC) {
Modified: trunk/src/ops/core_ops.c
==============================================================================
--- trunk/src/ops/core_ops.c Sat Oct 2 22:26:47 2010 (r49418)
+++ trunk/src/ops/core_ops.c Sat Oct 2 22:27:21 2010 (r49419)
@@ -17152,7 +17152,7 @@
opcode_t *
Parrot_lt_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, SREG(1), SREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, SREG(1), SREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17160,7 +17160,7 @@
opcode_t *
Parrot_lt_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, SCONST(1), SREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, SCONST(1), SREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17168,7 +17168,7 @@
opcode_t *
Parrot_lt_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, SREG(1), SCONST(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, SREG(1), SCONST(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17228,7 +17228,7 @@
opcode_t *
Parrot_lt_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17236,7 +17236,7 @@
opcode_t *
Parrot_lt_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17308,7 +17308,7 @@
opcode_t *
Parrot_le_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, SREG(1), SREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, SREG(1), SREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17316,7 +17316,7 @@
opcode_t *
Parrot_le_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, SCONST(1), SREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, SCONST(1), SREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17324,7 +17324,7 @@
opcode_t *
Parrot_le_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, SREG(1), SCONST(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, SREG(1), SCONST(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17384,7 +17384,7 @@
opcode_t *
Parrot_le_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17392,7 +17392,7 @@
opcode_t *
Parrot_le_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17468,7 +17468,7 @@
opcode_t *
Parrot_gt_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) > 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) > 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17476,7 +17476,7 @@
opcode_t *
Parrot_gt_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) > 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) > 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17552,7 +17552,7 @@
opcode_t *
Parrot_ge_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) >= 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) >= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17560,7 +17560,7 @@
opcode_t *
Parrot_ge_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) >= 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) >= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17670,21 +17670,21 @@
opcode_t *
Parrot_cmp_i_s_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SREG(2), SREG(3));
+ IREG(1) = STRING_compare(interp, SREG(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_cmp_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SCONST(2), SREG(3));
+ IREG(1) = STRING_compare(interp, SCONST(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_cmp_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SREG(2), SCONST(3));
+ IREG(1) = STRING_compare(interp, SREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -17739,7 +17739,7 @@
Parrot_cmp_i_p_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
STRING* const l = VTABLE_get_string(interp, PREG(2));
- IREG(1) = Parrot_str_compare(interp, l, SREG(3));
+ IREG(1) = STRING_compare(interp, l, SREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -17747,7 +17747,7 @@
Parrot_cmp_i_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
STRING* const l = VTABLE_get_string(interp, PREG(2));
- IREG(1) = Parrot_str_compare(interp, l, SCONST(3));
+ IREG(1) = STRING_compare(interp, l, SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -17949,21 +17949,21 @@
opcode_t *
Parrot_isle_i_s_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SREG(2), SREG(3)) <= 0;
+ IREG(1) = STRING_compare(interp, SREG(2), SREG(3)) <= 0;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isle_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SCONST(2), SREG(3)) <= 0;
+ IREG(1) = STRING_compare(interp, SCONST(2), SREG(3)) <= 0;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isle_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SREG(2), SCONST(3)) <= 0;
+ IREG(1) = STRING_compare(interp, SREG(2), SCONST(3)) <= 0;
return (opcode_t *)cur_opcode + 4;}
@@ -18019,21 +18019,21 @@
opcode_t *
Parrot_islt_i_s_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SREG(2), SREG(3)) < 0;
+ IREG(1) = STRING_compare(interp, SREG(2), SREG(3)) < 0;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_islt_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SCONST(2), SREG(3)) < 0;
+ IREG(1) = STRING_compare(interp, SCONST(2), SREG(3)) < 0;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_islt_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SREG(2), SCONST(3)) < 0;
+ IREG(1) = STRING_compare(interp, SREG(2), SCONST(3)) < 0;
return (opcode_t *)cur_opcode + 4;}
Modified: trunk/src/pmc/scalar.pmc
==============================================================================
--- trunk/src/pmc/scalar.pmc Sat Oct 2 22:26:47 2010 (r49418)
+++ trunk/src/pmc/scalar.pmc Sat Oct 2 22:27:21 2010 (r49419)
@@ -753,7 +753,7 @@
*/
MULTI INTVAL cmp_string(PMC *value) {
- return Parrot_str_compare(INTERP, SELF.get_string(),
+ return STRING_compare(INTERP, SELF.get_string(),
VTABLE_get_string(INTERP, value));
}
Modified: trunk/src/pmc/string.pmc
==============================================================================
--- trunk/src/pmc/string.pmc Sat Oct 2 22:26:47 2010 (r49418)
+++ trunk/src/pmc/string.pmc Sat Oct 2 22:27:21 2010 (r49419)
@@ -304,7 +304,7 @@
STRING *str_val;
STRING * const v = VTABLE_get_string(INTERP, value);
GET_ATTR_str_val(INTERP, SELF, str_val);
- return Parrot_str_compare(INTERP, str_val, v);
+ return STRING_compare(INTERP, str_val, v);
}
/*
@@ -349,7 +349,7 @@
STRING *str_val;
STRING * const v = VTABLE_get_string(INTERP, value);
GET_ATTR_str_val(INTERP, SELF, str_val);
- return Parrot_str_compare(INTERP, str_val, v);
+ return STRING_compare(INTERP, str_val, v);
}
/*
Modified: trunk/src/string/api.c
==============================================================================
--- trunk/src/string/api.c Sat Oct 2 22:26:47 2010 (r49418)
+++ trunk/src/string/api.c Sat Oct 2 22:27:21 2010 (r49419)
@@ -1248,7 +1248,9 @@
Compares two strings to each other. If s1 is less than s2, returns -1. If the
strings are equal, returns 0. If s1 is greater than s2, returns 2. This
comparison uses the character set collation order of the strings for
-comparison.
+comparison. The null string is considered equal to the empty string.
+
+Identical to the STRING_compare macro.
=cut
@@ -1260,17 +1262,9 @@
Parrot_str_compare(PARROT_INTERP, ARGIN_NULLOK(const STRING *s1), ARGIN_NULLOK(const STRING *s2))
{
ASSERT_ARGS(Parrot_str_compare)
- UINTVAL len1 = STRING_length(s1);
- UINTVAL len2 = STRING_length(s2);
-
- if (len2 == 0)
- return len1 != 0;
-
- if (len1 == 0)
- return -1;
- ASSERT_STRING_SANITY(s1);
- ASSERT_STRING_SANITY(s2);
+ if (s1 == NULL)
+ s1 = STRINGNULL;
return STRING_compare(interp, s1, s2);
}
Modified: trunk/src/string/encoding/shared.c
==============================================================================
--- trunk/src/string/encoding/shared.c Sat Oct 2 22:26:47 2010 (r49418)
+++ trunk/src/string/encoding/shared.c Sat Oct 2 22:27:21 2010 (r49419)
@@ -113,14 +113,18 @@
{
ASSERT_ARGS(encoding_compare)
String_iter l_iter, r_iter;
- UINTVAL min_len, l_len, r_len;
+ const UINTVAL l_len = STRING_length(lhs);
+ const UINTVAL r_len = STRING_length(rhs);
+ UINTVAL min_len;
+
+ if (r_len == 0)
+ return l_len != 0;
+ if (l_len == 0)
+ return -1;
STRING_ITER_INIT(interp, &l_iter);
STRING_ITER_INIT(interp, &r_iter);
- l_len = lhs->strlen;
- r_len = rhs->strlen;
-
min_len = l_len > r_len ? r_len : l_len;
while (l_iter.charpos < min_len) {
@@ -679,9 +683,16 @@
fixed8_compare(PARROT_INTERP, ARGIN(const STRING *lhs), ARGIN(const STRING *rhs))
{
ASSERT_ARGS(fixed8_compare)
- const UINTVAL l_len = lhs->strlen;
- const UINTVAL r_len = rhs->strlen;
- const UINTVAL min_len = l_len > r_len ? r_len : l_len;
+ const UINTVAL l_len = STRING_length(lhs);
+ const UINTVAL r_len = STRING_length(rhs);
+ UINTVAL min_len;
+
+ if (r_len == 0)
+ return l_len != 0;
+ if (l_len == 0)
+ return -1;
+
+ min_len = l_len > r_len ? r_len : l_len;
if (STRING_max_bytes_per_codepoint(rhs) == 1) {
const int ret_val = memcmp(lhs->strstart, rhs->strstart, min_len);
More information about the parrot-commits
mailing list