1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 16:50:21 +02:00

scm_is_false instead of == SCM_BOOL_F; also is_null, is_true, etc

* libguile/deprecation.c (scm_issue_deprecation_warning)
* libguile/eval.c (CAPTURE_ENV):
* libguile/goops.c (make_dispatch_procedure, make_class_from_symbol):
  (create_smob_classes):
* libguile/guardians.c (finalize_guarded, scm_i_get_one_zombie):
* libguile/hashtab.c (scm_fixup_weak_alist, scm_internal_hash_fold):
* libguile/i18n.c (scm_nl_langinfo)
* libguile/load.c (scm_primitive_load)
* libguile/posix.c (scm_setrlimit)
* libguile/socket.c (scm_to_sockaddr):
* libguile/srcprop.c (scm_make_srcprops): Use scm_is_false / scm_is_true
  / scm_is_null instead of comparing against SCM_BOOL_F et al.
This commit is contained in:
Andy Wingo 2011-05-13 13:04:49 +02:00
parent b2b33168b1
commit 393baa8a44
10 changed files with 22 additions and 22 deletions

View file

@ -128,7 +128,7 @@ SCM_DEFINE(scm_issue_deprecation_warning,
char *c_msgs; char *c_msgs;
while (scm_is_pair (msgs)) while (scm_is_pair (msgs))
{ {
if (msgs_nl != SCM_EOL) if (!scm_is_null (msgs_nl))
msgs_nl = scm_cons (nl, msgs_nl); msgs_nl = scm_cons (nl, msgs_nl);
msgs_nl = scm_cons (SCM_CAR (msgs), msgs_nl); msgs_nl = scm_cons (SCM_CAR (msgs), msgs_nl);
msgs = SCM_CDR (msgs); msgs = SCM_CDR (msgs);

View file

@ -211,8 +211,8 @@ truncate_values (SCM x)
case, because further lexical contours should capture the current module. case, because further lexical contours should capture the current module.
*/ */
#define CAPTURE_ENV(env) \ #define CAPTURE_ENV(env) \
((env == SCM_EOL) ? scm_current_module () : \ (scm_is_null (env) ? scm_current_module () : \
((env == SCM_BOOL_F) ? scm_the_root_module () : env)) (scm_is_false (env) ? scm_the_root_module () : env))
static SCM static SCM
eval (SCM x, SCM env) eval (SCM x, SCM env)

View file

@ -1702,7 +1702,7 @@ static SCM
make_dispatch_procedure (SCM gf) make_dispatch_procedure (SCM gf)
{ {
static SCM var = SCM_BOOL_F; static SCM var = SCM_BOOL_F;
if (var == SCM_BOOL_F) if (scm_is_false (var))
var = scm_module_variable (scm_c_resolve_module ("oop goops dispatch"), var = scm_module_variable (scm_c_resolve_module ("oop goops dispatch"),
sym_delayed_compile); sym_delayed_compile);
return scm_call_1 (SCM_VARIABLE_REF (var), gf); return scm_call_1 (SCM_VARIABLE_REF (var), gf);
@ -2519,7 +2519,7 @@ static SCM
make_class_from_symbol (SCM type_name_sym, SCM supers, int applicablep) make_class_from_symbol (SCM type_name_sym, SCM supers, int applicablep)
{ {
SCM class, name; SCM class, name;
if (type_name_sym != SCM_BOOL_F) if (scm_is_true (type_name_sym))
{ {
name = scm_string_append (scm_list_3 (scm_from_locale_string ("<"), name = scm_string_append (scm_list_3 (scm_from_locale_string ("<"),
scm_symbol_to_string (type_name_sym), scm_symbol_to_string (type_name_sym),
@ -2601,12 +2601,12 @@ create_smob_classes (void)
long i; long i;
for (i = 0; i < SCM_I_MAX_SMOB_TYPE_COUNT; ++i) for (i = 0; i < SCM_I_MAX_SMOB_TYPE_COUNT; ++i)
scm_smob_class[i] = 0; scm_smob_class[i] = SCM_BOOL_F;
scm_smob_class[SCM_TC2SMOBNUM (scm_tc16_keyword)] = scm_class_keyword; scm_smob_class[SCM_TC2SMOBNUM (scm_tc16_keyword)] = scm_class_keyword;
for (i = 0; i < scm_numsmob; ++i) for (i = 0; i < scm_numsmob; ++i)
if (!scm_smob_class[i]) if (scm_is_false (scm_smob_class[i]))
scm_smob_class[i] = scm_make_extended_class (SCM_SMOBNAME (i), scm_smob_class[i] = scm_make_extended_class (SCM_SMOBNAME (i),
scm_smobs[i].apply != 0); scm_smobs[i].apply != 0);
} }

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1998,1999,2000,2001, 2006, 2008, 2009 Free Software Foundation, Inc. /* Copyright (C) 1998,1999,2000,2001, 2006, 2008, 2009, 2011 Free Software Foundation, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -127,7 +127,7 @@ finalize_guarded (GC_PTR ptr, GC_PTR finalizer_data)
/* Tell each guardian interested in OBJ that OBJ is no longer /* Tell each guardian interested in OBJ that OBJ is no longer
reachable. */ reachable. */
for (; for (;
guardian_list != SCM_EOL; !scm_is_null (guardian_list);
guardian_list = SCM_CDR (guardian_list)) guardian_list = SCM_CDR (guardian_list))
{ {
SCM zombies; SCM zombies;
@ -159,7 +159,7 @@ finalize_guarded (GC_PTR ptr, GC_PTR finalizer_data)
g->zombies = zombies; g->zombies = zombies;
} }
if (proxied_finalizer != SCM_BOOL_F) if (scm_is_true (proxied_finalizer))
{ {
/* Re-register the finalizer that was in place before we installed this /* Re-register the finalizer that was in place before we installed this
one. */ one. */
@ -257,7 +257,7 @@ scm_i_get_one_zombie (SCM guardian)
t_guardian *g = GUARDIAN_DATA (guardian); t_guardian *g = GUARDIAN_DATA (guardian);
SCM res = SCM_BOOL_F; SCM res = SCM_BOOL_F;
if (g->zombies != SCM_EOL) if (!scm_is_null (g->zombies))
{ {
/* Note: We return zombies in reverse order. */ /* Note: We return zombies in reverse order. */
res = SCM_CAR (g->zombies); res = SCM_CAR (g->zombies);

View file

@ -105,7 +105,7 @@ scm_fixup_weak_alist (SCM alist, size_t *removed_items)
{ {
/* Remove from ALIST weak pair PAIR whose car/cdr has been /* Remove from ALIST weak pair PAIR whose car/cdr has been
nullified by the GC. */ nullified by the GC. */
if (prev == SCM_EOL) if (scm_is_null (prev))
result = SCM_CDR (alist); result = SCM_CDR (alist);
else else
SCM_SETCDR (prev, SCM_CDR (alist)); SCM_SETCDR (prev, SCM_CDR (alist));
@ -1396,7 +1396,7 @@ scm_internal_hash_fold (scm_t_hash_fold_fn fn, void *closure,
{ {
/* We hit a weak pair whose car/cdr has become /* We hit a weak pair whose car/cdr has become
unreachable: unlink it from the bucket. */ unreachable: unlink it from the bucket. */
if (prev != SCM_BOOL_F) if (scm_is_true (prev))
SCM_SETCDR (prev, SCM_CDR (ls)); SCM_SETCDR (prev, SCM_CDR (ls));
else else
SCM_SIMPLE_VECTOR_SET (buckets, i, SCM_CDR (ls)); SCM_SIMPLE_VECTOR_SET (buckets, i, SCM_CDR (ls));

View file

@ -1591,7 +1591,7 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,
if (*p == 0) if (*p == 0)
{ {
/* Cyclic grouping information. */ /* Cyclic grouping information. */
if (last_pair != SCM_EOL) if (!scm_is_null (last_pair))
SCM_SETCDR (last_pair, result); SCM_SETCDR (last_pair, result);
} }
} }

View file

@ -116,7 +116,7 @@ SCM_DEFINE (scm_primitive_load, "primitive-load", 1, 0, 0,
/* Lookup and use the current reader to read the next /* Lookup and use the current reader to read the next
expression. */ expression. */
reader = scm_fluid_ref (the_reader); reader = scm_fluid_ref (the_reader);
if (reader == SCM_BOOL_F) if (scm_is_false (reader))
form = scm_read (port); form = scm_read (port);
else else
form = scm_call_1 (reader, port); form = scm_call_1 (reader, port);

View file

@ -615,8 +615,8 @@ SCM_DEFINE (scm_setrlimit, "setrlimit", 3, 0, 0,
iresource = scm_to_resource (resource, FUNC_NAME, 1); iresource = scm_to_resource (resource, FUNC_NAME, 1);
lim.rlim_cur = (soft == SCM_BOOL_F) ? RLIM_INFINITY : scm_to_long (soft); lim.rlim_cur = scm_is_false (soft) ? RLIM_INFINITY : scm_to_long (soft);
lim.rlim_max = (hard == SCM_BOOL_F) ? RLIM_INFINITY : scm_to_long (hard); lim.rlim_max = scm_is_false (hard) ? RLIM_INFINITY : scm_to_long (hard);
if (setrlimit (iresource, &lim) != 0) if (setrlimit (iresource, &lim) != 0)
scm_syserror (FUNC_NAME); scm_syserror (FUNC_NAME);

View file

@ -1196,14 +1196,14 @@ scm_to_sockaddr (SCM address, size_t *address_size)
size_t path_len = 0; size_t path_len = 0;
path = SCM_SIMPLE_VECTOR_REF (address, 1); path = SCM_SIMPLE_VECTOR_REF (address, 1);
if ((!scm_is_string (path)) && (path != SCM_BOOL_F)) if (!scm_is_string (path) && !scm_is_false (path))
scm_misc_error (FUNC_NAME, "invalid unix address " scm_misc_error (FUNC_NAME, "invalid unix address "
"path: ~A", scm_list_1 (path)); "path: ~A", scm_list_1 (path));
else else
{ {
struct sockaddr_un c_unix; struct sockaddr_un c_unix;
if (path == SCM_BOOL_F) if (scm_is_false (path))
path_len = 0; path_len = 0;
else else
path_len = scm_c_string_length (path); path_len = scm_c_string_length (path);

View file

@ -125,15 +125,15 @@ scm_make_srcprops (long line, int col, SCM filename, SCM copy, SCM alist)
thread safety. thread safety.
*/ */
SCM last_acons = SCM_CDR (scm_last_alist_filename); SCM last_acons = SCM_CDR (scm_last_alist_filename);
if (old_alist == SCM_EOL if (scm_is_null (old_alist)
&& SCM_CDAR (last_acons) == filename) && scm_is_eq (SCM_CDAR (last_acons), filename))
{ {
alist = last_acons; alist = last_acons;
} }
else else
{ {
alist = scm_acons (scm_sym_filename, filename, alist); alist = scm_acons (scm_sym_filename, filename, alist);
if (old_alist == SCM_EOL) if (scm_is_null (old_alist))
SCM_SETCDR (scm_last_alist_filename, alist); SCM_SETCDR (scm_last_alist_filename, alist);
} }
} }