From 7c752c8099915f10ec6e99d60ea20196111a94a1 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Wed, 5 Apr 2000 17:29:31 +0000 Subject: [PATCH] make_number/XINT/XUINT conversions; EQ/== fixes; ==Qnil -> NILP --- src/ChangeLog | 17 +++++++++++++++++ src/dispnew.c | 6 +++--- src/fileio.c | 4 ++-- src/fns.c | 6 +++--- src/keyboard.c | 4 ++-- src/lread.c | 2 +- src/minibuf.c | 26 +++++++++++++------------- src/print.c | 6 +++--- src/search.c | 2 +- src/term.c | 2 +- 10 files changed, 46 insertions(+), 29 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 19932e9d76c..4a7a96ee882 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,20 @@ +2000-04-05 Ken Raeburn + + * dispnew.c (allocate_matrices_for_frame_redisplay, + direct_output_forward_char): Use X(U)INT and make_number as needed + to convert between (unsigned) int values and lisp integers. + * keyboard.c (read_key_sequence): Likewise. + * lread.c (substitute_object_recurse): Likewise. + * fns.c (concat, hash_lookup, hash_remove): Likewise. + * minibuf.c (do_completion, Fminibuffer_complete_word, + Fminibuffer_completion_help): Likewise. + * term.c (produce_special_glyphs): Likewise. + + * fileio.c (Fwrite_region): Use EQ when comparing lisp objects. + * print.c (print_preprocess, print_object): Likewise. + + * search.c (compile_pattern): Use NILP when checking for nil. + 2000-04-04 Gerd Moellmann * window.c (compare_window_configurations): Signal an error diff --git a/src/dispnew.c b/src/dispnew.c index 00590605af2..1936501d947 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -1756,8 +1756,8 @@ allocate_matrices_for_frame_redisplay (window, x, y, ch_dim, /* Width and height MUST be chosen so that there are no holes in the frame matrix. */ - dim.width = w->width; - dim.height = w->height; + dim.width = XINT (w->width); + dim.height = XINT (w->height); /* Will matrix be re-allocated? */ if (x != w->desired_matrix->matrix_x @@ -3372,7 +3372,7 @@ direct_output_forward_char (n) struct glyph_row *row; /* Give up if point moved out of or into a composition. */ - if (check_point_in_composition (current_buffer, w->last_point, + if (check_point_in_composition (current_buffer, XINT (w->last_point), current_buffer, PT)) return 0; diff --git a/src/fileio.c b/src/fileio.c index b68ebfc5b71..3af7816fd5c 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4461,7 +4461,7 @@ This does code conversion according to the value of\n\ filename = Fexpand_file_name (filename, Qnil); - if (! NILP (mustbenew) && mustbenew != Qexcl) + if (! NILP (mustbenew) && !EQ (mustbenew, Qexcl)) barf_or_query_if_file_exists (filename, "overwrite", 1, 0, 1); if (STRINGP (visit)) @@ -4600,7 +4600,7 @@ This does code conversion according to the value of\n\ S_IREAD | S_IWRITE); #else /* not DOS_NT */ desc = emacs_open (fn, O_WRONLY | O_TRUNC | O_CREAT - | (mustbenew == Qexcl ? O_EXCL : 0), + | (EQ (mustbenew, Qexcl) ? O_EXCL : 0), auto_saving ? auto_save_mode_bits : 0666); #endif /* not DOS_NT */ #endif /* not VMS */ diff --git a/src/fns.c b/src/fns.c index 4d972320c81..ebbcf22914e 100644 --- a/src/fns.c +++ b/src/fns.c @@ -840,7 +840,7 @@ concat (nargs, args, target_type, last_special) { this = args[textprops[argnum].argnum]; copy_text_properties (make_number (textprops[argnum].from), - XSTRING (this)->size, this, + make_number (XSTRING (this)->size), this, make_number (textprops[argnum].to), val, Qnil); } } @@ -3950,7 +3950,7 @@ hash_lookup (h, key, hash) if (EQ (key, HASH_KEY (h, i)) || (h->cmpfn && h->cmpfn (h, key, hash_code, - HASH_KEY (h, i), HASH_HASH (h, i)))) + HASH_KEY (h, i), XUINT (HASH_HASH (h, i))))) break; idx = HASH_NEXT (h, i); } @@ -4017,7 +4017,7 @@ hash_remove (h, key) if (EQ (key, HASH_KEY (h, i)) || (h->cmpfn && h->cmpfn (h, key, hash_code, - HASH_KEY (h, i), HASH_HASH (h, i)))) + HASH_KEY (h, i), XUINT (HASH_HASH (h, i))))) { /* Take entry out of collision chain. */ if (NILP (prev)) diff --git a/src/keyboard.c b/src/keyboard.c index 1a9d751202e..9409b63242e 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -7863,8 +7863,8 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, pos = XCDR (string); string = XCAR (string); - if (pos >= 0 - && pos < XSTRING (string)->size + if (XINT (pos) >= 0 + && XINT (pos) < XSTRING (string)->size && (map = Fget_text_property (pos, Qlocal_map, string), !NILP (map))) diff --git a/src/lread.c b/src/lread.c index 5554eac193f..4d2895ca2e6 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2334,7 +2334,7 @@ substitute_object_recurse (object, placeholder, subtree) case Lisp_Vectorlike: { int i; - int length = Flength(subtree); + int length = XINT (Flength(subtree)); for (i = 0; i < length; i++) { Lisp_Object idx = make_number (i); diff --git a/src/minibuf.c b/src/minibuf.c index 1d576812022..cbc856e62dc 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1579,7 +1579,7 @@ do_completion () Lisp_Object last; struct gcpro gcpro1, gcpro2; - completion = Ftry_completion (Ffield_string (ZV), + completion = Ftry_completion (Ffield_string (make_number (ZV)), Vminibuffer_completion_table, Vminibuffer_completion_predicate); last = last_exact_completion; @@ -1602,7 +1602,7 @@ do_completion () } /* compiler bug */ - tem = Fstring_equal (completion, Ffield_string(ZV)); + tem = Fstring_equal (completion, Ffield_string(make_number (ZV))); completedp = NILP (tem); if (completedp) { @@ -1611,7 +1611,7 @@ do_completion () } /* It did find a match. Do we match some possibility exactly now? */ - tem = test_completion (Ffield_string(ZV)); + tem = test_completion (Ffield_string (make_number (ZV))); if (NILP (tem)) { /* not an exact match */ @@ -1635,7 +1635,7 @@ do_completion () last_exact_completion = completion; if (!NILP (last)) { - tem = Ffield_string (ZV); + tem = Ffield_string (make_number (ZV)); if (!NILP (Fequal (tem, last))) Fminibuffer_completion_help (); } @@ -1760,10 +1760,10 @@ a repetition of this command will exit.") Lisp_Object val; /* Allow user to specify null string */ - if (Ffield_beginning (ZV, Qnil) == ZV) + if (XINT (Ffield_beginning (make_number (ZV), Qnil)) == ZV) goto exit; - if (!NILP (test_completion (Ffield_string (ZV)))) + if (!NILP (test_completion (Ffield_string (make_number (ZV))))) goto exit; /* Call do_completion, but ignore errors. */ @@ -1811,7 +1811,7 @@ Return nil if there is no valid completion, else t.") /* We keep calling Fbuffer_string rather than arrange for GC to hold onto a pointer to one of the strings thus made. */ - completion = Ftry_completion (Ffield_string (ZV), + completion = Ftry_completion (Ffield_string (make_number (ZV)), Vminibuffer_completion_table, Vminibuffer_completion_predicate); if (NILP (completion)) @@ -1824,7 +1824,7 @@ Return nil if there is no valid completion, else t.") return Qnil; #if 0 /* How the below code used to look, for reference. */ - tem = Ffield_string (ZV); + tem = Ffield_string (make_number (ZV)); b = XSTRING (tem)->data; i = ZV - 1 - XSTRING (completion)->size; p = XSTRING (completion)->data; @@ -1843,7 +1843,7 @@ Return nil if there is no valid completion, else t.") int buffer_nchars, completion_nchars; CHECK_STRING (completion, 0); - tem = Ffield_string (ZV); + tem = Ffield_string (make_number (ZV)); GCPRO2 (completion, tem); /* If reading a file name, expand any $ENVVAR refs in the buffer and in TEM. */ @@ -1896,7 +1896,7 @@ Return nil if there is no valid completion, else t.") } #endif /* Rewritten code */ - prompt_end_charpos = Ffield_beginning (make_number (ZV), Qnil); + prompt_end_charpos = XINT (Ffield_beginning (make_number (ZV), Qnil)); { int prompt_end_bytepos; @@ -1910,7 +1910,7 @@ Return nil if there is no valid completion, else t.") if (i == XSTRING (completion)->size) { GCPRO1 (completion); - tem = Ftry_completion (concat2 (Ffield_string (ZV), build_string (" ")), + tem = Ftry_completion (concat2 (Ffield_string (make_number (ZV)), build_string (" ")), Vminibuffer_completion_table, Vminibuffer_completion_predicate); UNGCPRO; @@ -1921,7 +1921,7 @@ Return nil if there is no valid completion, else t.") { GCPRO1 (completion); tem = - Ftry_completion (concat2 (Ffield_string (ZV), build_string ("-")), + Ftry_completion (concat2 (Ffield_string (make_number (ZV)), build_string ("-")), Vminibuffer_completion_table, Vminibuffer_completion_predicate); UNGCPRO; @@ -2156,7 +2156,7 @@ DEFUN ("minibuffer-completion-help", Fminibuffer_completion_help, Sminibuffer_co Lisp_Object completions; message ("Making completion list..."); - completions = Fall_completions (Ffield_string (ZV), + completions = Fall_completions (Ffield_string (make_number (ZV)), Vminibuffer_completion_table, Vminibuffer_completion_predicate, Qt); diff --git a/src/print.c b/src/print.c index d56dcafbd64..6603525d3d8 100644 --- a/src/print.c +++ b/src/print.c @@ -1118,7 +1118,7 @@ print_preprocess (obj) if (! NILP (Vprint_circle) || SYMBOLP (obj)) { for (i = 0; i < print_number_index; i++) - if (PRINT_NUMBER_OBJECT (Vprint_number_table, i) == obj) + if (EQ (PRINT_NUMBER_OBJECT (Vprint_number_table, i), obj)) { /* OBJ appears more than once. Let's remember that. */ PRINT_NUMBER_STATUS (Vprint_number_table, i) = Qt; @@ -1218,7 +1218,7 @@ print_object (obj, printcharfun, escapeflag) /* With the print-circle feature. */ int i; for (i = 0; i < print_number_index; i++) - if (PRINT_NUMBER_OBJECT (Vprint_number_table, i) == obj) + if (EQ (PRINT_NUMBER_OBJECT (Vprint_number_table, i), obj)) { if (NILP (PRINT_NUMBER_STATUS (Vprint_number_table, i))) { @@ -1506,7 +1506,7 @@ print_object (obj, printcharfun, escapeflag) { int i; for (i = 0; i < print_number_index; i++) - if (PRINT_NUMBER_OBJECT (Vprint_number_table, i) == obj) + if (EQ (PRINT_NUMBER_OBJECT (Vprint_number_table, i), obj)) { if (NILP (PRINT_NUMBER_STATUS (Vprint_number_table, i))) { diff --git a/src/search.c b/src/search.c index eda4199915a..34dcc7e78a2 100644 --- a/src/search.c +++ b/src/search.c @@ -218,7 +218,7 @@ compile_pattern (pattern, regp, translate, posix, multibyte) XSTRING in those cases. However, compile_pattern_1 is only applied to the cache entry we pick here to reuse. So nil should never appear before a non-nil entry. */ - if (cp->regexp == Qnil) + if (NILP (cp->regexp)) goto compile_it; if (XSTRING (cp->regexp)->size == XSTRING (pattern)->size && !NILP (Fstring_equal (cp->regexp, pattern)) diff --git a/src/term.c b/src/term.c index 5ee942895fb..eaac25c6819 100644 --- a/src/term.c +++ b/src/term.c @@ -1893,7 +1893,7 @@ produce_special_glyphs (it, what) temp_it.dp = NULL; temp_it.what = IT_CHARACTER; temp_it.len = 1; - temp_it.object = 0; + temp_it.object = make_number (0); bzero (&temp_it.current, sizeof temp_it.current); if (what == IT_CONTINUATION) -- 2.39.5