diff options
author | Marius Vollmer <mvo@zagadka.de> | 2004-08-12 17:06:37 +0000 |
---|---|---|
committer | Marius Vollmer <mvo@zagadka.de> | 2004-08-12 17:06:37 +0000 |
commit | 4695c759477615b3e103a0c0ed4539e158838142 (patch) | |
tree | ac7fac1b603b89cf865173332a3563737fcd9174 /libguile/extensions.c | |
parent | d617ee1895503e4b85da9fa72fcafb7a3b79951d (diff) |
(load_extension): Convert lib and init to locale
strings instead of accessing the internals directly.
(scm_c_load_extension): Use scm_from_locale_string instead of
scm_makfrom0str.
Diffstat (limited to 'libguile/extensions.c')
-rw-r--r-- | libguile/extensions.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/libguile/extensions.c b/libguile/extensions.c index 61948a84c..f6e1e1b9e 100644 --- a/libguile/extensions.c +++ b/libguile/extensions.c @@ -27,6 +27,7 @@ #include "libguile/strings.h" #include "libguile/gc.h" #include "libguile/dynl.h" +#include "libguile/dynwind.h" #include "libguile/extensions.h" @@ -71,17 +72,28 @@ static void load_extension (SCM lib, SCM init) { /* Search the registry. */ - { - extension_t *ext; - - for (ext = registered_extensions; ext; ext = ext->next) - if ((ext->lib == NULL || !strcmp (ext->lib, SCM_STRING_CHARS (lib))) - && !strcmp (ext->init, SCM_STRING_CHARS (init))) - { - ext->func (ext->data); - return; - } - } + if (registered_extensions != NULL) + { + extension_t *ext; + char *clib, *cinit; + + scm_frame_begin (0); + + clib = scm_to_locale_string (lib); + scm_frame_free (clib); + cinit = scm_to_locale_string (init); + scm_frame_free (cinit); + + for (ext = registered_extensions; ext; ext = ext->next) + if ((ext->lib == NULL || !strcmp (ext->lib, clib)) + && !strcmp (ext->init, cinit)) + { + ext->func (ext->data); + break; + } + + scm_frame_end (); + } /* Dynamically link the library. */ scm_dynamic_call (init, scm_dynamic_link (lib)); @@ -90,7 +102,7 @@ load_extension (SCM lib, SCM init) void scm_c_load_extension (const char *lib, const char *init) { - load_extension (scm_makfrom0str (lib), scm_makfrom0str (init)); + load_extension (scm_from_locale_string (lib), scm_from_locale_string (init)); } SCM_DEFINE (scm_load_extension, "load-extension", 2, 0, 0, @@ -131,8 +143,6 @@ SCM_DEFINE (scm_load_extension, "load-extension", 2, 0, 0, "@end lisp") #define FUNC_NAME s_scm_load_extension { - SCM_VALIDATE_STRING (1, lib); - SCM_VALIDATE_STRING (2, init); load_extension (lib, init); return SCM_UNSPECIFIED; } |