From c536c297683178e6eadc0a60d1e53f8c510db3c9 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sun, 17 May 2020 11:56:01 +0200 Subject: 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. --- libguile/loader.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/libguile/loader.c b/libguile/loader.c index 1534ff897..22f168cab 100644 --- a/libguile/loader.c +++ b/libguile/loader.c @@ -587,12 +587,21 @@ SCM_DEFINE (scm_load_thunk_from_memory, "load-thunk-from-memory", 1, 0, 0, size_t len; SCM bv, constants; - SCM_VALIDATE_CONS (1, obj); - bv = scm_car (obj); - constants = scm_cdr (obj); - SCM_ASSERT (scm_is_bytevector (bv) - && (scm_is_vector (constants) || scm_is_false (constants)), - obj, 1, FUNC_NAME); + if (scm_is_pair (obj)) + { + SCM_VALIDATE_CONS (1, obj); + bv = scm_car (obj); + constants = scm_cdr (obj); + 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); len = SCM_BYTEVECTOR_LENGTH (bv); -- cgit v1.2.3