Mercurial > emacs
changeset 18613:614b916ff5bf
Fix bugs with inappropriate mixing of Lisp_Object with int.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 04 Jul 1997 20:44:52 +0000 |
parents | 88efccff8970 |
children | a9bf61beded5 |
files | src/buffer.c src/casefiddle.c src/casetab.c src/category.c src/category.h src/ccl.c src/coding.c src/config.in src/editfns.c src/fileio.c src/fns.c src/indent.c src/intervals.c src/intervals.h src/keymap.c src/lisp.h src/minibuf.c src/print.c src/syntax.c src/syntax.h src/sysdep.c src/textprop.c |
diffstat | 22 files changed, 90 insertions(+), 64 deletions(-) [+] |
line wrap: on
line diff
--- a/src/buffer.c Fri Jul 04 20:43:49 1997 +0000 +++ b/src/buffer.c Fri Jul 04 20:44:52 1997 +0000 @@ -2789,6 +2789,8 @@ } +Lisp_Object Fdelete_overlay (); + DEFUN ("move-overlay", Fmove_overlay, Smove_overlay, 3, 4, 0, "Set the endpoints of OVERLAY to BEG and END in BUFFER.\n\ If BUFFER is omitted, leave OVERLAY in the same buffer it inhabits now.\n\ @@ -2839,13 +2841,13 @@ /* Redisplay where the overlay was. */ if (!NILP (obuffer)) { - Lisp_Object o_beg; - Lisp_Object o_end; + int o_beg; + int o_end; o_beg = OVERLAY_POSITION (OVERLAY_START (overlay)); o_end = OVERLAY_POSITION (OVERLAY_END (overlay)); - modify_overlay (ob, XINT (o_beg), XINT (o_end)); + modify_overlay (ob, o_beg, o_end); } /* Redisplay where the overlay is going to be. */ @@ -2854,22 +2856,21 @@ else /* Redisplay the area the overlay has just left, or just enclosed. */ { - Lisp_Object o_beg; - Lisp_Object o_end; + int o_beg, o_end; int change_beg, change_end; o_beg = OVERLAY_POSITION (OVERLAY_START (overlay)); o_end = OVERLAY_POSITION (OVERLAY_END (overlay)); - if (XINT (o_beg) == XINT (beg)) - modify_overlay (b, XINT (o_end), XINT (end)); - else if (XINT (o_end) == XINT (end)) - modify_overlay (b, XINT (o_beg), XINT (beg)); + if (o_beg == XINT (beg)) + modify_overlay (b, o_end, XINT (end)); + else if (o_end == XINT (end)) + modify_overlay (b, o_beg, XINT (beg)); else { - if (XINT (beg) < XINT (o_beg)) o_beg = beg; - if (XINT (end) > XINT (o_end)) o_end = end; - modify_overlay (b, XINT (o_beg), XINT (o_end)); + if (XINT (beg) < o_beg) o_beg = XINT (beg); + if (XINT (end) > o_end) o_end = XINT (end); + modify_overlay (b, o_beg, o_end); } }
--- a/src/casefiddle.c Fri Jul 04 20:43:49 1997 +0000 +++ b/src/casefiddle.c Fri Jul 04 20:44:52 1997 +0000 @@ -47,12 +47,12 @@ { if (INTEGERP (obj)) { - c = DOWNCASE (obj); + c = DOWNCASE (XFASTINT (obj)); if (inword) XSETFASTINT (obj, c); else if (c == XFASTINT (obj)) { - c = UPCASE1 (obj); + c = UPCASE1 (XFASTINT (obj)); XSETFASTINT (obj, c); } return obj;
--- a/src/casetab.c Fri Jul 04 20:43:49 1997 +0000 +++ b/src/casetab.c Fri Jul 04 20:44:52 1997 +0000 @@ -31,7 +31,8 @@ /* Used as a temporary in DOWNCASE and other macros in lisp.h. No need to mark it, since it is used only very temporarily. */ -Lisp_Object case_temp1, case_temp2; +int case_temp1; +Lisp_Object case_temp2; static void set_canon (); static void set_identity (); @@ -207,7 +208,7 @@ shuffle (table, c, elt) Lisp_Object table, c, elt; { - if (NATNUMP (elt) && c != elt) + if (NATNUMP (elt) && !EQ (c, elt)) { Lisp_Object tem = Faref (table, elt); Faset (table, elt, c);
--- a/src/category.c Fri Jul 04 20:43:49 1997 +0000 +++ b/src/category.c Fri Jul 04 20:44:52 1997 +0000 @@ -574,8 +574,8 @@ if (CONSP (elt) && CATEGORYP (XCONS (elt)->car) && CATEGORYP (XCONS (elt)->cdr) - && CATEGORY_MEMBER (XCONS (elt)->car, category_set1) - && CATEGORY_MEMBER (XCONS (elt)->cdr, category_set2)) + && CATEGORY_MEMBER (XFASTINT (XCONS (elt)->car), category_set1) + && CATEGORY_MEMBER (XFASTINT (XCONS (elt)->cdr), category_set2)) return !default_result; } return default_result;
--- a/src/category.h Fri Jul 04 20:43:49 1997 +0000 +++ b/src/category.h Fri Jul 04 20:44:52 1997 +0000 @@ -79,9 +79,8 @@ /* Return 1 if CATEGORY_SET contains CATEGORY, else return 0. The faster version of `!NILP (Faref (category_set, category))'. */ #define CATEGORY_MEMBER(category, category_set) \ - (!NILP (category_set) \ - && (XCATEGORY_SET (category_set)->data[XFASTINT (category) / 8] \ - & (1 << (XFASTINT (category) % 8)))) + (XCATEGORY_SET (category_set)->data[(category) / 8] \ + & (1 << ((category) % 8))) /* Temporary internal variable used in macro CHAR_HAS_CATEGORY. */ extern Lisp_Object _temp_category_set; @@ -106,14 +105,16 @@ table = XCHAR_TABLE (table)->parent; \ else \ temp = Faref (table, \ - COMPOSITE_CHAR_P (c) ? cmpchar_component (c, 0) : (c)); \ + make_number (COMPOSITE_CHAR_P (c) \ + ? cmpchar_component (c, 0) : (c))); \ temp; }) #else #define CATEGORY_SET(c) \ ((c) < CHAR_TABLE_SINGLE_BYTE_SLOTS \ ? Faref (current_buffer->category_table, make_number ((unsigned char) c)) \ : Faref (current_buffer->category_table, \ - COMPOSITE_CHAR_P (c) ? cmpchar_component ((c), 0) : (c))) + make_number (COMPOSITE_CHAR_P (c) \ + ? cmpchar_component ((c), 0) : (c)))) #endif /* Return the doc string of CATEGORY in category table TABLE. */
--- a/src/ccl.c Fri Jul 04 20:43:49 1997 +0000 +++ b/src/ccl.c Fri Jul 04 20:44:52 1997 +0000 @@ -654,7 +654,7 @@ case CCL_WriteArrayReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */ i = reg[rrr]; - j = ccl_prog[ic]; + j = XINT (ccl_prog[ic]); if ((unsigned int) i < j) { i = XINT (ccl_prog[ic + 1 + i]);
--- a/src/coding.c Fri Jul 04 20:43:49 1997 +0000 +++ b/src/coding.c Fri Jul 04 20:44:52 1997 +0000 @@ -702,7 +702,9 @@ /* Set designation state into CODING. */ #define DECODE_DESIGNATION(reg, dimension, chars, final_char) \ do { \ - int charset = ISO_CHARSET_TABLE (dimension, chars, final_char); \ + int charset = ISO_CHARSET_TABLE (make_number (dimension), \ + make_number (chars), \ + make_number (final_char)); \ if (charset >= 0) \ { \ if (coding->direction == 1 \ @@ -3515,9 +3517,10 @@ || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) error ("Invalid %dth argument", XINT (target_idx) + 1); - chain = (operation == Qinsert_file_contents || operation == Qwrite_region + chain = ((EQ (operation, Qinsert_file_contents) + || EQ (operation, Qwrite_region)) ? Vfile_coding_system_alist - : (operation == Qopen_network_stream + : (EQ (operation, Qopen_network_stream) ? Vnetwork_coding_system_alist : Vprocess_coding_system_alist)); if (NILP (chain))
--- a/src/config.in Fri Jul 04 20:43:49 1997 +0000 +++ b/src/config.in Fri Jul 04 20:44:52 1997 +0000 @@ -324,6 +324,7 @@ #ifdef emacs /* Don't do this for lib-src. */ /* Tell regex.c to use a type compatible with Emacs. */ #define RE_TRANSLATE_TYPE Lisp_Object * +#define RE_TRANSLATE(TBL, C) XINT ((TBL)[C]) #endif /* Avoid link-time collision with system mktime if we will use our own. */
--- a/src/editfns.c Fri Jul 04 20:43:49 1997 +0000 +++ b/src/editfns.c Fri Jul 04 20:44:52 1997 +0000 @@ -981,7 +981,7 @@ char *tzstring; char **oldenv = environ, **newenv; - if (zone == Qt) + if (EQ (zone, Qt)) tzstring = "UTC0"; else if (STRINGP (zone)) tzstring = (char *) XSTRING (zone)->data; @@ -1146,7 +1146,7 @@ if (NILP (tz)) tzstring = 0; - else if (tz == Qt) + else if (EQ (tz, Qt)) tzstring = "UTC0"; else {
--- a/src/fileio.c Fri Jul 04 20:43:49 1997 +0000 +++ b/src/fileio.c Fri Jul 04 20:44:52 1997 +0000 @@ -3726,6 +3726,7 @@ } static Lisp_Object build_annotations (); +extern Lisp_Object Ffile_locked_p (); /* If build_annotations switched buffers, switch back to BUF. Kill the temporary buffer that was selected in the meantime. @@ -5065,7 +5066,7 @@ This variable affects the built-in functions only on Windows,\n\ on other platforms, it is initialized so that Lisp code can find out\n\ what the normal separator is."); - Vdirectory_sep_char = '/'; + XSETFASTINT (Vdirectory_sep_char, '/'); DEFVAR_LISP ("file-name-handler-alist", &Vfile_name_handler_alist, "*Alist of elements (REGEXP . HANDLER) for file names handled specially.\n\
--- a/src/fns.c Fri Jul 04 20:43:49 1997 +0000 +++ b/src/fns.c Fri Jul 04 20:44:52 1997 +0000 @@ -584,7 +584,7 @@ size = XVECTOR (string)->size; if (NILP (to)) - to = size; + XSETINT (to, size); else CHECK_NUMBER (to, 2); @@ -1185,6 +1185,8 @@ return 0; } +extern Lisp_Object Fmake_char_internal (); + DEFUN ("fillarray", Ffillarray, Sfillarray, 2, 2, 0, "Store each element of ARRAY with ITEM.\n\ ARRAY is a vector, string, char-table, or bool-vector.")
--- a/src/indent.c Fri Jul 04 20:43:49 1997 +0000 +++ b/src/indent.c Fri Jul 04 20:44:52 1997 +0000 @@ -208,8 +208,9 @@ int to; Lisp_Object window; { - Lisp_Object prop, position, end, overlay_limit, proplimit; + Lisp_Object prop, position, overlay_limit, proplimit; Lisp_Object buffer; + int end; XSETFASTINT (position, pos); XSETBUFFER (buffer, current_buffer); @@ -239,8 +240,8 @@ /* No matter what. don't go past next overlay change. */ if (XFASTINT (overlay_limit) < XFASTINT (proplimit)) proplimit = overlay_limit; - end = Fnext_single_property_change (position, Qinvisible, - buffer, proplimit); + end = XFASTINT (Fnext_single_property_change (position, Qinvisible, + buffer, proplimit)); /* Don't put the boundary in the middle of multibyte form if there is no actual property change. */ if (end == pos + 100 @@ -248,7 +249,7 @@ && end < ZV) while (pos < end && !CHAR_HEAD_P (POS_ADDR (end))) end--; - *next_boundary_p = XFASTINT (end); + *next_boundary_p = end; } /* if the `invisible' property is set, we can skip to the next property change */
--- a/src/intervals.c Fri Jul 04 20:43:49 1997 +0000 +++ b/src/intervals.c Fri Jul 04 20:44:52 1997 +0000 @@ -85,7 +85,7 @@ XSTRING (parent)->intervals = new; } - new->parent = (INTERVAL) parent; + new->parent = (INTERVAL) XFASTINT (parent); new->position = 1; return new; @@ -411,7 +411,7 @@ if (interval->parent == NULL_INTERVAL) return interval; - parent = (Lisp_Object) (interval->parent); + XSETFASTINT (parent, (EMACS_INT) interval->parent); interval = balance_an_interval (interval); if (BUFFERP (parent)) @@ -1130,10 +1130,10 @@ if (ROOT_INTERVAL_P (i)) { Lisp_Object owner; - owner = (Lisp_Object) i->parent; + XSETFASTINT (owner, (EMACS_INT) i->parent); parent = delete_node (i); if (! NULL_INTERVAL_P (parent)) - parent->parent = (INTERVAL) owner; + parent->parent = (INTERVAL) XFASTINT (owner); if (BUFFERP (owner)) BUF_INTERVALS (XBUFFER (owner)) = parent; @@ -1868,7 +1868,7 @@ if (! NILP (Vinhibit_point_motion_hooks)) /* If intangible is inhibited, always move point to POSITION. */ ; - else if (PT < position && pos < ZV) + else if (PT < position && XINT (pos) < ZV) { /* We want to move forward, so check the text before POSITION. */ @@ -1884,7 +1884,7 @@ intangible_propval)) pos = Fprevious_char_property_change (pos, Qnil); } - else if (pos > BEGV) + else if (XINT (pos) > BEGV) { /* We want to move backward, so check the text after POSITION. */ @@ -2010,7 +2010,7 @@ if (NULL_INTERVAL_P (interval_copy)) return; - interval_copy->parent = (INTERVAL) string; + interval_copy->parent = (INTERVAL) XFASTINT (string); XSTRING (string)->intervals = interval_copy; }
--- a/src/intervals.h Fri Jul 04 20:43:49 1997 +0000 +++ b/src/intervals.h Fri Jul 04 20:44:52 1997 +0000 @@ -37,9 +37,15 @@ /* True if an interval pointer is null, or is a Lisp_Buffer or Lisp_String pointer (meaning it points to the owner of this interval tree). */ +#ifdef NO_UNION_TYPE #define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL \ || BUFFERP ((Lisp_Object)(i)) \ || STRINGP ((Lisp_Object)(i))) +#else +#define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL \ + || BUFFERP ((Lisp_Object){(EMACS_INT)(i)}) \ + || STRINGP ((Lisp_Object){(EMACS_INT)(i)})) +#endif /* True if this interval has no right child. */ #define NULL_RIGHT_CHILD(i) ((i)->right == NULL_INTERVAL)
--- a/src/keymap.c Fri Jul 04 20:43:49 1997 +0000 +++ b/src/keymap.c Fri Jul 04 20:44:52 1997 +0000 @@ -538,8 +538,7 @@ key = Fcdr (object); if (INTEGERP (key) && (XINT (key) & meta_modifier)) { - object = access_keymap (map, make_number (meta_prefix_char), - 0, 0); + object = access_keymap (map, meta_prefix_char, 0, 0); map = get_keymap_1 (object, 0, autoload); object = access_keymap (map, make_number (XINT (key) & ~meta_modifier), @@ -1515,8 +1514,8 @@ element = thisseq; tem = Fvconcat (1, &element); - XVECTOR (tem)->contents[XINT (last)] - = XINT (elt) | meta_modifier; + XSETFASTINT (XVECTOR (tem)->contents[XINT (last)], + XINT (elt) | meta_modifier); /* This new sequence is the same length as thisseq, so stick it in the list right @@ -2746,7 +2745,7 @@ int starting_i; if (indices == 0) - indices = (Lisp_Object *) alloca (3 * sizeof (Lisp_Object)); + indices = (int *) alloca (3 * sizeof (int)); definition = Qnil;
--- a/src/lisp.h Fri Jul 04 20:43:49 1997 +0000 +++ b/src/lisp.h Fri Jul 04 20:44:52 1997 +0000 @@ -608,11 +608,11 @@ and 8-bit Europeans characters. For these characters, do not check validity of CT. Do not follow parent. */ #define CHAR_TABLE_REF(CT, IDX) \ - (XFASTINT (IDX) < CHAR_TABLE_SINGLE_BYTE_SLOTS \ - ? (!NILP (XCHAR_TABLE (CT)->contents[XFASTINT (IDX)])\ - ? XCHAR_TABLE (CT)->contents[XFASTINT (IDX)] \ + ((IDX) < CHAR_TABLE_SINGLE_BYTE_SLOTS \ + ? (!NILP (XCHAR_TABLE (CT)->contents[IDX]) \ + ? XCHAR_TABLE (CT)->contents[IDX] \ : XCHAR_TABLE (CT)->defalt) \ - : Faref (CT, IDX)) + : Faref (CT, make_number (IDX))) /* Equivalent to Faset (CT, IDX, VAL) with optimization for ASCII and 8-bit Europeans characters. Do not check validity of CT. */ @@ -1314,7 +1314,8 @@ #define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) /* Variables used locally in the following case handling macros. */ -extern Lisp_Object case_temp1, case_temp2; +extern int case_temp1; +extern Lisp_Object case_temp2; /* Current buffer's map from characters to lower-case characters. */ @@ -1484,6 +1485,7 @@ extern Lisp_Object Fsymbol_value (), find_symbol_value (), Fset (); extern Lisp_Object Fdefault_value (), Fset_default (), Fdefault_boundp (); extern Lisp_Object Fmake_local_variable (); +extern Lisp_Object Flocal_variable_if_set_p (); extern Lisp_Object Faref (), Faset (); @@ -1517,6 +1519,7 @@ /* Defined in coding.c */ extern Lisp_Object Fcoding_system_p (), Fcheck_coding_system (); extern Lisp_Object Fread_coding_system (), Fread_non_nil_coding_system (); +extern Lisp_Object Ffind_coding_system (); /* Defined in syntax.c */ extern Lisp_Object Fforward_word (); @@ -1539,6 +1542,8 @@ extern Lisp_Object Fcopy_alist (); extern Lisp_Object Fplist_get (); extern Lisp_Object Fset_char_table_parent (); +extern Lisp_Object Fchar_table_extra_slot (); +extern Lisp_Object Frassoc (); /* Defined in insdel.c */ extern void move_gap (); @@ -1675,6 +1680,7 @@ extern Lisp_Object save_excursion_restore (), save_restriction_restore (); extern Lisp_Object Fchar_to_string (); extern Lisp_Object Fdelete_region (), Fnarrow_to_region (), Fwiden (); +extern Lisp_Object Fuser_login_name (), Fsystem_name (); /* defined in buffer.c */ extern Lisp_Object Foverlay_start (), Foverlay_end (); @@ -1695,6 +1701,7 @@ extern Lisp_Object Qoverlayp; extern Lisp_Object get_truename_buffer (); extern struct buffer *all_buffers; +extern Lisp_Object Fprevious_overlay_change (); /* defined in marker.c */ @@ -1719,6 +1726,7 @@ extern Lisp_Object Funhandled_file_name_directory (); extern Lisp_Object Ffile_directory_p (); extern Lisp_Object Fwrite_region (); +extern Lisp_Object Ffile_readable_p (), Ffile_executable_p (); /* Defined in abbrev.c */ @@ -1788,6 +1796,7 @@ /* defined in indent.c */ extern Lisp_Object Fvertical_motion (), Findent_to (), Fcurrent_column (); +extern Lisp_Object Fmove_to_column (); /* defined in window.c */ extern Lisp_Object Qwindowp, Qwindow_live_p; @@ -1838,6 +1847,7 @@ extern Lisp_Object Fset_frame_position (); extern Lisp_Object Fraise_frame (); extern Lisp_Object Fredirect_frame_focus (); +extern Lisp_Object frame_buffer_list (); /* defined in emacs.c */ extern Lisp_Object decode_env_path (); @@ -1891,6 +1901,8 @@ extern Lisp_Object Fget_text_property (), Fput_text_property (); extern Lisp_Object Fset_text_properties (); extern Lisp_Object Ftext_property_not_all (); +extern Lisp_Object Fprevious_char_property_change (); +extern Lisp_Object Fnext_char_property_change (); /* defined in intervals.c */ extern Lisp_Object get_local_map ();
--- a/src/minibuf.c Fri Jul 04 20:43:49 1997 +0000 +++ b/src/minibuf.c Fri Jul 04 20:44:52 1997 +0000 @@ -956,7 +956,7 @@ if (completion_ignore_case) { - while (l && EQ (DOWNCASE (*s1++), DOWNCASE (*s2++))) + while (l && DOWNCASE (*s1++) == DOWNCASE (*s2++)) l--; } else
--- a/src/print.c Fri Jul 04 20:43:49 1997 +0000 +++ b/src/print.c Fri Jul 04 20:44:52 1997 +0000 @@ -1063,7 +1063,7 @@ else { if (CONSP (printed_gensyms)) - XSETFASTINT (tem, XCDR (XCAR (printed_gensyms)) + 1); + XSETFASTINT (tem, XFASTINT (XCDR (XCAR (printed_gensyms))) + 1); else XSETFASTINT (tem, 1); printed_gensyms = Fcons (Fcons (obj, tem), printed_gensyms);
--- a/src/syntax.c Fri Jul 04 20:43:49 1997 +0000 +++ b/src/syntax.c Fri Jul 04 20:44:52 1997 +0000 @@ -190,7 +190,7 @@ gl_state.current_syntax_table = tmp_table; gl_state.old_prop = tmp_table; - if (Fsyntax_table_p (tmp_table) == Qt) + if (EQ (Fsyntax_table_p (tmp_table), Qt)) { gl_state.use_global = 0; } @@ -665,7 +665,7 @@ char_int = XINT (character); code = SYNTAX (char_int); if (code == Sopen || code == Sclose) - return make_number (SYNTAX_MATCH (char_int)); + return SYNTAX_MATCH (char_int); return Qnil; } @@ -735,7 +735,7 @@ p = XSTRING (newentry)->data; code = (enum syntaxcode) syntax_spec_code[*p++]; if (((int) code & 0377) == 0377) - error ("invalid syntax description letter: %c", XINT (c)); + error ("invalid syntax description letter: %c", p[-1]); if (code == Sinherit) {
--- a/src/syntax.h Fri Jul 04 20:43:49 1997 +0000 +++ b/src/syntax.h Fri Jul 04 20:44:52 1997 +0000 @@ -134,7 +134,7 @@ ({ Lisp_Object temp; \ temp = SYNTAX_ENTRY (c); \ (CONSP (temp) \ - ? XINT (XCONS (temp)->cdr) \ + ? XCONS (temp)->cdr \ : Qnil); }) #else #define SYNTAX(c) \ @@ -152,7 +152,7 @@ #define SYNTAX_MATCH(c) \ (syntax_temp = SYNTAX_ENTRY ((c)), \ (CONSP (syntax_temp) \ - ? XINT (XCONS (syntax_temp)->cdr) \ + ? XCONS (syntax_temp)->cdr \ : Qnil)) #endif
--- a/src/sysdep.c Fri Jul 04 20:43:49 1997 +0000 +++ b/src/sysdep.c Fri Jul 04 20:44:52 1997 +0000 @@ -1283,7 +1283,7 @@ tty = old_tty; #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) - Vtty_erase_char = old_tty.main.c_cc[VERASE]; + XSETINT (Vtty_erase_char, old_tty.main.c_cc[VERASE]); #ifdef DGUX /* This allows meta to be sent on 8th bit. */
--- a/src/textprop.c Fri Jul 04 20:43:49 1997 +0000 +++ b/src/textprop.c Fri Jul 04 20:44:52 1997 +0000 @@ -1739,13 +1739,11 @@ Lisp_Object start, end; { if (! NILP (interval_insert_behind_hooks)) - call_mod_hooks (interval_insert_behind_hooks, - make_number (start), make_number (end)); + call_mod_hooks (interval_insert_behind_hooks, start, end); if (! NILP (interval_insert_in_front_hooks) && ! EQ (interval_insert_in_front_hooks, interval_insert_behind_hooks)) - call_mod_hooks (interval_insert_in_front_hooks, - make_number (start), make_number (end)); + call_mod_hooks (interval_insert_in_front_hooks, start, end); } void