Introduce function coerce_to_simple_string() to ensure that C functions get a null-terminated string

This commit is contained in:
jjgarcia 2002-11-18 11:26:33 +00:00
parent b55a0130bc
commit da477db1ea
4 changed files with 21 additions and 8 deletions

View file

@ -116,6 +116,13 @@ copy_simple_string(cl_object x)
return(y);
}
cl_object
coerce_to_simple_string(cl_object x)
{
assert_type_string(x);
return x->string.adjustable? copy_simple_string(x) : x;
}
cl_object
cl_string(cl_object x)
{
@ -220,7 +227,7 @@ string_eq(cl_object x, cl_object y)
cl_index i, j;
i = x->string.fillp;
j = y->string.fillp;
return (i == j && strncmp(x->string.self, y->string.self, i) == 0);
return (i == j && memcmp(x->string.self, y->string.self, i) == 0);
}