From 8abc3f12955673bdb367b2de5556ff66f202d2d0 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 22 Mar 2011 09:20:45 -0700 Subject: * coding.c (encode_coding_raw_text): Avoid unnecessary test the first time through the loop, since we know p0 < p1 then. This also avoids a gcc -Wstrict-overflow warning. --- src/coding.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index 0c2836c19f6..0596d16bf46 100644 --- a/src/coding.c +++ b/src/coding.c @@ -5266,11 +5266,12 @@ encode_coding_raw_text (struct coding_system *coding) unsigned char str[MAX_MULTIBYTE_LENGTH], *p0 = str, *p1 = str; CHAR_STRING_ADVANCE (c, p1); - while (p0 < p1) + do { EMIT_ONE_BYTE (*p0); p0++; } + while (p0 < p1); } } else -- cgit v1.2.1 From c5101a77a4066d979698d356c3a9c7f387007359 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 26 Mar 2011 19:12:36 -0700 Subject: Variadic C functions now count arguments with size_t, not int. --- src/coding.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index 0596d16bf46..a93a9a4d0e4 100644 --- a/src/coding.c +++ b/src/coding.c @@ -9300,7 +9300,7 @@ function to call for FILENAME, that function should examine the contents of BUFFER instead of reading the file. usage: (find-operation-coding-system OPERATION ARGUMENTS...) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { Lisp_Object operation, target_idx, target, val; register Lisp_Object chain; @@ -9309,17 +9309,17 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS...) */) error ("Too few arguments"); operation = args[0]; if (!SYMBOLP (operation) - || !INTEGERP (target_idx = Fget (operation, Qtarget_idx))) + || !NATNUMP (target_idx = Fget (operation, Qtarget_idx))) error ("Invalid first argument"); - if (nargs < 1 + XINT (target_idx)) + if (nargs < 1 + XFASTINT (target_idx)) error ("Too few arguments for operation: %s", SDATA (SYMBOL_NAME (operation))); - target = args[XINT (target_idx) + 1]; + target = args[XFASTINT (target_idx) + 1]; if (!(STRINGP (target) || (EQ (operation, Qinsert_file_contents) && CONSP (target) && STRINGP (XCAR (target)) && BUFFERP (XCDR (target))) || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) - error ("Invalid %dth argument", XINT (target_idx) + 1); + error ("Invalid %dth argument", XFASTINT (target_idx) + 1); if (CONSP (target)) target = XCAR (target); @@ -9376,9 +9376,9 @@ If multiple coding systems belong to the same category, all but the first one are ignored. usage: (set-coding-system-priority &rest coding-systems) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { - int i, j; + size_t i, j; int changed[coding_category_max]; enum coding_category priorities[coding_category_max]; @@ -9421,7 +9421,7 @@ usage: (set-coding-system-priority &rest coding-systems) */) /* Update `coding-category-list'. */ Vcoding_category_list = Qnil; - for (i = coding_category_max - 1; i >= 0; i--) + for (i = coding_category_max; i-- > 0; ) Vcoding_category_list = Fcons (AREF (Vcoding_category_table, priorities[i]), Vcoding_category_list); @@ -9482,7 +9482,7 @@ DEFUN ("define-coding-system-internal", Fdefine_coding_system_internal, Sdefine_coding_system_internal, coding_arg_max, MANY, 0, doc: /* For internal use only. usage: (define-coding-system-internal ...) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { Lisp_Object name; Lisp_Object spec_vec; /* [ ATTRS ALIASE EOL_TYPE ] */ -- cgit v1.2.1 From 461c2ab9a5a244ec9a1b253d07c1a8bdfbd8c573 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Tue, 29 Mar 2011 00:41:01 +0200 Subject: src/*.c: Remove some additional unused parameters. * lisp.h (multibyte_char_to_unibyte): * character.c (multibyte_char_to_unibyte): Remove parameter `rev_tbl', unused since 2002-03-01T01:16:34Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org. * character.h (CHAR_TO_BYTE8): * cmds.c (internal_self_insert): * editfns.c (general_insert_function): * keymap.c (push_key_description): * search.c (Freplace_match): * xdisp.c (message_dolog, set_message_1): All callers changed. * coding.c (encode_designation_at_bol): Remove parameter `charbuf_end', unused since 2002-03-01T01:17:24Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org. All callers changed. --- src/coding.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index 0596d16bf46..fd812148a26 100644 --- a/src/coding.c +++ b/src/coding.c @@ -853,8 +853,7 @@ static unsigned char *alloc_destination (struct coding_system *, EMACS_INT, unsigned char *); static void setup_iso_safe_charsets (Lisp_Object); static unsigned char *encode_designation_at_bol (struct coding_system *, - int *, int *, - unsigned char *); + int *, unsigned char *); static int detect_eol (const unsigned char *, EMACS_INT, enum coding_category); static Lisp_Object adjust_coding_eol_type (struct coding_system *, int); @@ -4299,7 +4298,7 @@ encode_invocation_designation (struct charset *charset, static unsigned char * encode_designation_at_bol (struct coding_system *coding, int *charbuf, - int *charbuf_end, unsigned char *dst) + unsigned char *dst) { struct charset *charset; /* Table of charsets to be designated to each graphic register. */ @@ -4390,7 +4389,7 @@ encode_coding_iso_2022 (struct coding_system *coding) unsigned char *dst_prev = dst; /* We have to produce designation sequences if any now. */ - dst = encode_designation_at_bol (coding, charbuf, charbuf_end, dst); + dst = encode_designation_at_bol (coding, charbuf, dst); bol_designation = 0; /* We are sure that designation sequences are all ASCII bytes. */ produced_chars += dst - dst_prev; -- cgit v1.2.1