* dynl.c, feature.c, filesys.c, fports.c, list.c, load.c,
authorGreg J. Badros <gjb@cs.washington.edu>
Tue, 11 Jan 2000 23:56:47 +0000 (23:56 +0000)
committerGreg J. Badros <gjb@cs.washington.edu>
Tue, 11 Jan 2000 23:56:47 +0000 (23:56 +0000)
net_db.c, sort.c, stacks.c, unif.c: Use SCM_WTA, SCM_MISC_ERROR
where possible.

* symbols.c (scm_sysintern0): Fixed the function name in a
scm_misc_error invocation.

* print.c (scm_simple_format): Do not need SCM_COERCE_SUBSTR, and
use scm_return_first to ward off latent GC bug that Mikael caught.

* async.c: Use SCM_VALIDATE_ASYNC_COPY one place where it wasn't
used before but should've been.

13 files changed:
libguile/async.c
libguile/dynl.c
libguile/feature.c
libguile/filesys.c
libguile/fports.c
libguile/list.c
libguile/load.c
libguile/net_db.c
libguile/print.c
libguile/sort.c
libguile/stacks.c
libguile/symbols.c
libguile/unif.c

index aa3bb9f..6e59aa6 100644 (file)
@@ -348,8 +348,7 @@ SCM_DEFINE (scm_run_asyncs, "run-asyncs", 1, 0, 0,
       struct scm_async * it;
       SCM_VALIDATE_CONS (1,list_of_a);
       a = SCM_CAR (list_of_a);
-      SCM_ASSERT (SCM_ASYNCP (a), a, SCM_ARG1, FUNC_NAME);
-      it = SCM_ASYNC (a);
+      SCM_VALIDATE_ASYNC_COPY (SCM_ARG1,a,it);
       scm_mask_ints = 1;
       if (it->got_it)
        {
@@ -371,9 +370,7 @@ SCM_DEFINE (scm_noop, "noop", 0, 0, 1,
 "")
 #define FUNC_NAME s_scm_noop
 {
-  return (SCM_NULLP (args)
-         ? SCM_BOOL_F
-         : SCM_CAR (args));
+  return (SCM_NULLP (args) ? SCM_BOOL_F : SCM_CAR (args));
 }
 #undef FUNC_NAME
 
index 102d9d6..d648d36 100644 (file)
@@ -378,7 +378,7 @@ as the @var{lib} argument to the following functions.")
        rest = SCM_CDR (rest);
        
        if (!SCM_CONSP (rest))
-         scm_misc_error (FUNC_NAME, "keyword without value", SCM_EOL);
+         SCM_MISC_ERROR ("keyword without value", SCM_EOL);
        
        val = SCM_CAR (rest);
        rest = SCM_CDR (rest);
@@ -389,7 +389,7 @@ as the @var{lib} argument to the following functions.")
              flags &= ~DYNL_GLOBAL;
          }
        else
-         scm_misc_error (FUNC_NAME, "unknown keyword argument: ~A",
+         SCM_MISC_ERROR ("unknown keyword argument: ~A",
                          scm_cons (kw, SCM_EOL));
       }
 
index c44abce..b1068aa 100644 (file)
@@ -280,8 +280,7 @@ SCM_DEFINE (scm_run_hook, "run-hook", 1, 0, 1,
   if (SCM_UNBNDP (args))
     args = SCM_EOL;
   if (scm_ilength (args) != SCM_HOOK_ARITY (hook))
-    scm_misc_error (FUNC_NAME,
-                   "Hook ~S requires ~A arguments",
+    SCM_MISC_ERROR ("Hook ~S requires ~A arguments",
                    SCM_LIST2 (hook,SCM_MAKINUM (SCM_HOOK_ARITY (hook))));
   scm_c_run_hook (hook, args);
   return SCM_UNSPECIFIED;
index eb93ee5..3ffbd76 100644 (file)
@@ -529,11 +529,10 @@ An integer representing the access permission bits.
     {
       int en = errno;
 
-      scm_syserror_msg (FUNC_NAME, "~A: ~S",
+      SCM_SYSERROR_MSG ("~A: ~S",
                        scm_listify (scm_makfrom0str (strerror (errno)),
                                     object,
-                                    SCM_UNDEFINED),
-                       en);
+                                    SCM_UNDEFINED), en);
     }
   return scm_stat2scm (&stat_temp);
 }
@@ -1179,11 +1178,10 @@ file it points to.  @var{path} must be a string.")
     {
       int en = errno;
 
-      scm_syserror_msg (FUNC_NAME, "~A: ~S",
+      SCM_SYSERROR_MSG ("~A: ~S",
                        scm_listify (scm_makfrom0str (strerror (errno)),
                                     str,
-                                    SCM_UNDEFINED),
-                       en);
+                                    SCM_UNDEFINED), en);
     }
   return scm_stat2scm(&stat_temp);
 }
index 8bf901d..5a3ec73 100644 (file)
@@ -354,10 +354,9 @@ If a file cannot be opened with the access requested,
     {
       int en = errno;
 
-      scm_syserror_msg (FUNC_NAME, "~A: ~S",
+      SCM_SYSERROR_MSG ("~A: ~S",
                        scm_cons (scm_makfrom0str (strerror (en)),
-                                 scm_cons (filename, SCM_EOL)),
-                       en);
+                                 scm_cons (filename, SCM_EOL)), en);
     }
   port = scm_fdes_to_port (fdes, mode, filename);
   return port;
index 531f169..c544352 100644 (file)
@@ -255,7 +255,7 @@ SCM_DEFINE (scm_last_pair, "last-pair", 1, 0, 0,
     tortoise = SCM_CDR(tortoise);
   }
   while (hare != tortoise);
-  scm_misc_error (FUNC_NAME, "Circular structure in position 1: ~S", SCM_LIST1 (lst));
+  SCM_MISC_ERROR ("Circular structure in position 1: ~S", SCM_LIST1 (lst));
 }
 #undef FUNC_NAME
 
@@ -283,7 +283,7 @@ SCM_DEFINE (scm_reverse, "reverse", 1, 0, 0,
       tortoise = SCM_CDR (tortoise);
     }
   while (hare != tortoise);
-  scm_misc_error (FUNC_NAME, "Circular structure in position 1: ~S", SCM_LIST1 (lst));
+  SCM_MISC_ERROR ("Circular structure in position 1: ~S", SCM_LIST1 (lst));
 }
 #undef FUNC_NAME
 
index daef405..316d1c9 100644 (file)
@@ -440,8 +440,7 @@ the list of search paths, an error is signalled.")
     {
       int absolute = (SCM_ROLENGTH (filename) >= 1
                      && SCM_ROCHARS (filename)[0] == '/');
-      scm_misc_error (FUNC_NAME,
-                     (absolute
+      SCM_MISC_ERROR ((absolute
                       ? "Unable to load file ~S"
                       : "Unable to find file ~S in load path"),
                      scm_listify (filename, SCM_UNDEFINED));
index a4114fa..f8aab85 100644 (file)
@@ -360,7 +360,7 @@ given.")
       entry = getnetbyaddr (netnum, AF_INET);
     }
   if (!entry)
-    scm_syserror_msg (FUNC_NAME, "no such network ~A",
+    SCM_SYSERROR_MSG ("no such network ~A",
                      scm_listify (name, SCM_UNDEFINED), errno);
   ve[0] = scm_makfromstr (entry->n_name, (scm_sizet) strlen (entry->n_name), 0);
   ve[1] = scm_makfromstrs (-1, entry->n_aliases);
index 4c3e874..94d1ba5 100644 (file)
@@ -967,7 +967,6 @@ Does not add a trailing newline.")
   SCM_VALIDATE_STRING(2,message);
   SCM_VALIDATE_LIST(3,args);
 
-  SCM_COERCE_SUBSTR (message);
   start = SCM_ROCHARS (message);
   for (p = start; *p != '\0'; ++p)
     if (*p == '~')
@@ -993,7 +992,7 @@ Does not add a trailing newline.")
   if (fReturnString)
     answer = scm_strport_to_string (destination);
 
-  return answer;
+  return scm_return_first(answer,message);
 }
 #undef FUNC_NAME
 
index da1f5bb..282a008 100644 (file)
@@ -229,7 +229,7 @@ quicksort (void *const pbase,
                  left_ptr += size;
                  /* The comparison predicate may be buggy */
                  if (left_ptr > hi)
-                   scm_misc_error (0, s_buggy_less, SCM_EOL);
+                   scm_misc_error (NULL, s_buggy_less, SCM_EOL);
                }
 
              while ((*cmp) (less, (void *) pivot, (void *) right_ptr))
@@ -237,7 +237,7 @@ quicksort (void *const pbase,
                  right_ptr -= size;
                  /* The comparison predicate may be buggy */
                  if (right_ptr < lo)
-                   scm_misc_error (0, s_buggy_less, SCM_EOL);
+                   scm_misc_error (NULL, s_buggy_less, SCM_EOL);
                }
 
              if (left_ptr < right_ptr)
@@ -321,7 +321,7 @@ quicksort (void *const pbase,
            tmp_ptr -= size;
            /* The comparison predicate may be buggy */
            if (tmp_ptr < base_ptr)
-             scm_misc_error (0, s_buggy_less, SCM_EOL);
+             scm_misc_error (NULL, s_buggy_less, SCM_EOL);
          }
 
        tmp_ptr += size;
index b5bd3cb..ce2e5f4 100644 (file)
@@ -454,7 +454,7 @@ SCM_DEFINE (scm_make_stack, "make-stack", 0, 0, 1,
        }
       else
        {
-         scm_wta (obj, (char *) SCM_ARG1, FUNC_NAME);
+         SCM_WTA (SCM_ARG1, obj);
          abort ();
        }
     }
index c60deee..f45b0ce 100644 (file)
@@ -395,7 +395,7 @@ scm_sysintern0 (const char *name)
       SCM sym = SCM_CAR (scm_intern0 (name));
       SCM vcell = scm_sym2vcell (sym, lookup_proc, SCM_BOOL_T);
       if (vcell == SCM_BOOL_F)
-         scm_misc_error ("sysintern", "can't define variable", sym);
+         scm_misc_error ("sysintern0", "can't define variable", sym);
       return vcell;
     }
   else
index 3789c72..85325d4 100644 (file)
@@ -1487,7 +1487,7 @@ loop:
   switch SCM_TYP7 (v)
     {
     default:
-    badarg1:scm_wta (v, (char *) SCM_ARG1, FUNC_NAME);
+    badarg1:SCM_WTA (SCM_ARG1,v);
     case scm_tc7_smob:
       SCM_ASRTGO (SCM_ARRAYP (v), badarg1);
       cra = scm_ra2contig (ra, 0);
@@ -1578,9 +1578,7 @@ loop:
                {
                  if (remaining % sz != 0)
                    {
-                     scm_misc_error (FUNC_NAME,
-                                     "unexpected EOF",
-                                     SCM_EOL);
+                     SCM_MISC_ERROR ("unexpected EOF", SCM_EOL);
                    }
                  ans -= remaining / sz;
                  break;