guile-cvs
[Top][All Lists]
Advanced

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

guile/guile-core/libguile modules.c


From: Marius Vollmer
Subject: guile/guile-core/libguile modules.c
Date: Tue, 20 Nov 2001 17:45:24 -0500

CVSROOT:        /cvs
Module name:    guile
Changes by:     Marius Vollmer <address@hidden> 01/11/20 17:45:24

Modified files:
        guile-core/libguile: modules.c 

Log message:
        (scm_c_export): Do nothing when the first argument is
        already the terminating NULL.  Thanks to Han-Wen Nienhuys!

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/modules.c.diff?cvsroot=OldCVS&tr1=1.37&tr2=1.38&r1=text&r2=text

Patches:
Index: guile/guile-core/libguile/modules.c
diff -u guile/guile-core/libguile/modules.c:1.37 
guile/guile-core/libguile/modules.c:1.38
--- guile/guile-core/libguile/modules.c:1.37    Tue Nov 13 17:15:42 2001
+++ guile/guile-core/libguile/modules.c Tue Nov 20 17:45:24 2001
@@ -176,24 +176,41 @@
 
 static SCM module_export_x_var;
 
+
+
+/*
+  @code{scm_c_export}(@var{name-list})
+
+  @code{scm_c_export} exports the named bindings from the current
+  module, making them visible to users of the module. This function
+  takes a list of string arguments, terminated by NULL, e.g.
+
+  @example
+    scm_c_export ("add-double-record", "bamboozle-money", NULL);
+  @end example
+*/
+
 void
 scm_c_export (const char *name, ...)
 {
-  va_list ap;
-  SCM names = scm_cons (scm_str2symbol (name), SCM_EOL);
-  SCM *tail = SCM_CDRLOC (names);
-  va_start (ap, name);
-  while (1)
+  if (name)
     {
-      const char *n = va_arg (ap, const char *);
-      if (n == NULL)
-       break;
-      *tail = scm_cons (scm_str2symbol (n), SCM_EOL);
-      tail = SCM_CDRLOC (*tail);
+      va_list ap;
+      SCM names = scm_cons (scm_str2symbol (name), SCM_EOL);
+      SCM *tail = SCM_CDRLOC (names);
+      va_start (ap, name);
+      while (1)
+       {
+         const char *n = va_arg (ap, const char *);
+         if (n == NULL)
+           break;
+         *tail = scm_cons (scm_str2symbol (n), SCM_EOL);
+         tail = SCM_CDRLOC (*tail);
+       }
+      va_end (ap);
+      scm_call_2 (SCM_VARIABLE_REF (module_export_x_var),
+                 scm_current_module (), names);
     }
-  va_end (ap);
-  scm_call_2 (SCM_VARIABLE_REF (module_export_x_var),
-             scm_current_module (), names);
 }
 
 /* Environments */



reply via email to

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