1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Fix bug to make `string=' much faster

* libguile/srfi-13.c (scm_string_eq): Fix a bug which caused the slow
  general string_compare function to be used for strings of unequal
  lengths.
This commit is contained in:
Mark H Weaver 2011-03-10 17:35:19 -05:00
parent 514642d3c7
commit 06fc34c23f

View file

@ -1181,7 +1181,9 @@ SCM_DEFINE (scm_string_eq, "string=", 2, 4, 0,
len1 = scm_i_string_length (s1); len1 = scm_i_string_length (s1);
len2 = scm_i_string_length (s2); len2 = scm_i_string_length (s2);
if (SCM_LIKELY (len1 == len2)) if (len1 != len2)
return SCM_BOOL_F;
else
{ {
if (!scm_i_is_narrow_string (s1)) if (!scm_i_is_narrow_string (s1))
len1 *= 4; len1 *= 4;