summaryrefslogtreecommitdiff
path: root/src/fns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fns.c')
-rw-r--r--src/fns.c63
1 files changed, 30 insertions, 33 deletions
diff --git a/src/fns.c b/src/fns.c
index 9a009c8ab44..bce922859d1 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -348,7 +348,7 @@ Symbols are also allowed; their print names are used instead. */)
return i1 < SCHARS (s2) ? Qt : Qnil;
}
-static Lisp_Object concat (int nargs, Lisp_Object *args,
+static Lisp_Object concat (size_t nargs, Lisp_Object *args,
enum Lisp_Type target_type, int last_special);
/* ARGSUSED */
@@ -378,7 +378,7 @@ The result is a list whose elements are the elements of all the arguments.
Each argument may be a list, vector or string.
The last argument is not copied, just used as the tail of the new list.
usage: (append &rest SEQUENCES) */)
- (int nargs, Lisp_Object *args)
+ (size_t nargs, Lisp_Object *args)
{
return concat (nargs, args, Lisp_Cons, 1);
}
@@ -388,7 +388,7 @@ DEFUN ("concat", Fconcat, Sconcat, 0, MANY, 0,
The result is a string whose elements are the elements of all the arguments.
Each argument may be a string or a list or vector of characters (integers).
usage: (concat &rest SEQUENCES) */)
- (int nargs, Lisp_Object *args)
+ (size_t nargs, Lisp_Object *args)
{
return concat (nargs, args, Lisp_String, 0);
}
@@ -398,7 +398,7 @@ DEFUN ("vconcat", Fvconcat, Svconcat, 0, MANY, 0,
The result is a vector whose elements are the elements of all the arguments.
Each argument may be a list, vector or string.
usage: (vconcat &rest SEQUENCES) */)
- (int nargs, Lisp_Object *args)
+ (size_t nargs, Lisp_Object *args)
{
return concat (nargs, args, Lisp_Vectorlike, 0);
}
@@ -446,7 +446,8 @@ struct textprop_rec
};
static Lisp_Object
-concat (int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_special)
+concat (size_t nargs, Lisp_Object *args,
+ enum Lisp_Type target_type, int last_special)
{
Lisp_Object val;
register Lisp_Object tail;
@@ -455,7 +456,7 @@ concat (int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_speci
EMACS_INT toindex_byte = 0;
register EMACS_INT result_len;
register EMACS_INT result_len_byte;
- register int argnum;
+ register size_t argnum;
Lisp_Object last_tail;
Lisp_Object prev;
int some_multibyte;
@@ -2232,9 +2233,9 @@ DEFUN ("nconc", Fnconc, Snconc, 0, MANY, 0,
doc: /* Concatenate any number of lists by altering them.
Only the last argument is not altered, and need not be a list.
usage: (nconc &rest LISTS) */)
- (int nargs, Lisp_Object *args)
+ (size_t nargs, Lisp_Object *args)
{
- register int argnum;
+ register size_t argnum;
register Lisp_Object tail, tem, val;
val = tail = Qnil;
@@ -2763,7 +2764,7 @@ DEFUN ("widget-apply", Fwidget_apply, Swidget_apply, 2, MANY, 0,
doc: /* Apply the value of WIDGET's PROPERTY to the widget itself.
ARGS are passed as extra arguments to the function.
usage: (widget-apply WIDGET PROPERTY &rest ARGS) */)
- (int nargs, Lisp_Object *args)
+ (size_t nargs, Lisp_Object *args)
{
/* This function can GC. */
Lisp_Object newargs[3];
@@ -3367,7 +3368,7 @@ Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value;
/* Function prototypes. */
static struct Lisp_Hash_Table *check_hash_table (Lisp_Object);
-static int get_key_arg (Lisp_Object, int, Lisp_Object *, char *);
+static size_t get_key_arg (Lisp_Object, size_t, Lisp_Object *, char *);
static void maybe_resize_hash_table (struct Lisp_Hash_Table *);
static int cmpfn_eql (struct Lisp_Hash_Table *, Lisp_Object, unsigned,
Lisp_Object, unsigned);
@@ -3422,27 +3423,23 @@ next_almost_prime (int n)
/* Find KEY in ARGS which has size NARGS. Don't consider indices for
which USED[I] is non-zero. If found at index I in ARGS, set
USED[I] and USED[I + 1] to 1, and return I + 1. Otherwise return
- -1. This function is used to extract a keyword/argument pair from
+ 0. This function is used to extract a keyword/argument pair from
a DEFUN parameter list. */
-static int
-get_key_arg (Lisp_Object key, int nargs, Lisp_Object *args, char *used)
+static size_t
+get_key_arg (Lisp_Object key, size_t nargs, Lisp_Object *args, char *used)
{
- int i;
-
- for (i = 0; i < nargs - 1; ++i)
- if (!used[i] && EQ (args[i], key))
- break;
+ size_t i;
- if (i >= nargs - 1)
- i = -1;
- else
- {
- used[i++] = 1;
- used[i] = 1;
- }
+ for (i = 1; i < nargs; i++)
+ if (!used[i - 1] && EQ (args[i - 1], key))
+ {
+ used[i - 1] = 1;
+ used[i] = 1;
+ return i;
+ }
- return i;
+ return 0;
}
@@ -4290,12 +4287,12 @@ WEAK. WEAK t is equivalent to `key-and-value'. Default value of WEAK
is nil.
usage: (make-hash-table &rest KEYWORD-ARGS) */)
- (int nargs, Lisp_Object *args)
+ (size_t nargs, Lisp_Object *args)
{
Lisp_Object test, size, rehash_size, rehash_threshold, weak;
Lisp_Object user_test, user_hash;
char *used;
- int i;
+ size_t i;
/* The vector `used' is used to keep track of arguments that
have been consumed. */
@@ -4304,7 +4301,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
/* See if there's a `:test TEST' among the arguments. */
i = get_key_arg (QCtest, nargs, args, used);
- test = i < 0 ? Qeql : args[i];
+ test = i ? args[i] : Qeql;
if (!EQ (test, Qeq) && !EQ (test, Qeql) && !EQ (test, Qequal))
{
/* See if it is a user-defined test. */
@@ -4321,7 +4318,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
/* See if there's a `:size SIZE' argument. */
i = get_key_arg (QCsize, nargs, args, used);
- size = i < 0 ? Qnil : args[i];
+ size = i ? args[i] : Qnil;
if (NILP (size))
size = make_number (DEFAULT_HASH_SIZE);
else if (!INTEGERP (size) || XINT (size) < 0)
@@ -4329,7 +4326,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
/* Look for `:rehash-size SIZE'. */
i = get_key_arg (QCrehash_size, nargs, args, used);
- rehash_size = i < 0 ? make_float (DEFAULT_REHASH_SIZE) : args[i];
+ rehash_size = i ? args[i] : make_float (DEFAULT_REHASH_SIZE);
if (!NUMBERP (rehash_size)
|| (INTEGERP (rehash_size) && XINT (rehash_size) <= 0)
|| XFLOATINT (rehash_size) <= 1.0)
@@ -4337,7 +4334,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
/* Look for `:rehash-threshold THRESHOLD'. */
i = get_key_arg (QCrehash_threshold, nargs, args, used);
- rehash_threshold = i < 0 ? make_float (DEFAULT_REHASH_THRESHOLD) : args[i];
+ rehash_threshold = i ? args[i] : make_float (DEFAULT_REHASH_THRESHOLD);
if (!FLOATP (rehash_threshold)
|| XFLOATINT (rehash_threshold) <= 0.0
|| XFLOATINT (rehash_threshold) > 1.0)
@@ -4345,7 +4342,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
/* Look for `:weakness WEAK'. */
i = get_key_arg (QCweakness, nargs, args, used);
- weak = i < 0 ? Qnil : args[i];
+ weak = i ? args[i] : Qnil;
if (EQ (weak, Qt))
weak = Qkey_and_value;
if (!NILP (weak)