mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
* dynl.c, feature.c, filesys.c, fports.c, list.c, load.c,
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.
This commit is contained in:
parent
88423ab1ab
commit
5d2d2ffca7
13 changed files with 23 additions and 34 deletions
|
@ -348,8 +348,7 @@ SCM_DEFINE (scm_run_asyncs, "run-asyncs", 1, 0, 0,
|
||||||
struct scm_async * it;
|
struct scm_async * it;
|
||||||
SCM_VALIDATE_CONS (1,list_of_a);
|
SCM_VALIDATE_CONS (1,list_of_a);
|
||||||
a = SCM_CAR (list_of_a);
|
a = SCM_CAR (list_of_a);
|
||||||
SCM_ASSERT (SCM_ASYNCP (a), a, SCM_ARG1, FUNC_NAME);
|
SCM_VALIDATE_ASYNC_COPY (SCM_ARG1,a,it);
|
||||||
it = SCM_ASYNC (a);
|
|
||||||
scm_mask_ints = 1;
|
scm_mask_ints = 1;
|
||||||
if (it->got_it)
|
if (it->got_it)
|
||||||
{
|
{
|
||||||
|
@ -371,9 +370,7 @@ SCM_DEFINE (scm_noop, "noop", 0, 0, 1,
|
||||||
"")
|
"")
|
||||||
#define FUNC_NAME s_scm_noop
|
#define FUNC_NAME s_scm_noop
|
||||||
{
|
{
|
||||||
return (SCM_NULLP (args)
|
return (SCM_NULLP (args) ? SCM_BOOL_F : SCM_CAR (args));
|
||||||
? SCM_BOOL_F
|
|
||||||
: SCM_CAR (args));
|
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
|
|
@ -378,7 +378,7 @@ as the @var{lib} argument to the following functions.")
|
||||||
rest = SCM_CDR (rest);
|
rest = SCM_CDR (rest);
|
||||||
|
|
||||||
if (!SCM_CONSP (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);
|
val = SCM_CAR (rest);
|
||||||
rest = SCM_CDR (rest);
|
rest = SCM_CDR (rest);
|
||||||
|
@ -389,7 +389,7 @@ as the @var{lib} argument to the following functions.")
|
||||||
flags &= ~DYNL_GLOBAL;
|
flags &= ~DYNL_GLOBAL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
scm_misc_error (FUNC_NAME, "unknown keyword argument: ~A",
|
SCM_MISC_ERROR ("unknown keyword argument: ~A",
|
||||||
scm_cons (kw, SCM_EOL));
|
scm_cons (kw, SCM_EOL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,8 +280,7 @@ SCM_DEFINE (scm_run_hook, "run-hook", 1, 0, 1,
|
||||||
if (SCM_UNBNDP (args))
|
if (SCM_UNBNDP (args))
|
||||||
args = SCM_EOL;
|
args = SCM_EOL;
|
||||||
if (scm_ilength (args) != SCM_HOOK_ARITY (hook))
|
if (scm_ilength (args) != SCM_HOOK_ARITY (hook))
|
||||||
scm_misc_error (FUNC_NAME,
|
SCM_MISC_ERROR ("Hook ~S requires ~A arguments",
|
||||||
"Hook ~S requires ~A arguments",
|
|
||||||
SCM_LIST2 (hook,SCM_MAKINUM (SCM_HOOK_ARITY (hook))));
|
SCM_LIST2 (hook,SCM_MAKINUM (SCM_HOOK_ARITY (hook))));
|
||||||
scm_c_run_hook (hook, args);
|
scm_c_run_hook (hook, args);
|
||||||
return SCM_UNSPECIFIED;
|
return SCM_UNSPECIFIED;
|
||||||
|
|
|
@ -529,11 +529,10 @@ An integer representing the access permission bits.
|
||||||
{
|
{
|
||||||
int en = errno;
|
int en = errno;
|
||||||
|
|
||||||
scm_syserror_msg (FUNC_NAME, "~A: ~S",
|
SCM_SYSERROR_MSG ("~A: ~S",
|
||||||
scm_listify (scm_makfrom0str (strerror (errno)),
|
scm_listify (scm_makfrom0str (strerror (errno)),
|
||||||
object,
|
object,
|
||||||
SCM_UNDEFINED),
|
SCM_UNDEFINED), en);
|
||||||
en);
|
|
||||||
}
|
}
|
||||||
return scm_stat2scm (&stat_temp);
|
return scm_stat2scm (&stat_temp);
|
||||||
}
|
}
|
||||||
|
@ -1179,11 +1178,10 @@ file it points to. @var{path} must be a string.")
|
||||||
{
|
{
|
||||||
int en = errno;
|
int en = errno;
|
||||||
|
|
||||||
scm_syserror_msg (FUNC_NAME, "~A: ~S",
|
SCM_SYSERROR_MSG ("~A: ~S",
|
||||||
scm_listify (scm_makfrom0str (strerror (errno)),
|
scm_listify (scm_makfrom0str (strerror (errno)),
|
||||||
str,
|
str,
|
||||||
SCM_UNDEFINED),
|
SCM_UNDEFINED), en);
|
||||||
en);
|
|
||||||
}
|
}
|
||||||
return scm_stat2scm(&stat_temp);
|
return scm_stat2scm(&stat_temp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,10 +354,9 @@ If a file cannot be opened with the access requested,
|
||||||
{
|
{
|
||||||
int en = errno;
|
int en = errno;
|
||||||
|
|
||||||
scm_syserror_msg (FUNC_NAME, "~A: ~S",
|
SCM_SYSERROR_MSG ("~A: ~S",
|
||||||
scm_cons (scm_makfrom0str (strerror (en)),
|
scm_cons (scm_makfrom0str (strerror (en)),
|
||||||
scm_cons (filename, SCM_EOL)),
|
scm_cons (filename, SCM_EOL)), en);
|
||||||
en);
|
|
||||||
}
|
}
|
||||||
port = scm_fdes_to_port (fdes, mode, filename);
|
port = scm_fdes_to_port (fdes, mode, filename);
|
||||||
return port;
|
return port;
|
||||||
|
|
|
@ -255,7 +255,7 @@ SCM_DEFINE (scm_last_pair, "last-pair", 1, 0, 0,
|
||||||
tortoise = SCM_CDR(tortoise);
|
tortoise = SCM_CDR(tortoise);
|
||||||
}
|
}
|
||||||
while (hare != 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
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ SCM_DEFINE (scm_reverse, "reverse", 1, 0, 0,
|
||||||
tortoise = SCM_CDR (tortoise);
|
tortoise = SCM_CDR (tortoise);
|
||||||
}
|
}
|
||||||
while (hare != 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
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
|
|
@ -440,8 +440,7 @@ the list of search paths, an error is signalled.")
|
||||||
{
|
{
|
||||||
int absolute = (SCM_ROLENGTH (filename) >= 1
|
int absolute = (SCM_ROLENGTH (filename) >= 1
|
||||||
&& SCM_ROCHARS (filename)[0] == '/');
|
&& SCM_ROCHARS (filename)[0] == '/');
|
||||||
scm_misc_error (FUNC_NAME,
|
SCM_MISC_ERROR ((absolute
|
||||||
(absolute
|
|
||||||
? "Unable to load file ~S"
|
? "Unable to load file ~S"
|
||||||
: "Unable to find file ~S in load path"),
|
: "Unable to find file ~S in load path"),
|
||||||
scm_listify (filename, SCM_UNDEFINED));
|
scm_listify (filename, SCM_UNDEFINED));
|
||||||
|
|
|
@ -360,7 +360,7 @@ given.")
|
||||||
entry = getnetbyaddr (netnum, AF_INET);
|
entry = getnetbyaddr (netnum, AF_INET);
|
||||||
}
|
}
|
||||||
if (!entry)
|
if (!entry)
|
||||||
scm_syserror_msg (FUNC_NAME, "no such network ~A",
|
SCM_SYSERROR_MSG ("no such network ~A",
|
||||||
scm_listify (name, SCM_UNDEFINED), errno);
|
scm_listify (name, SCM_UNDEFINED), errno);
|
||||||
ve[0] = scm_makfromstr (entry->n_name, (scm_sizet) strlen (entry->n_name), 0);
|
ve[0] = scm_makfromstr (entry->n_name, (scm_sizet) strlen (entry->n_name), 0);
|
||||||
ve[1] = scm_makfromstrs (-1, entry->n_aliases);
|
ve[1] = scm_makfromstrs (-1, entry->n_aliases);
|
||||||
|
|
|
@ -967,7 +967,6 @@ Does not add a trailing newline.")
|
||||||
SCM_VALIDATE_STRING(2,message);
|
SCM_VALIDATE_STRING(2,message);
|
||||||
SCM_VALIDATE_LIST(3,args);
|
SCM_VALIDATE_LIST(3,args);
|
||||||
|
|
||||||
SCM_COERCE_SUBSTR (message);
|
|
||||||
start = SCM_ROCHARS (message);
|
start = SCM_ROCHARS (message);
|
||||||
for (p = start; *p != '\0'; ++p)
|
for (p = start; *p != '\0'; ++p)
|
||||||
if (*p == '~')
|
if (*p == '~')
|
||||||
|
@ -993,7 +992,7 @@ Does not add a trailing newline.")
|
||||||
if (fReturnString)
|
if (fReturnString)
|
||||||
answer = scm_strport_to_string (destination);
|
answer = scm_strport_to_string (destination);
|
||||||
|
|
||||||
return answer;
|
return scm_return_first(answer,message);
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,7 @@ quicksort (void *const pbase,
|
||||||
left_ptr += size;
|
left_ptr += size;
|
||||||
/* The comparison predicate may be buggy */
|
/* The comparison predicate may be buggy */
|
||||||
if (left_ptr > hi)
|
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))
|
while ((*cmp) (less, (void *) pivot, (void *) right_ptr))
|
||||||
|
@ -237,7 +237,7 @@ quicksort (void *const pbase,
|
||||||
right_ptr -= size;
|
right_ptr -= size;
|
||||||
/* The comparison predicate may be buggy */
|
/* The comparison predicate may be buggy */
|
||||||
if (right_ptr < lo)
|
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)
|
if (left_ptr < right_ptr)
|
||||||
|
@ -321,7 +321,7 @@ quicksort (void *const pbase,
|
||||||
tmp_ptr -= size;
|
tmp_ptr -= size;
|
||||||
/* The comparison predicate may be buggy */
|
/* The comparison predicate may be buggy */
|
||||||
if (tmp_ptr < base_ptr)
|
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;
|
tmp_ptr += size;
|
||||||
|
|
|
@ -454,7 +454,7 @@ SCM_DEFINE (scm_make_stack, "make-stack", 0, 0, 1,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scm_wta (obj, (char *) SCM_ARG1, FUNC_NAME);
|
SCM_WTA (SCM_ARG1, obj);
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,7 +395,7 @@ scm_sysintern0 (const char *name)
|
||||||
SCM sym = SCM_CAR (scm_intern0 (name));
|
SCM sym = SCM_CAR (scm_intern0 (name));
|
||||||
SCM vcell = scm_sym2vcell (sym, lookup_proc, SCM_BOOL_T);
|
SCM vcell = scm_sym2vcell (sym, lookup_proc, SCM_BOOL_T);
|
||||||
if (vcell == SCM_BOOL_F)
|
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;
|
return vcell;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1487,7 +1487,7 @@ loop:
|
||||||
switch SCM_TYP7 (v)
|
switch SCM_TYP7 (v)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
badarg1:scm_wta (v, (char *) SCM_ARG1, FUNC_NAME);
|
badarg1:SCM_WTA (SCM_ARG1,v);
|
||||||
case scm_tc7_smob:
|
case scm_tc7_smob:
|
||||||
SCM_ASRTGO (SCM_ARRAYP (v), badarg1);
|
SCM_ASRTGO (SCM_ARRAYP (v), badarg1);
|
||||||
cra = scm_ra2contig (ra, 0);
|
cra = scm_ra2contig (ra, 0);
|
||||||
|
@ -1578,9 +1578,7 @@ loop:
|
||||||
{
|
{
|
||||||
if (remaining % sz != 0)
|
if (remaining % sz != 0)
|
||||||
{
|
{
|
||||||
scm_misc_error (FUNC_NAME,
|
SCM_MISC_ERROR ("unexpected EOF", SCM_EOL);
|
||||||
"unexpected EOF",
|
|
||||||
SCM_EOL);
|
|
||||||
}
|
}
|
||||||
ans -= remaining / sz;
|
ans -= remaining / sz;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue