Use `SCM_SNAME ()' when requesting the name of a subr.
[bpt/guile.git] / libguile / gsubr.c
index 4f8faef..fdb70ed 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2006, 2008, 2009 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 \f
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
 
 #include <stdio.h>
 #include "libguile/_scm.h"
@@ -24,6 +27,8 @@
 
 #include "libguile/gsubr.h"
 #include "libguile/deprecation.h"
+
+#include "libguile/private-options.h"
 \f
 /*
  * gsubr.c
@@ -70,13 +75,13 @@ create_gsubr (int define, const char *name,
       subr = scm_c_make_subr (name, scm_tc7_lsubr_2, fcn);
     create_subr:
       if (define)
-       scm_define (SCM_SUBR_ENTRY(subr).name, subr);
+       scm_define (SCM_SNAME (subr), subr);
       return subr;
     default:
       {
        SCM cclo = scm_makcclo (scm_f_gsubr_apply, 3L);
        SCM subr = scm_c_make_subr (name, scm_tc7_subr_0, fcn);
-       SCM sym = SCM_SUBR_ENTRY(subr).name;
+       SCM sym = SCM_SNAME (subr);
        if (SCM_GSUBR_MAX < req + opt + rst)
          {
             fprintf (stderr,
@@ -146,7 +151,7 @@ create_gsubr_with_generic (int define,
       subr = scm_c_make_subr_with_generic (name, scm_tc7_lsubr_2, fcn, gf);
     create_subr:
       if (define)
-       scm_define (SCM_SUBR_ENTRY(subr).name, subr);
+       scm_define (SCM_SNAME (subr), subr);
       return subr;
     default:
       ;
@@ -197,7 +202,7 @@ scm_gsubr_apply (SCM args)
 #endif
   args = SCM_CDR (args);
   for (i = 0; i < SCM_GSUBR_REQ (typ); i++) {
-    if (SCM_NULLP (args))
+    if (scm_is_null (args))
       scm_wrong_num_args (SCM_SNAME (SCM_GSUBR_PROC (self)));
     v[i] = SCM_CAR(args);
     args = SCM_CDR(args);
@@ -212,7 +217,7 @@ scm_gsubr_apply (SCM args)
   }
   if (SCM_GSUBR_REST(typ))
     v[i] = args;
-  else if (!SCM_NULLP (args))
+  else if (!scm_is_null (args))
     scm_wrong_num_args (SCM_SNAME (SCM_GSUBR_PROC (self)));
   switch (n) {
   case 2: return (*fcn)(v[0], v[1]);