diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2020-05-17 11:56:01 +0200 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2020-05-17 11:58:44 +0200 |
commit | c536c297683178e6eadc0a60d1e53f8c510db3c9 (patch) | |
tree | 30949a0eb314793e1728f86747b290c8fb4fff18 | |
parent | fb6ab6bc37b3d8ef4f0f1a156f8533aa7015b0b4 (diff) |
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.
-rw-r--r-- | libguile/loader.c | 21 |
1 files 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); |