From 4028306292f1808f11131a9c6b32394cdaed4a34 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Thu, 23 Sep 2010 22:16:55 +0200 Subject: [PATCH] Clean up EMACS_INT/int in cmds.c, as well as USE_SAFE_ALLOCA. --- src/ChangeLog | 11 +++++++++++ src/cmds.c | 29 +++++++++++++++-------------- src/lisp.h | 4 ++-- src/lread.c | 2 +- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index b50e07c7fe..233a521f02 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2010-09-23 Lars Magne Ingebrigtsen + + * lisp.h: Have oblookup take EMACS_INT to allow interning big + string and avoid compiler warnings. + (USE_SAFE_ALLOCA): Cast to int to avoid compilation warnings in + all users. + + * lread.c (oblookup): EMACS_INT/int cleanup. + + * cmds.c (Fforward_line, Fdelete_char): EMACS_INT/int cleanup. + 2010-09-23 Eli Zaretskii * editfns.c (clip_to_bounds): Return an EMACS_INT value. diff --git a/src/cmds.c b/src/cmds.c index 0e305e1fce..0647810a42 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -68,7 +68,7 @@ right or to the left on the screen. This is in contrast with hooks, etcetera), that's not a good approach. So we validate the proposed position, then set point. */ { - int new_point = PT + XINT (n); + EMACS_INT new_point = PT + XINT (n); if (new_point < BEGV) { @@ -116,9 +116,9 @@ With positive N, a non-empty line at the end counts as one line successfully moved (for the return value). */) (Lisp_Object n) { - int opoint = PT, opoint_byte = PT_BYTE; - int pos, pos_byte; - int count, shortage; + EMACS_INT opoint = PT, opoint_byte = PT_BYTE; + EMACS_INT pos, pos_byte; + EMACS_INT count, shortage; if (NILP (n)) count = 1; @@ -188,7 +188,7 @@ not move. To ignore field boundaries bind `inhibit-field-text-motion' to t. */) (Lisp_Object n) { - int newpos; + EMACS_INT newpos; if (NILP (n)) XSETFASTINT (n, 1); @@ -233,7 +233,7 @@ N was explicitly specified. The command `delete-forward' is preferable for interactive use. */) (Lisp_Object n, Lisp_Object killflag) { - int pos; + EMACS_INT pos; CHECK_NUMBER (n); @@ -303,8 +303,8 @@ After insertion, the value of `auto-fill-function' is called if the bitch_at_user (); { int character = translate_char (Vtranslation_table_for_input, - XINT (last_command_event)); - int val = internal_self_insert (character, XFASTINT (n)); + (int) XINT (last_command_event)); + int val = internal_self_insert (character, (int) XFASTINT (n)); if (val == 2) nonundocount = 0; frame_make_pointer_invisible (); @@ -333,8 +333,8 @@ internal_self_insert (int c, int n) int len; /* Working buffer and pointer for multi-byte form of C. */ unsigned char str[MAX_MULTIBYTE_LENGTH]; - int chars_to_delete = 0; - int spaces_to_insert = 0; + EMACS_INT chars_to_delete = 0; + EMACS_INT spaces_to_insert = 0; overwrite = current_buffer->overwrite_mode; if (!NILP (Vbefore_change_functions) || !NILP (Vafter_change_functions)) @@ -380,12 +380,12 @@ internal_self_insert (int c, int n) chars_to_delete = n; else if (c != '\n' && c2 != '\n') { - int pos = PT; - int pos_byte = PT_BYTE; + EMACS_INT pos = PT; + EMACS_INT pos_byte = PT_BYTE; /* Column the cursor should be placed at after this insertion. The correct value should be calculated only when necessary. */ int target_clm = ((int) current_column () /* iftc */ - + n * XINT (Fchar_width (make_number (c)))); + + n * (int) XINT (Fchar_width (make_number (c)))); /* The actual cursor position after the trial of moving to column TARGET_CLM. It is greater than TARGET_CLM @@ -393,7 +393,8 @@ internal_self_insert (int c, int n) character. In that case, the new point is set after that character. */ int actual_clm - = XFASTINT (Fmove_to_column (make_number (target_clm), Qnil)); + = (int) XFASTINT (Fmove_to_column (make_number (target_clm), + Qnil)); chars_to_delete = PT - pos; diff --git a/src/lisp.h b/src/lisp.h index 17dbfab748..bbc97241ef 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2839,7 +2839,7 @@ extern Lisp_Object check_obarray (Lisp_Object); extern Lisp_Object intern (const char *); extern Lisp_Object intern_c_string (const char *); extern Lisp_Object make_symbol (const char *); -extern Lisp_Object oblookup (Lisp_Object, const char *, int, int); +extern Lisp_Object oblookup (Lisp_Object, const char *, EMACS_INT, EMACS_INT); #define LOADHIST_ATTACH(x) \ do { \ if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list); \ @@ -3726,7 +3726,7 @@ extern void init_system_name (void); extern Lisp_Object safe_alloca_unwind (Lisp_Object); #define USE_SAFE_ALLOCA \ - int sa_count = SPECPDL_INDEX (), sa_must_free = 0 + int sa_count = (int) SPECPDL_INDEX (), sa_must_free = 0 /* SAFE_ALLOCA allocates a simple buffer. */ diff --git a/src/lread.c b/src/lread.c index b616e30c3c..a79ae18026 100644 --- a/src/lread.c +++ b/src/lread.c @@ -3739,7 +3739,7 @@ OBARRAY defaults to the value of the variable `obarray'. */) Also store the bucket number in oblookup_last_bucket_number. */ Lisp_Object -oblookup (Lisp_Object obarray, register const char *ptr, int size, int size_byte) +oblookup (Lisp_Object obarray, register const char *ptr, EMACS_INT size, EMACS_INT size_byte) { int hash; int obsize; -- 2.20.1