core: assoc_string: Prepare for M2-Planet.

src/mes.c (assoc_string): Prepare for M2-Planet.
This commit is contained in:
Jan Nieuwenhuizen 2019-10-24 11:29:08 +02:00
parent 0d08d198a3
commit 2675807d12
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
1 changed files with 9 additions and 2 deletions

View File

@ -32,8 +32,15 @@
SCM
assoc_string (SCM x, SCM a) /*:((internal)) */
{
while (a != cell_nil && (TYPE (CAAR (a)) != TSTRING || string_equal_p (x, CAAR (a)) == cell_f))
a = CDR (a);
SCM b;
while (a != cell_nil)
{
b = CAR (a);
if (TYPE (CAR (b)) == TSTRING)
if (string_equal_p (x, CAR (b)) == cell_t)
return b;
a = CDR (a);
}
if (a != cell_nil)
return CAR (a);
return cell_f;