guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 35/36: loader: Handle interned constants as well as plai


From: Christopher Allan Webber
Subject: [Guile-commits] 35/36: loader: Handle interned constants as well as plain bytevectors.
Date: Tue, 19 Oct 2021 17:59:43 -0400 (EDT)

cwebber pushed a commit to branch wip-elisp-rebased
in repository guile.

commit 6da22a434f520295f0b8156f75c5b2f29b5564d9
Author: Ricardo Wurmus <rekado@elephly.net>
AuthorDate: Sun May 17 11:56:01 2020 +0200

    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)
---
 libguile/loader.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/libguile/loader.c b/libguile/loader.c
index cf34bfc..f9c9e45 100644
--- a/libguile/loader.c
+++ b/libguile/loader.c
@@ -598,12 +598,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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]