From 413d18e73de161f0618926ef73d170a7ef5c7a2f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 22 Sep 2010 12:03:34 -0400 Subject: [PATCH] Fix some uses of int instead of EMACS_INT. minibuf.c (Fminibuffer_contents) (Fminibuffer_contents_no_properties) (Fminibuffer_completion_contents): Use EMACS_INT for minibuffer positions. keyboard.c (command_loop_1): Use EMACS_INT to compare point with mark. alloc.c (make_uninit_string, make_uninit_multibyte_string) (allocate_string_data): Accept EMACS_INT for string length. editfns.c (Ffield_string, Ffield_string_no_properties) (make_buffer_string, make_buffer_string_both, Fbuffer_substring) (Fbuffer_substring_no_properties, find_field, Fdelete_field) (Ffield_string, Ffield_string_no_properties, Ffield_beginning) (Ffield_end): Use EMACS_INT for buffer positions. insdel.c (prepare_to_modify_buffer): Use EMACS_INT to compare point with mark. lisp.h (allocate_string_data, make_uninit_string) (make_uninit_multibyte_string, make_buffer_string) (make_buffer_string_both): Adjust prototypes. --- src/ChangeLog | 26 ++++++++++++++++++++++++++ src/alloc.c | 7 ++++--- src/editfns.c | 30 +++++++++++++++++------------- src/insdel.c | 4 ++-- src/keyboard.c | 5 +++-- src/lisp.h | 11 ++++++----- src/minibuf.c | 6 +++--- 7 files changed, 61 insertions(+), 28 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4b3e76f851..6bb13eaa08 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,29 @@ +2010-09-22 Eli Zaretskii + + * minibuf.c (Fminibuffer_contents) + (Fminibuffer_contents_no_properties) + (Fminibuffer_completion_contents): Use EMACS_INT for minibuffer + positions. + + * keyboard.c (command_loop_1): Use EMACS_INT to compare point with + mark. + + * alloc.c (make_uninit_string, make_uninit_multibyte_string) + (allocate_string_data): Accept EMACS_INT for string length. + + * editfns.c (Ffield_string, Ffield_string_no_properties) + (make_buffer_string, make_buffer_string_both, Fbuffer_substring) + (Fbuffer_substring_no_properties, find_field, Fdelete_field) + (Ffield_string, Ffield_string_no_properties, Ffield_beginning) + (Ffield_end): Use EMACS_INT for buffer positions. + + * insdel.c (prepare_to_modify_buffer): Use EMACS_INT to compare + point with mark. + + * lisp.h (allocate_string_data, make_uninit_string) + (make_uninit_multibyte_string, make_buffer_string) + (make_buffer_string_both): Adjust prototypes. + 2010-09-22 Chong Yidong * xml.c: Switch to GNU indentation. diff --git a/src/alloc.c b/src/alloc.c index 1f615a7d50..60b8016fb8 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1908,7 +1908,8 @@ allocate_string (void) S->data if it was initially non-null. */ void -allocate_string_data (struct Lisp_String *s, int nchars, int nbytes) +allocate_string_data (struct Lisp_String *s, + EMACS_INT nchars, EMACS_INT nbytes) { struct sdata *data, *old_data; struct sblock *b; @@ -2412,7 +2413,7 @@ build_string (const char *str) occupying LENGTH bytes. */ Lisp_Object -make_uninit_string (int length) +make_uninit_string (EMACS_INT length) { Lisp_Object val; @@ -2428,7 +2429,7 @@ make_uninit_string (int length) which occupy NBYTES bytes. */ Lisp_Object -make_uninit_multibyte_string (int nchars, int nbytes) +make_uninit_multibyte_string (EMACS_INT nchars, EMACS_INT nbytes) { Lisp_Object string; struct Lisp_String *s; diff --git a/src/editfns.c b/src/editfns.c index add2f37109..e78f301e43 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -94,7 +94,8 @@ extern Lisp_Object w32_get_internal_run_time (void); #endif static int tm_diff (struct tm *, struct tm *); -static void find_field (Lisp_Object, Lisp_Object, Lisp_Object, int *, Lisp_Object, int *); +static void find_field (Lisp_Object, Lisp_Object, Lisp_Object, + EMACS_INT *, Lisp_Object, EMACS_INT *); static void update_buffer_properties (int, int); static Lisp_Object region_limit (int); static size_t emacs_memftimeu (char *, size_t, const char *, @@ -515,7 +516,9 @@ get_pos_property (Lisp_Object position, register Lisp_Object prop, Lisp_Object o is not stored. */ static void -find_field (Lisp_Object pos, Lisp_Object merge_at_boundary, Lisp_Object beg_limit, int *beg, Lisp_Object end_limit, int *end) +find_field (Lisp_Object pos, Lisp_Object merge_at_boundary, + Lisp_Object beg_limit, + EMACS_INT *beg, Lisp_Object end_limit, EMACS_INT *end) { /* Fields right before and after the point. */ Lisp_Object before_field, after_field; @@ -631,7 +634,7 @@ A field is a region of text with the same `field' property. If POS is nil, the value of point is used for POS. */) (Lisp_Object pos) { - int beg, end; + EMACS_INT beg, end; find_field (pos, Qnil, Qnil, &beg, Qnil, &end); if (beg != end) del_range (beg, end); @@ -644,7 +647,7 @@ A field is a region of text with the same `field' property. If POS is nil, the value of point is used for POS. */) (Lisp_Object pos) { - int beg, end; + EMACS_INT beg, end; find_field (pos, Qnil, Qnil, &beg, Qnil, &end); return make_buffer_string (beg, end, 1); } @@ -655,7 +658,7 @@ A field is a region of text with the same `field' property. If POS is nil, the value of point is used for POS. */) (Lisp_Object pos) { - int beg, end; + EMACS_INT beg, end; find_field (pos, Qnil, Qnil, &beg, Qnil, &end); return make_buffer_string (beg, end, 0); } @@ -670,7 +673,7 @@ If LIMIT is non-nil, it is a buffer position; if the beginning of the field is before LIMIT, then LIMIT will be returned instead. */) (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit) { - int beg; + EMACS_INT beg; find_field (pos, escape_from_edge, limit, &beg, Qnil, 0); return make_number (beg); } @@ -685,7 +688,7 @@ If LIMIT is non-nil, it is a buffer position; if the end of the field is after LIMIT, then LIMIT will be returned instead. */) (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit) { - int end; + EMACS_INT end; find_field (pos, escape_from_edge, Qnil, 0, limit, &end); return make_number (end); } @@ -2343,10 +2346,10 @@ from adjoining text, if those properties are sticky. */) buffer substrings. */ Lisp_Object -make_buffer_string (int start, int end, int props) +make_buffer_string (EMACS_INT start, EMACS_INT end, int props) { - int start_byte = CHAR_TO_BYTE (start); - int end_byte = CHAR_TO_BYTE (end); + EMACS_INT start_byte = CHAR_TO_BYTE (start); + EMACS_INT end_byte = CHAR_TO_BYTE (end); return make_buffer_string_both (start, start_byte, end, end_byte, props); } @@ -2367,7 +2370,8 @@ make_buffer_string (int start, int end, int props) buffer substrings. */ Lisp_Object -make_buffer_string_both (int start, int start_byte, int end, int end_byte, int props) +make_buffer_string_both (EMACS_INT start, EMACS_INT start_byte, + EMACS_INT end, EMACS_INT end_byte, int props) { Lisp_Object result, tem, tem1; @@ -2439,7 +2443,7 @@ into the result string; if you don't want the text properties, use `buffer-substring-no-properties' instead. */) (Lisp_Object start, Lisp_Object end) { - register int b, e; + register EMACS_INT b, e; validate_region (&start, &end); b = XINT (start); @@ -2455,7 +2459,7 @@ The two arguments START and END are character positions; they can be in either order. */) (Lisp_Object start, Lisp_Object end) { - register int b, e; + register EMACS_INT b, e; validate_region (&start, &end); b = XINT (start); diff --git a/src/insdel.c b/src/insdel.c index 2ccc0b8eaa..fb26fe77ac 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -2057,8 +2057,8 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end, : (!NILP (Vselect_active_regions) && !NILP (Vtransient_mark_mode)))) { - int b = XINT (Fmarker_position (current_buffer->mark)); - int e = XINT (make_number (PT)); + EMACS_INT b = XINT (Fmarker_position (current_buffer->mark)); + EMACS_INT e = PT; if (b < e) Vsaved_region_selection = make_buffer_string (b, e, 0); else if (b > e) diff --git a/src/keyboard.c b/src/keyboard.c index eed031a3c2..4785036eda 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1811,8 +1811,9 @@ command_loop_1 (void) && !NILP (Vtransient_mark_mode))) && !EQ (Vthis_command, Qhandle_switch_frame)) { - int beg = XINT (Fmarker_position (current_buffer->mark)); - int end = XINT (make_number (PT)); + EMACS_INT beg = + XINT (Fmarker_position (current_buffer->mark)); + EMACS_INT end = PT; if (beg < end) call2 (Qx_set_selection, QPRIMARY, make_buffer_string (beg, end, 0)); diff --git a/src/lisp.h b/src/lisp.h index 781261d977..02cae0004f 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2692,7 +2692,7 @@ extern void memory_warnings (POINTER_TYPE *, void (*warnfun) (const char *)); /* Defined in alloc.c */ extern void check_pure_size (void); -extern void allocate_string_data (struct Lisp_String *, int, int); +extern void allocate_string_data (struct Lisp_String *, EMACS_INT, EMACS_INT); extern void reset_malloc_hooks (void); extern void uninterrupt_malloc (void); extern void malloc_warning (const char *); @@ -2722,8 +2722,8 @@ extern Lisp_Object make_string (const char *, int); extern Lisp_Object make_unibyte_string (const char *, int); extern Lisp_Object make_multibyte_string (const char *, int, int); extern Lisp_Object make_event_array (int, Lisp_Object *); -extern Lisp_Object make_uninit_string (int); -extern Lisp_Object make_uninit_multibyte_string (int, int); +extern Lisp_Object make_uninit_string (EMACS_INT); +extern Lisp_Object make_uninit_multibyte_string (EMACS_INT, EMACS_INT); extern Lisp_Object make_string_from_bytes (const char *, int, int); extern Lisp_Object make_specified_string (const char *, int, int, int); EXFUN (Fpurecopy, 1); @@ -2991,8 +2991,9 @@ EXFUN (Fuser_login_name, 1); EXFUN (Fsystem_name, 0); EXFUN (Fcurrent_time, 0); extern int clip_to_bounds (int, int, int); -extern Lisp_Object make_buffer_string (int, int, int); -extern Lisp_Object make_buffer_string_both (int, int, int, int, int); +extern Lisp_Object make_buffer_string (EMACS_INT, EMACS_INT, int); +extern Lisp_Object make_buffer_string_both (EMACS_INT, EMACS_INT, EMACS_INT, + EMACS_INT, int); extern void init_editfns (void); extern void syms_of_editfns (void); EXFUN (Fconstrain_to_field, 5); diff --git a/src/minibuf.c b/src/minibuf.c index 009d94c36a..2b21fa6a06 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -370,7 +370,7 @@ DEFUN ("minibuffer-contents", Fminibuffer_contents, If the current buffer is not a minibuffer, return its entire contents. */) (void) { - int prompt_end = XINT (Fminibuffer_prompt_end ()); + EMACS_INT prompt_end = XINT (Fminibuffer_prompt_end ()); return make_buffer_string (prompt_end, ZV, 1); } @@ -380,7 +380,7 @@ DEFUN ("minibuffer-contents-no-properties", Fminibuffer_contents_no_properties, If the current buffer is not a minibuffer, return its entire contents. */) (void) { - int prompt_end = XINT (Fminibuffer_prompt_end ()); + EMACS_INT prompt_end = XINT (Fminibuffer_prompt_end ()); return make_buffer_string (prompt_end, ZV, 0); } @@ -391,7 +391,7 @@ That is what completion commands operate on. If the current buffer is not a minibuffer, return its entire contents. */) (void) { - int prompt_end = XINT (Fminibuffer_prompt_end ()); + EMACS_INT prompt_end = XINT (Fminibuffer_prompt_end ()); if (PT < prompt_end) error ("Cannot do completion in the prompt"); return make_buffer_string (prompt_end, PT, 1); -- 2.20.1