core: assoc_string: Prepare for M2-Planet.

src/mes.c (assoc_string): Prepare for M2-Planet.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2020-07-16 11:29:08 +02:00
parent 7cc2b1f2ec
commit 4297746e72
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;