diff options
Diffstat (limited to 'src/fns.c')
-rw-r--r-- | src/fns.c | 184 |
1 files changed, 49 insertions, 135 deletions
diff --git a/src/fns.c b/src/fns.c index a016d199c58..a6f80f33153 100644 --- a/src/fns.c +++ b/src/fns.c @@ -76,7 +76,7 @@ extern Lisp_Object Qinput_method_function; static int internal_equal (Lisp_Object , Lisp_Object, int, int); -extern long get_random (); +extern long get_random (void); extern void seed_random (long); #ifndef HAVE_UNISTD_H @@ -390,8 +390,7 @@ static Lisp_Object concat (int nargs, Lisp_Object *args, enum Lisp_Type target_t /* ARGSUSED */ Lisp_Object -concat2 (s1, s2) - Lisp_Object s1, s2; +concat2 (Lisp_Object s1, Lisp_Object s2) { Lisp_Object args[2]; args[0] = s1; @@ -401,8 +400,7 @@ concat2 (s1, s2) /* ARGSUSED */ Lisp_Object -concat3 (s1, s2, s3) - Lisp_Object s1, s2, s3; +concat3 (Lisp_Object s1, Lisp_Object s2, Lisp_Object s3) { Lisp_Object args[3]; args[0] = s1; @@ -492,11 +490,7 @@ struct textprop_rec }; static Lisp_Object -concat (nargs, args, target_type, last_special) - int nargs; - Lisp_Object *args; - enum Lisp_Type target_type; - int last_special; +concat (int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_special) { Lisp_Object val; register Lisp_Object tail; @@ -777,7 +771,7 @@ static EMACS_INT string_char_byte_cache_charpos; static EMACS_INT string_char_byte_cache_bytepos; void -clear_string_char_byte_cache () +clear_string_char_byte_cache (void) { string_char_byte_cache_string = Qnil; } @@ -785,9 +779,7 @@ clear_string_char_byte_cache () /* Return the byte index corresponding to CHAR_INDEX in STRING. */ EMACS_INT -string_char_to_byte (string, char_index) - Lisp_Object string; - EMACS_INT char_index; +string_char_to_byte (Lisp_Object string, EMACS_INT char_index) { EMACS_INT i_byte; EMACS_INT best_below, best_below_byte; @@ -847,9 +839,7 @@ string_char_to_byte (string, char_index) /* Return the character index corresponding to BYTE_INDEX in STRING. */ EMACS_INT -string_byte_to_char (string, byte_index) - Lisp_Object string; - EMACS_INT byte_index; +string_byte_to_char (Lisp_Object string, EMACS_INT byte_index) { EMACS_INT i, i_byte; EMACS_INT best_below, best_below_byte; @@ -913,8 +903,7 @@ string_byte_to_char (string, byte_index) /* Convert STRING to a multibyte string. */ Lisp_Object -string_make_multibyte (string) - Lisp_Object string; +string_make_multibyte (Lisp_Object string) { unsigned char *buf; EMACS_INT nbytes; @@ -947,8 +936,7 @@ string_make_multibyte (string) converted to eight-bit characters. */ Lisp_Object -string_to_multibyte (string) - Lisp_Object string; +string_to_multibyte (Lisp_Object string) { unsigned char *buf; EMACS_INT nbytes; @@ -978,8 +966,7 @@ string_to_multibyte (string) /* Convert STRING to a single-byte string. */ Lisp_Object -string_make_unibyte (string) - Lisp_Object string; +string_make_unibyte (Lisp_Object string) { int nchars; unsigned char *buf; @@ -1311,9 +1298,7 @@ With one argument, just copy STRING without its properties. */) both in characters and in bytes. */ Lisp_Object -substring_both (string, from, from_byte, to, to_byte) - Lisp_Object string; - int from, from_byte, to, to_byte; +substring_both (Lisp_Object string, int from, int from_byte, int to, int to_byte) { Lisp_Object res; int size; @@ -1495,8 +1480,7 @@ Elements of LIST that are not conses are ignored. */) Use only on lists known never to be circular. */ Lisp_Object -assq_no_quit (key, list) - Lisp_Object key, list; +assq_no_quit (Lisp_Object key, Lisp_Object list) { while (CONSP (list) && (!CONSP (XCAR (list)) @@ -1547,8 +1531,7 @@ The value is actually the first element of LIST whose car equals KEY. */) Use only on lists known never to be circular. */ Lisp_Object -assoc_no_quit (key, list) - Lisp_Object key, list; +assoc_no_quit (Lisp_Object key, Lisp_Object list) { while (CONSP (list) && (!CONSP (XCAR (list)) @@ -1824,7 +1807,7 @@ See also the function `nreverse', which is used more often. */) return new; } -Lisp_Object merge (); +Lisp_Object merge (Lisp_Object org_l1, Lisp_Object org_l2, Lisp_Object pred); DEFUN ("sort", Fsort, Ssort, 2, 2, 0, doc: /* Sort LIST, stably, comparing elements using PREDICATE. @@ -1858,9 +1841,7 @@ if the first element should sort before the second. */) } Lisp_Object -merge (org_l1, org_l2, pred) - Lisp_Object org_l1, org_l2; - Lisp_Object pred; +merge (Lisp_Object org_l1, Lisp_Object org_l2, Lisp_Object pred) { Lisp_Object value; register Lisp_Object tail; @@ -2117,9 +2098,7 @@ of strings. (`equal' ignores text properties.) */) PROPS, if non-nil, means compare string text properties too. */ static int -internal_equal (o1, o2, depth, props) - register Lisp_Object o1, o2; - int depth, props; +internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int props) { if (depth > 200) error ("Stack overflow in equal"); @@ -2240,7 +2219,6 @@ internal_equal (o1, o2, depth, props) return 0; } -extern Lisp_Object Fmake_char_internal (); DEFUN ("fillarray", Ffillarray, Sfillarray, 2, 2, 0, doc: /* Store each element of ARRAY with ITEM. @@ -2334,8 +2312,7 @@ This makes STRING unibyte and may change its length. */) /* ARGSUSED */ Lisp_Object -nconc2 (s1, s2) - Lisp_Object s1, s2; +nconc2 (Lisp_Object s1, Lisp_Object s2) { Lisp_Object args[2]; args[0] = s1; @@ -2390,10 +2367,7 @@ usage: (nconc &rest LISTS) */) LENI is the length of VALS, which should also be the length of SEQ. */ static void -mapcar1 (leni, vals, fn, seq) - int leni; - Lisp_Object *vals; - Lisp_Object fn, seq; +mapcar1 (int leni, Lisp_Object *vals, Lisp_Object fn, Lisp_Object seq) { register Lisp_Object tail; Lisp_Object dummy; @@ -2702,8 +2676,7 @@ is nil and `use-dialog-box' is non-nil. */) Anything that calls this function must protect from GC! */ Lisp_Object -do_yes_or_no_p (prompt) - Lisp_Object prompt; +do_yes_or_no_p (Lisp_Object prompt) { return call1 (intern ("yes-or-no-p"), prompt); } @@ -2870,8 +2843,7 @@ particular subfeatures supported in this version of FEATURE. */) Lisp_Object require_nesting_list; Lisp_Object -require_unwind (old_value) - Lisp_Object old_value; +require_unwind (Lisp_Object old_value) { return require_nesting_list = old_value; } @@ -3333,12 +3305,7 @@ into shorter lines. */) } static int -base64_encode_1 (from, to, length, line_break, multibyte) - const char *from; - char *to; - int length; - int line_break; - int multibyte; +base64_encode_1 (const char *from, char *to, int length, int line_break, int multibyte) { int counter = 0, i = 0; char *e = to; @@ -3535,12 +3502,7 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string, characters in *NCHARS_RETURN. */ static int -base64_decode_1 (from, to, length, multibyte, nchars_return) - const char *from; - char *to; - int length; - int multibyte; - int *nchars_return; +base64_decode_1 (const char *from, char *to, int length, int multibyte, int *nchars_return) { int i = 0; char *e = to; @@ -3682,8 +3644,7 @@ static int sweep_weak_table (struct Lisp_Hash_Table *, int); Lisp_Hash_Table. Otherwise, signal an error. */ static struct Lisp_Hash_Table * -check_hash_table (obj) - Lisp_Object obj; +check_hash_table (Lisp_Object obj) { CHECK_HASH_TABLE (obj); return XHASH_TABLE (obj); @@ -3694,8 +3655,7 @@ check_hash_table (obj) number. */ int -next_almost_prime (n) - int n; +next_almost_prime (int n) { if (n % 2 == 0) n += 1; @@ -3714,11 +3674,7 @@ next_almost_prime (n) a DEFUN parameter list. */ static int -get_key_arg (key, nargs, args, used) - Lisp_Object key; - int nargs; - Lisp_Object *args; - char *used; +get_key_arg (Lisp_Object key, int nargs, Lisp_Object *args, char *used) { int i; @@ -3743,10 +3699,7 @@ get_key_arg (key, nargs, args, used) vector that are not copied from VEC are set to INIT. */ Lisp_Object -larger_vector (vec, new_size, init) - Lisp_Object vec; - int new_size; - Lisp_Object init; +larger_vector (Lisp_Object vec, int new_size, Lisp_Object init) { struct Lisp_Vector *v; int i, old_size; @@ -3774,10 +3727,7 @@ larger_vector (vec, new_size, init) KEY2 are the same. */ static int -cmpfn_eql (h, key1, hash1, key2, hash2) - struct Lisp_Hash_Table *h; - Lisp_Object key1, key2; - unsigned hash1, hash2; +cmpfn_eql (struct Lisp_Hash_Table *h, Lisp_Object key1, unsigned int hash1, Lisp_Object key2, unsigned int hash2) { return (FLOATP (key1) && FLOATP (key2) @@ -3790,10 +3740,7 @@ cmpfn_eql (h, key1, hash1, key2, hash2) KEY2 are the same. */ static int -cmpfn_equal (h, key1, hash1, key2, hash2) - struct Lisp_Hash_Table *h; - Lisp_Object key1, key2; - unsigned hash1, hash2; +cmpfn_equal (struct Lisp_Hash_Table *h, Lisp_Object key1, unsigned int hash1, Lisp_Object key2, unsigned int hash2) { return hash1 == hash2 && !NILP (Fequal (key1, key2)); } @@ -3804,10 +3751,7 @@ cmpfn_equal (h, key1, hash1, key2, hash2) if KEY1 and KEY2 are the same. */ static int -cmpfn_user_defined (h, key1, hash1, key2, hash2) - struct Lisp_Hash_Table *h; - Lisp_Object key1, key2; - unsigned hash1, hash2; +cmpfn_user_defined (struct Lisp_Hash_Table *h, Lisp_Object key1, unsigned int hash1, Lisp_Object key2, unsigned int hash2) { if (hash1 == hash2) { @@ -3828,9 +3772,7 @@ cmpfn_user_defined (h, key1, hash1, key2, hash2) in a Lisp integer. */ static unsigned -hashfn_eq (h, key) - struct Lisp_Hash_Table *h; - Lisp_Object key; +hashfn_eq (struct Lisp_Hash_Table *h, Lisp_Object key) { unsigned hash = XUINT (key) ^ XTYPE (key); xassert ((hash & ~INTMASK) == 0); @@ -3843,9 +3785,7 @@ hashfn_eq (h, key) in a Lisp integer. */ static unsigned -hashfn_eql (h, key) - struct Lisp_Hash_Table *h; - Lisp_Object key; +hashfn_eql (struct Lisp_Hash_Table *h, Lisp_Object key) { unsigned hash; if (FLOATP (key)) @@ -3862,9 +3802,7 @@ hashfn_eql (h, key) in a Lisp integer. */ static unsigned -hashfn_equal (h, key) - struct Lisp_Hash_Table *h; - Lisp_Object key; +hashfn_equal (struct Lisp_Hash_Table *h, Lisp_Object key) { unsigned hash = sxhash (key, 0); xassert ((hash & ~INTMASK) == 0); @@ -3877,9 +3815,7 @@ hashfn_equal (h, key) guaranteed to fit in a Lisp integer. */ static unsigned -hashfn_user_defined (h, key) - struct Lisp_Hash_Table *h; - Lisp_Object key; +hashfn_user_defined (struct Lisp_Hash_Table *h, Lisp_Object key) { Lisp_Object args[2], hash; @@ -4003,8 +3939,7 @@ make_hash_table (test, size, rehash_size, rehash_threshold, weak, only the table itself is. */ Lisp_Object -copy_hash_table (h1) - struct Lisp_Hash_Table *h1; +copy_hash_table (struct Lisp_Hash_Table *h1) { Lisp_Object table; struct Lisp_Hash_Table *h2; @@ -4035,8 +3970,7 @@ copy_hash_table (h1) because it's already too large, throw an error. */ static INLINE void -maybe_resize_hash_table (h) - struct Lisp_Hash_Table *h; +maybe_resize_hash_table (struct Lisp_Hash_Table *h) { if (NILP (h->next_free)) { @@ -4101,10 +4035,7 @@ maybe_resize_hash_table (h) matching KEY, or -1 if not found. */ int -hash_lookup (h, key, hash) - struct Lisp_Hash_Table *h; - Lisp_Object key; - unsigned *hash; +hash_lookup (struct Lisp_Hash_Table *h, Lisp_Object key, unsigned int *hash) { unsigned hash_code; int start_of_bucket; @@ -4138,10 +4069,7 @@ hash_lookup (h, key, hash) Value is the index of the entry in H matching KEY. */ int -hash_put (h, key, value, hash) - struct Lisp_Hash_Table *h; - Lisp_Object key, value; - unsigned hash; +hash_put (struct Lisp_Hash_Table *h, Lisp_Object key, Lisp_Object value, unsigned int hash) { int start_of_bucket, i; @@ -4171,9 +4099,7 @@ hash_put (h, key, value, hash) /* Remove the entry matching KEY from hash table H, if there is one. */ static void -hash_remove_from_table (h, key) - struct Lisp_Hash_Table *h; - Lisp_Object key; +hash_remove_from_table (struct Lisp_Hash_Table *h, Lisp_Object key) { unsigned hash_code; int start_of_bucket; @@ -4221,8 +4147,7 @@ hash_remove_from_table (h, key) /* Clear hash table H. */ void -hash_clear (h) - struct Lisp_Hash_Table *h; +hash_clear (struct Lisp_Hash_Table *h) { if (h->count > 0) { @@ -4251,7 +4176,7 @@ hash_clear (h) ************************************************************************/ void -init_weak_hash_tables () +init_weak_hash_tables (void) { weak_hash_tables = NULL; } @@ -4262,9 +4187,7 @@ init_weak_hash_tables () non-zero if anything was marked. */ static int -sweep_weak_table (h, remove_entries_p) - struct Lisp_Hash_Table *h; - int remove_entries_p; +sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p) { int bucket, n, marked; @@ -4352,7 +4275,7 @@ sweep_weak_table (h, remove_entries_p) from Vweak_hash_tables. Called from gc_sweep. */ void -sweep_weak_hash_tables () +sweep_weak_hash_tables (void) { struct Lisp_Hash_Table *h, *used, *next; int marked; @@ -4420,9 +4343,7 @@ sweep_weak_hash_tables () code returned is guaranteed to fit in a Lisp integer. */ static unsigned -sxhash_string (ptr, len) - unsigned char *ptr; - int len; +sxhash_string (unsigned char *ptr, int len) { unsigned char *p = ptr; unsigned char *end = p + len; @@ -4445,9 +4366,7 @@ sxhash_string (ptr, len) list. We don't recurse deeper than SXHASH_MAX_DEPTH in it. */ static unsigned -sxhash_list (list, depth) - Lisp_Object list; - int depth; +sxhash_list (Lisp_Object list, int depth) { unsigned hash = 0; int i; @@ -4475,9 +4394,7 @@ sxhash_list (list, depth) the Lisp structure. */ static unsigned -sxhash_vector (vec, depth) - Lisp_Object vec; - int depth; +sxhash_vector (Lisp_Object vec, int depth) { unsigned hash = ASIZE (vec); int i, n; @@ -4496,8 +4413,7 @@ sxhash_vector (vec, depth) /* Return a hash for bool-vector VECTOR. */ static unsigned -sxhash_bool_vector (vec) - Lisp_Object vec; +sxhash_bool_vector (Lisp_Object vec) { unsigned hash = XBOOL_VECTOR (vec)->size; int i, n; @@ -4514,9 +4430,7 @@ sxhash_bool_vector (vec) structure. Value is an unsigned integer clipped to INTMASK. */ unsigned -sxhash (obj, depth) - Lisp_Object obj; - int depth; +sxhash (Lisp_Object obj, int depth) { unsigned hash; @@ -5110,7 +5024,7 @@ guesswork fails. Normally, an error is signaled in such case. */) void -syms_of_fns () +syms_of_fns (void) { /* Hash table stuff. */ Qhash_table_p = intern_c_string ("hash-table-p"); @@ -5286,7 +5200,7 @@ this variable. */); void -init_fns () +init_fns (void) { } |