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

loader: Handle interned constants as well as plain bytevectors.

This is a follow-up to commit b04e79283ada9a6af05552dda6446a0934c0fbe2.

* libguile/loader.c (scm_load_thunk_from_memory): Extract constants only
if the object is a pair.

(cherry picked from commit c536c297683178e6eadc0a60d1e53f8c510db3c9)
This commit is contained in:
Ricardo Wurmus 2020-05-17 11:56:01 +02:00 committed by Christine Lemmer-Webber
parent e38f6377e3
commit 726f34b35d
No known key found for this signature in database
GPG key ID: 4BC025925FF8F4D3

View file

@ -598,12 +598,21 @@ SCM_DEFINE (scm_load_thunk_from_memory, "load-thunk-from-memory", 1, 0, 0,
size_t len; size_t len;
SCM bv, constants; SCM bv, constants;
SCM_VALIDATE_CONS (1, obj); if (scm_is_pair (obj))
bv = scm_car (obj); {
constants = scm_cdr (obj); SCM_VALIDATE_CONS (1, obj);
SCM_ASSERT (scm_is_bytevector (bv) bv = scm_car (obj);
&& (scm_is_vector (constants) || scm_is_false (constants)), constants = scm_cdr (obj);
obj, 1, FUNC_NAME); SCM_ASSERT (scm_is_bytevector (bv)
&& (scm_is_vector (constants) || scm_is_false (constants)),
obj, 1, FUNC_NAME);
}
else
{
SCM_VALIDATE_BYTEVECTOR (1, obj);
bv = obj;
constants = SCM_BOOL_F;
}
data = (char *) SCM_BYTEVECTOR_CONTENTS (bv); data = (char *) SCM_BYTEVECTOR_CONTENTS (bv);
len = SCM_BYTEVECTOR_LENGTH (bv); len = SCM_BYTEVECTOR_LENGTH (bv);