mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-01 07:20:20 +02:00
Switch all users of SCM_SIMPLE_VECTOR_LENGTH to scm_c_vector_length
* libguile/arrays.c: * libguile/eval.c: * libguile/filesys.c: * libguile/hash.c: * libguile/hashtab.c: * libguile/memoize.c: * libguile/modules.c: * libguile/poll.c: * libguile/posix.c: * libguile/print.c: * libguile/socket.c: * libguile/stime.c: Use C function instead of macro.
This commit is contained in:
parent
0a5d2ffb1a
commit
d73c675fa6
12 changed files with 34 additions and 34 deletions
|
@ -836,7 +836,7 @@ SCM_DEFINE (scm_transpose_array, "transpose-array", 1, 0, 1,
|
|||
|
||||
SCM vargs = scm_vector (args);
|
||||
struct scm_array *ra = scm_to_array (array);
|
||||
if (SCM_SIMPLE_VECTOR_LENGTH (vargs) != scm_array_dimension_count (ra))
|
||||
if (scm_c_vector_length (vargs) != scm_array_dimension_count (ra))
|
||||
SCM_WRONG_NUM_ARGS ();
|
||||
ndim = 0;
|
||||
for (k = 0; k < scm_array_dimension_count (ra); k++)
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
|
||||
#define VECTOR_REF(v, i) (SCM_SIMPLE_VECTOR_REF (v, i))
|
||||
#define VECTOR_SET(v, i, x) (SCM_SIMPLE_VECTOR_SET (v, i, x))
|
||||
#define VECTOR_LENGTH(v) (SCM_SIMPLE_VECTOR_LENGTH (v))
|
||||
#define VECTOR_LENGTH(v) (scm_c_vector_length (v))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -824,7 +824,7 @@ fill_select_type (fd_set *set, SCM *ports_ready, SCM list_or_vec, int pos)
|
|||
|
||||
if (scm_is_vector (list_or_vec))
|
||||
{
|
||||
int i = SCM_SIMPLE_VECTOR_LENGTH (list_or_vec);
|
||||
int i = scm_c_vector_length (list_or_vec);
|
||||
|
||||
while (--i >= 0)
|
||||
{
|
||||
|
@ -958,7 +958,7 @@ SCM_DEFINE (scm_select, "select", 3, 2, 0,
|
|||
|
||||
if (scm_is_vector (reads))
|
||||
{
|
||||
read_count = SCM_SIMPLE_VECTOR_LENGTH (reads);
|
||||
read_count = scm_c_vector_length (reads);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -967,7 +967,7 @@ SCM_DEFINE (scm_select, "select", 3, 2, 0,
|
|||
}
|
||||
if (scm_is_vector (writes))
|
||||
{
|
||||
write_count = SCM_SIMPLE_VECTOR_LENGTH (writes);
|
||||
write_count = scm_c_vector_length (writes);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -976,7 +976,7 @@ SCM_DEFINE (scm_select, "select", 3, 2, 0,
|
|||
}
|
||||
if (scm_is_vector (excepts))
|
||||
{
|
||||
except_count = SCM_SIMPLE_VECTOR_LENGTH (excepts);
|
||||
except_count = scm_c_vector_length (excepts);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -319,7 +319,7 @@ scm_raw_ihash (SCM obj, size_t depth)
|
|||
return scm_raw_ihashq ((uintptr_t) SCM_POINTER_VALUE (obj));
|
||||
case scm_tc7_vector:
|
||||
{
|
||||
size_t len = SCM_SIMPLE_VECTOR_LENGTH (obj);
|
||||
size_t len = scm_c_vector_length (obj);
|
||||
size_t i = depth / 2;
|
||||
unsigned long h = scm_raw_ihashq (SCM_CELL_WORD_0 (obj));
|
||||
if (len)
|
||||
|
|
|
@ -509,7 +509,7 @@ hashtable_lower (struct scm_t_hashtable *ht)
|
|||
static inline size_t
|
||||
hashtable_bucket_count (struct scm_t_hashtable *ht)
|
||||
{
|
||||
return SCM_SIMPLE_VECTOR_LENGTH (hashtable_buckets (ht));
|
||||
return scm_c_vector_length (hashtable_buckets (ht));
|
||||
}
|
||||
|
||||
static inline SCM
|
||||
|
@ -697,10 +697,10 @@ scm_hash_fn_get_handle (SCM table, SCM obj,
|
|||
struct scm_t_hashtable *ht = scm_to_hashtable (table);
|
||||
buckets = hashtable_buckets (ht);
|
||||
|
||||
if (SCM_SIMPLE_VECTOR_LENGTH (buckets) == 0)
|
||||
if (scm_c_vector_length (buckets) == 0)
|
||||
return SCM_BOOL_F;
|
||||
k = hash_fn (obj, SCM_SIMPLE_VECTOR_LENGTH (buckets), closure);
|
||||
if (k >= SCM_SIMPLE_VECTOR_LENGTH (buckets))
|
||||
k = hash_fn (obj, scm_c_vector_length (buckets), closure);
|
||||
if (k >= scm_c_vector_length (buckets))
|
||||
scm_out_of_range (FUNC_NAME, scm_from_ulong (k));
|
||||
|
||||
h = assoc_fn (obj, SCM_SIMPLE_VECTOR_REF (buckets, k), closure);
|
||||
|
@ -723,11 +723,11 @@ scm_hash_fn_create_handle_x (SCM table, SCM obj, SCM init,
|
|||
struct scm_t_hashtable *ht = scm_to_hashtable (table);
|
||||
buckets = hashtable_buckets (ht);
|
||||
|
||||
if (SCM_SIMPLE_VECTOR_LENGTH (buckets) == 0)
|
||||
if (scm_c_vector_length (buckets) == 0)
|
||||
SCM_MISC_ERROR ("void hashtable", SCM_EOL);
|
||||
|
||||
k = hash_fn (obj, SCM_SIMPLE_VECTOR_LENGTH (buckets), closure);
|
||||
if (k >= SCM_SIMPLE_VECTOR_LENGTH (buckets))
|
||||
k = hash_fn (obj, scm_c_vector_length (buckets), closure);
|
||||
if (k >= scm_c_vector_length (buckets))
|
||||
scm_out_of_range ("hash_fn_create_handle_x", scm_from_ulong (k));
|
||||
|
||||
it = assoc_fn (obj, SCM_SIMPLE_VECTOR_REF (buckets, k), closure);
|
||||
|
@ -746,8 +746,8 @@ scm_hash_fn_create_handle_x (SCM table, SCM obj, SCM init,
|
|||
if (!scm_is_eq (hashtable_buckets (ht), buckets))
|
||||
{
|
||||
buckets = hashtable_buckets (ht);
|
||||
k = hash_fn (obj, SCM_SIMPLE_VECTOR_LENGTH (buckets), closure);
|
||||
if (k >= SCM_SIMPLE_VECTOR_LENGTH (buckets))
|
||||
k = hash_fn (obj, scm_c_vector_length (buckets), closure);
|
||||
if (k >= scm_c_vector_length (buckets))
|
||||
scm_out_of_range ("hash_fn_create_handle_x", scm_from_ulong (k));
|
||||
}
|
||||
SCM_SETCDR (new_bucket, SCM_SIMPLE_VECTOR_REF (buckets, k));
|
||||
|
@ -808,11 +808,11 @@ scm_hash_fn_remove_x (SCM table, SCM obj,
|
|||
struct scm_t_hashtable *ht = scm_to_hashtable (table);
|
||||
buckets = hashtable_buckets (ht);
|
||||
|
||||
if (SCM_SIMPLE_VECTOR_LENGTH (buckets) == 0)
|
||||
if (scm_c_vector_length (buckets) == 0)
|
||||
return SCM_EOL;
|
||||
|
||||
k = hash_fn (obj, SCM_SIMPLE_VECTOR_LENGTH (buckets), closure);
|
||||
if (k >= SCM_SIMPLE_VECTOR_LENGTH (buckets))
|
||||
k = hash_fn (obj, scm_c_vector_length (buckets), closure);
|
||||
if (k >= scm_c_vector_length (buckets))
|
||||
scm_out_of_range (FUNC_NAME, scm_from_ulong (k));
|
||||
|
||||
h = assoc_fn (obj, SCM_SIMPLE_VECTOR_REF (buckets, k), closure);
|
||||
|
@ -1551,7 +1551,7 @@ scm_internal_hash_fold (scm_t_hash_fold_fn fn, void *closure,
|
|||
struct scm_t_hashtable *ht = scm_to_hashtable (table);
|
||||
buckets = hashtable_buckets (ht);
|
||||
|
||||
n = SCM_SIMPLE_VECTOR_LENGTH (buckets);
|
||||
n = scm_c_vector_length (buckets);
|
||||
for (i = 0; i < n; ++i)
|
||||
{
|
||||
SCM ls, handle;
|
||||
|
@ -1585,7 +1585,7 @@ scm_internal_hash_for_each_handle (scm_t_hash_handle_fn fn, void *closure,
|
|||
SCM_VALIDATE_HASHTABLE (0, table);
|
||||
struct scm_t_hashtable *ht = scm_to_hashtable (table);
|
||||
buckets = hashtable_buckets (ht);
|
||||
n = SCM_SIMPLE_VECTOR_LENGTH (buckets);
|
||||
n = scm_c_vector_length (buckets);
|
||||
|
||||
for (i = 0; i < n; ++i)
|
||||
{
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
|
||||
#define VECTOR_REF(v, i) (SCM_SIMPLE_VECTOR_REF (v, i))
|
||||
#define VECTOR_SET(v, i, x) (SCM_SIMPLE_VECTOR_SET (v, i, x))
|
||||
#define VECTOR_LENGTH(v) (SCM_SIMPLE_VECTOR_LENGTH (v))
|
||||
#define VECTOR_LENGTH(v) (scm_c_vector_length (v))
|
||||
|
||||
SCM_SYMBOL (sym_case_lambda_star, "case-lambda*");
|
||||
|
||||
|
|
|
@ -847,7 +847,7 @@ SCM_DEFINE (scm_module_reverse_lookup, "module-reverse-lookup", 2, 0, 0,
|
|||
|
||||
struct scm_t_hashtable *ht = scm_to_hashtable (obarray);
|
||||
SCM buckets = ht->buckets;
|
||||
n = SCM_SIMPLE_VECTOR_LENGTH (buckets);
|
||||
n = scm_c_vector_length (buckets);
|
||||
for (i = 0; i < n; ++i)
|
||||
{
|
||||
for (SCM ls = SCM_SIMPLE_VECTOR_REF (buckets, i);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 2010,2013,2018
|
||||
/* Copyright 2010,2013,2018,2025
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Guile.
|
||||
|
@ -99,7 +99,7 @@ scm_primitive_poll (SCM pollfds, SCM nfds, SCM ports, SCM timeout)
|
|||
SCM_OUT_OF_RANGE (SCM_ARG2, nfds);
|
||||
|
||||
SCM_VALIDATE_VECTOR (SCM_ARG3, ports);
|
||||
if (SCM_UNLIKELY (SCM_SIMPLE_VECTOR_LENGTH (ports) < c_nfds))
|
||||
if (SCM_UNLIKELY (scm_c_vector_length (ports) < c_nfds))
|
||||
SCM_OUT_OF_RANGE (SCM_ARG3, ports);
|
||||
|
||||
fds = (struct pollfd*)SCM_BYTEVECTOR_CONTENTS (pollfds);
|
||||
|
|
|
@ -345,7 +345,7 @@ SCM_DEFINE (scm_setgroups, "setgroups", 1, 0, 0,
|
|||
|
||||
SCM_VALIDATE_VECTOR (SCM_ARG1, group_vec);
|
||||
|
||||
ngroups = SCM_SIMPLE_VECTOR_LENGTH (group_vec);
|
||||
ngroups = scm_c_vector_length (group_vec);
|
||||
|
||||
/* validate before allocating, so we don't have to worry about leaks */
|
||||
for (i = 0; i < ngroups; i++)
|
||||
|
|
|
@ -212,7 +212,7 @@ push_print_state (SCM port, struct scm_print_state *state,
|
|||
state->prev = prev;
|
||||
state->port = port;
|
||||
state->ref_vect = scm_c_make_vector (PSTATE_SIZE, SCM_UNDEFINED);
|
||||
state->ceiling = SCM_SIMPLE_VECTOR_LENGTH (state->ref_vect);
|
||||
state->ceiling = scm_c_vector_length (state->ref_vect);
|
||||
scm_i_pthread_setspecific (print_state_key, state);
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ static void
|
|||
grow_ref_stack (scm_print_state *pstate)
|
||||
{
|
||||
SCM old_vect = pstate->ref_vect;
|
||||
size_t old_size = SCM_SIMPLE_VECTOR_LENGTH (old_vect);
|
||||
size_t old_size = scm_c_vector_length (old_vect);
|
||||
size_t new_size = 2 * pstate->ceiling;
|
||||
SCM new_vect = scm_c_make_vector (new_size, SCM_UNDEFINED);
|
||||
unsigned long int i;
|
||||
|
@ -806,7 +806,7 @@ iprin1 (SCM exp, SCM port, scm_print_state *pstate)
|
|||
case scm_tc7_vector:
|
||||
ENTER_NESTED_DATA (pstate, exp, circref);
|
||||
scm_puts ("#(", port);
|
||||
print_vector (exp, SCM_SIMPLE_VECTOR_LENGTH (exp), scm_c_vector_ref,
|
||||
print_vector (exp, scm_c_vector_length (exp), scm_c_vector_ref,
|
||||
port, pstate);
|
||||
EXIT_NESTED_DATA (pstate);
|
||||
break;
|
||||
|
|
|
@ -1127,7 +1127,7 @@ scm_to_sockaddr (SCM address, size_t *address_size)
|
|||
{
|
||||
case AF_INET:
|
||||
{
|
||||
if (SCM_SIMPLE_VECTOR_LENGTH (address) != 3)
|
||||
if (scm_c_vector_length (address) != 3)
|
||||
scm_misc_error (FUNC_NAME,
|
||||
"invalid inet address representation: ~A",
|
||||
scm_list_1 (address));
|
||||
|
@ -1158,7 +1158,7 @@ scm_to_sockaddr (SCM address, size_t *address_size)
|
|||
#ifdef HAVE_IPV6
|
||||
case AF_INET6:
|
||||
{
|
||||
if (SCM_SIMPLE_VECTOR_LENGTH (address) != 5)
|
||||
if (scm_c_vector_length (address) != 5)
|
||||
scm_misc_error (FUNC_NAME, "invalid inet6 address representation: ~A",
|
||||
scm_list_1 (address));
|
||||
else
|
||||
|
@ -1190,7 +1190,7 @@ scm_to_sockaddr (SCM address, size_t *address_size)
|
|||
#ifdef HAVE_UNIX_DOMAIN_SOCKETS
|
||||
case AF_UNIX:
|
||||
{
|
||||
if (SCM_SIMPLE_VECTOR_LENGTH (address) != 2)
|
||||
if (scm_c_vector_length (address) != 2)
|
||||
scm_misc_error (FUNC_NAME, "invalid unix address representation: ~A",
|
||||
scm_list_1 (address));
|
||||
else
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 1995-2001,2003-2009,2011,2013-2014,2016-2020
|
||||
/* Copyright 1995-2001,2003-2009,2011,2013-2014,2016-2020,2025
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Guile.
|
||||
|
@ -507,7 +507,7 @@ static void
|
|||
bdtime2c (SCM sbd_time, struct tm *lt, int pos, const char *subr)
|
||||
{
|
||||
SCM_ASSERT (scm_is_vector (sbd_time)
|
||||
&& SCM_SIMPLE_VECTOR_LENGTH (sbd_time) == 11,
|
||||
&& scm_c_vector_length (sbd_time) == 11,
|
||||
sbd_time, pos, subr);
|
||||
|
||||
lt->tm_sec = scm_to_int (SCM_SIMPLE_VECTOR_REF (sbd_time, 0));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue