diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 18 | ||||
| -rw-r--r-- | src/alloc.c | 7 | ||||
| -rw-r--r-- | src/callint.c | 3 | ||||
| -rw-r--r-- | src/coding.c | 2 | ||||
| -rw-r--r-- | src/dispnew.c | 10 | ||||
| -rw-r--r-- | src/eval.c | 7 | ||||
| -rw-r--r-- | src/fileio.c | 40 | ||||
| -rw-r--r-- | src/fns.c | 4 | ||||
| -rw-r--r-- | src/font.c | 4 | ||||
| -rw-r--r-- | src/lisp.h | 10 | ||||
| -rw-r--r-- | src/xdisp.c | 8 |
11 files changed, 49 insertions, 64 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e5e4fe9edb0..8f23dd3833e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,21 @@ | |||
| 1 | 2015-01-22 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Don't downcase system diagnostics' first letters | ||
| 4 | * fileio.c (report_file_errno): Don't downcase, and simplify. | ||
| 5 | Fixes: bug#19642 | ||
| 6 | |||
| 7 | Isolate NIL_IS_ZERO-assuming code better | ||
| 8 | Suggested by Stefan Monnier in: | ||
| 9 | http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00588.html | ||
| 10 | * alloc.c (allocate_pseudovector): | ||
| 11 | Use memclear, not memsetnil, to remove a 'verify'. | ||
| 12 | * callint.c (Fcall_interactively): | ||
| 13 | * dispnew.c (realloc_glyph_pool): | ||
| 14 | * xdisp.c (init_iterator): | ||
| 15 | Use memclear, not memset, to remove a 'verify'. | ||
| 16 | * lisp.h (memclear): Rename from memsetnil, and take a byte | ||
| 17 | count rather than a word count. All callers changed. | ||
| 18 | |||
| 1 | 2015-01-20 Paul Eggert <eggert@cs.ucla.edu> | 19 | 2015-01-20 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 20 | ||
| 3 | Undo port to hypothetical nonzero Qnil case | 21 | Undo port to hypothetical nonzero Qnil case |
diff --git a/src/alloc.c b/src/alloc.c index bf0456c6862..571b2b03a29 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -3174,11 +3174,8 @@ allocate_pseudovector (int memlen, int lisplen, | |||
| 3174 | eassert (memlen - lisplen <= (1 << PSEUDOVECTOR_REST_BITS) - 1); | 3174 | eassert (memlen - lisplen <= (1 << PSEUDOVECTOR_REST_BITS) - 1); |
| 3175 | eassert (lisplen <= (1 << PSEUDOVECTOR_SIZE_BITS) - 1); | 3175 | eassert (lisplen <= (1 << PSEUDOVECTOR_SIZE_BITS) - 1); |
| 3176 | 3176 | ||
| 3177 | /* Only the first LISPLEN slots will be traced normally by the GC. | 3177 | /* Only the first LISPLEN slots will be traced normally by the GC. */ |
| 3178 | Since Qnil == 0, we can memset Lisp and non-Lisp data at one go. */ | 3178 | memclear (v->contents, zerolen * word_size); |
| 3179 | verify (NIL_IS_ZERO); | ||
| 3180 | memsetnil (v->contents, zerolen); | ||
| 3181 | |||
| 3182 | XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen); | 3179 | XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen); |
| 3183 | return v; | 3180 | return v; |
| 3184 | } | 3181 | } |
diff --git a/src/callint.c b/src/callint.c index 3a595b57d77..165d374dd62 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -509,8 +509,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 509 | visargs = args + nargs; | 509 | visargs = args + nargs; |
| 510 | varies = (signed char *) (visargs + nargs); | 510 | varies = (signed char *) (visargs + nargs); |
| 511 | 511 | ||
| 512 | verify (NIL_IS_ZERO); | 512 | memclear (args, nargs * (2 * word_size + 1)); |
| 513 | memset (args, 0, nargs * (2 * word_size + 1)); | ||
| 514 | 513 | ||
| 515 | GCPRO5 (prefix_arg, function, *args, *visargs, up_event); | 514 | GCPRO5 (prefix_arg, function, *args, *visargs, up_event); |
| 516 | gcpro3.nvars = nargs; | 515 | gcpro3.nvars = nargs; |
diff --git a/src/coding.c b/src/coding.c index b95c0a5f825..43ebbe06856 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -11273,7 +11273,7 @@ internal character representation. */); | |||
| 11273 | 11273 | ||
| 11274 | { | 11274 | { |
| 11275 | Lisp_Object args[coding_arg_undecided_max]; | 11275 | Lisp_Object args[coding_arg_undecided_max]; |
| 11276 | memsetnil (args, ARRAYELTS (args)); | 11276 | memclear (args, sizeof args); |
| 11277 | 11277 | ||
| 11278 | Lisp_Object plist[16]; | 11278 | Lisp_Object plist[16]; |
| 11279 | plist[0] = intern_c_string (":name"); | 11279 | plist[0] = intern_c_string (":name"); |
diff --git a/src/dispnew.c b/src/dispnew.c index 8c48ae065ac..e614ceef122 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -1343,14 +1343,8 @@ realloc_glyph_pool (struct glyph_pool *pool, struct dim matrix_dim) | |||
| 1343 | ptrdiff_t old_nglyphs = pool->nglyphs; | 1343 | ptrdiff_t old_nglyphs = pool->nglyphs; |
| 1344 | pool->glyphs = xpalloc (pool->glyphs, &pool->nglyphs, | 1344 | pool->glyphs = xpalloc (pool->glyphs, &pool->nglyphs, |
| 1345 | needed - old_nglyphs, -1, sizeof *pool->glyphs); | 1345 | needed - old_nglyphs, -1, sizeof *pool->glyphs); |
| 1346 | 1346 | memclear (pool->glyphs + old_nglyphs, | |
| 1347 | /* Redisplay relies on nil as the object of special glyphs | 1347 | (pool->nglyphs - old_nglyphs) * sizeof *pool->glyphs); |
| 1348 | (truncation and continuation glyphs and also blanks used to | ||
| 1349 | extend each line on a TTY), so verify that memset does this. */ | ||
| 1350 | verify (NIL_IS_ZERO); | ||
| 1351 | |||
| 1352 | memset (pool->glyphs + old_nglyphs, 0, | ||
| 1353 | (pool->nglyphs - old_nglyphs) * sizeof *pool->glyphs); | ||
| 1354 | } | 1348 | } |
| 1355 | 1349 | ||
| 1356 | /* Remember the number of rows and columns because (a) we use them | 1350 | /* Remember the number of rows and columns because (a) we use them |
diff --git a/src/eval.c b/src/eval.c index ddf6535cabc..e649c152a5d 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -2299,7 +2299,8 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2299 | /* Avoid making funcall cons up a yet another new vector of arguments | 2299 | /* Avoid making funcall cons up a yet another new vector of arguments |
| 2300 | by explicitly supplying nil's for optional values. */ | 2300 | by explicitly supplying nil's for optional values. */ |
| 2301 | SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args); | 2301 | SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args); |
| 2302 | memsetnil (funcall_args + numargs + 1, XSUBR (fun)->max_args - numargs); | 2302 | memclear (funcall_args + numargs + 1, |
| 2303 | (XSUBR (fun)->max_args - numargs) * word_size); | ||
| 2303 | funcall_nargs = 1 + XSUBR (fun)->max_args; | 2304 | funcall_nargs = 1 + XSUBR (fun)->max_args; |
| 2304 | } | 2305 | } |
| 2305 | else | 2306 | else |
| @@ -2693,8 +2694,8 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 2693 | eassert (XSUBR (fun)->max_args <= ARRAYELTS (internal_argbuf)); | 2694 | eassert (XSUBR (fun)->max_args <= ARRAYELTS (internal_argbuf)); |
| 2694 | internal_args = internal_argbuf; | 2695 | internal_args = internal_argbuf; |
| 2695 | memcpy (internal_args, args + 1, numargs * word_size); | 2696 | memcpy (internal_args, args + 1, numargs * word_size); |
| 2696 | memsetnil (internal_args + numargs, | 2697 | memclear (internal_args + numargs, |
| 2697 | XSUBR (fun)->max_args - numargs); | 2698 | (XSUBR (fun)->max_args - numargs) * word_size); |
| 2698 | } | 2699 | } |
| 2699 | else | 2700 | else |
| 2700 | internal_args = args + 1; | 2701 | internal_args = args + 1; |
diff --git a/src/fileio.c b/src/fileio.c index ff6720d4ae2..d0fd08a742e 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -186,37 +186,17 @@ void | |||
| 186 | report_file_errno (char const *string, Lisp_Object name, int errorno) | 186 | report_file_errno (char const *string, Lisp_Object name, int errorno) |
| 187 | { | 187 | { |
| 188 | Lisp_Object data = CONSP (name) || NILP (name) ? name : list1 (name); | 188 | Lisp_Object data = CONSP (name) || NILP (name) ? name : list1 (name); |
| 189 | Lisp_Object errstring; | ||
| 190 | char *str; | ||
| 191 | |||
| 192 | synchronize_system_messages_locale (); | 189 | synchronize_system_messages_locale (); |
| 193 | str = strerror (errorno); | 190 | char *str = strerror (errorno); |
| 194 | errstring = code_convert_string_norecord (build_unibyte_string (str), | 191 | Lisp_Object errstring |
| 195 | Vlocale_coding_system, 0); | 192 | = code_convert_string_norecord (build_unibyte_string (str), |
| 196 | 193 | Vlocale_coding_system, 0); | |
| 197 | while (1) | 194 | Lisp_Object errdata = Fcons (errstring, data); |
| 198 | switch (errorno) | 195 | |
| 199 | { | 196 | if (errorno == EEXIST) |
| 200 | case EEXIST: | 197 | xsignal (Qfile_already_exists, errdata); |
| 201 | xsignal (Qfile_already_exists, Fcons (errstring, data)); | 198 | else |
| 202 | break; | 199 | xsignal (Qfile_error, Fcons (build_string (string), errdata)); |
| 203 | default: | ||
| 204 | /* System error messages are capitalized. Downcase the initial | ||
| 205 | unless it is followed by a slash. (The slash case caters to | ||
| 206 | error messages that begin with "I/O" or, in German, "E/A".) */ | ||
| 207 | if (STRING_MULTIBYTE (errstring) | ||
| 208 | && ! EQ (Faref (errstring, make_number (1)), make_number ('/'))) | ||
| 209 | { | ||
| 210 | int c; | ||
| 211 | |||
| 212 | str = SSDATA (errstring); | ||
| 213 | c = STRING_CHAR ((unsigned char *) str); | ||
| 214 | Faset (errstring, make_number (0), make_number (downcase (c))); | ||
| 215 | } | ||
| 216 | |||
| 217 | xsignal (Qfile_error, | ||
| 218 | Fcons (build_string (string), Fcons (errstring, data))); | ||
| 219 | } | ||
| 220 | } | 200 | } |
| 221 | 201 | ||
| 222 | /* Signal a file-access failure that set errno. STRING describes the | 202 | /* Signal a file-access failure that set errno. STRING describes the |
| @@ -2524,7 +2524,7 @@ mapcar1 (EMACS_INT leni, Lisp_Object *vals, Lisp_Object fn, Lisp_Object seq) | |||
| 2524 | if (vals) | 2524 | if (vals) |
| 2525 | { | 2525 | { |
| 2526 | /* Don't let vals contain any garbage when GC happens. */ | 2526 | /* Don't let vals contain any garbage when GC happens. */ |
| 2527 | memsetnil (vals, leni); | 2527 | memclear (vals, leni * word_size); |
| 2528 | 2528 | ||
| 2529 | GCPRO3 (dummy, fn, seq); | 2529 | GCPRO3 (dummy, fn, seq); |
| 2530 | gcpro1.var = vals; | 2530 | gcpro1.var = vals; |
| @@ -3700,7 +3700,7 @@ larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max) | |||
| 3700 | new_size = old_size + incr; | 3700 | new_size = old_size + incr; |
| 3701 | v = allocate_vector (new_size); | 3701 | v = allocate_vector (new_size); |
| 3702 | memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents); | 3702 | memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents); |
| 3703 | memsetnil (v->contents + old_size, new_size - old_size); | 3703 | memclear (v->contents + old_size, incr * word_size); |
| 3704 | XSETVECTOR (vec, v); | 3704 | XSETVECTOR (vec, v); |
| 3705 | return vec; | 3705 | return vec; |
| 3706 | } | 3706 | } |
diff --git a/src/font.c b/src/font.c index 190b33a8ef0..d05742ce2bf 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -989,14 +989,14 @@ font_expand_wildcards (Lisp_Object *field, int n) | |||
| 989 | if (i == 0 || ! NILP (tmp[i - 1])) | 989 | if (i == 0 || ! NILP (tmp[i - 1])) |
| 990 | /* None of TMP[X] corresponds to Jth field. */ | 990 | /* None of TMP[X] corresponds to Jth field. */ |
| 991 | return -1; | 991 | return -1; |
| 992 | memsetnil (field + j, range[i].from - j); | 992 | memclear (field + j, (range[i].from - j) * word_size); |
| 993 | j = range[i].from; | 993 | j = range[i].from; |
| 994 | } | 994 | } |
| 995 | field[j++] = tmp[i]; | 995 | field[j++] = tmp[i]; |
| 996 | } | 996 | } |
| 997 | if (! NILP (tmp[n - 1]) && j < XLFD_REGISTRY_INDEX) | 997 | if (! NILP (tmp[n - 1]) && j < XLFD_REGISTRY_INDEX) |
| 998 | return -1; | 998 | return -1; |
| 999 | memsetnil (field + j, XLFD_LAST_INDEX - j); | 999 | memclear (field + j, (XLFD_LAST_INDEX - j) * word_size); |
| 1000 | if (INTEGERP (field[XLFD_ENCODING_INDEX])) | 1000 | if (INTEGERP (field[XLFD_ENCODING_INDEX])) |
| 1001 | field[XLFD_ENCODING_INDEX] | 1001 | field[XLFD_ENCODING_INDEX] |
| 1002 | = Fintern (Fnumber_to_string (field[XLFD_ENCODING_INDEX]), Qnil); | 1002 | = Fintern (Fnumber_to_string (field[XLFD_ENCODING_INDEX]), Qnil); |
diff --git a/src/lisp.h b/src/lisp.h index f1e6945f43a..76a9ed8f159 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1513,13 +1513,15 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) | |||
| 1513 | to find such assumptions later if we change Qnil to be nonzero. */ | 1513 | to find such assumptions later if we change Qnil to be nonzero. */ |
| 1514 | enum { NIL_IS_ZERO = XLI_BUILTIN_LISPSYM (iQnil) == 0 }; | 1514 | enum { NIL_IS_ZERO = XLI_BUILTIN_LISPSYM (iQnil) == 0 }; |
| 1515 | 1515 | ||
| 1516 | /* Set a Lisp_Object array V's N entries to nil. */ | 1516 | /* Clear the object addressed by P, with size NBYTES, so that all its |
| 1517 | bytes are zero and all its Lisp values are nil. */ | ||
| 1517 | INLINE void | 1518 | INLINE void |
| 1518 | memsetnil (Lisp_Object *v, ptrdiff_t n) | 1519 | memclear (void *p, ptrdiff_t nbytes) |
| 1519 | { | 1520 | { |
| 1520 | eassert (0 <= n); | 1521 | eassert (0 <= nbytes); |
| 1521 | verify (NIL_IS_ZERO); | 1522 | verify (NIL_IS_ZERO); |
| 1522 | memset (v, 0, n * sizeof *v); | 1523 | /* Since Qnil is zero, memset suffices. */ |
| 1524 | memset (p, 0, nbytes); | ||
| 1523 | } | 1525 | } |
| 1524 | 1526 | ||
| 1525 | /* If a struct is made to look like a vector, this macro returns the length | 1527 | /* If a struct is made to look like a vector, this macro returns the length |
diff --git a/src/xdisp.c b/src/xdisp.c index 5e57e0588cf..280be6bd7a1 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2752,13 +2752,7 @@ init_iterator (struct it *it, struct window *w, | |||
| 2752 | row = MATRIX_HEADER_LINE_ROW (w->desired_matrix); | 2752 | row = MATRIX_HEADER_LINE_ROW (w->desired_matrix); |
| 2753 | } | 2753 | } |
| 2754 | 2754 | ||
| 2755 | /* Clear IT. */ | 2755 | memclear (it, sizeof *it); |
| 2756 | |||
| 2757 | /* The code assumes it->object and other Lisp_Object components are | ||
| 2758 | set to nil, so verify that memset does this. */ | ||
| 2759 | verify (NIL_IS_ZERO); | ||
| 2760 | memset (it, 0, sizeof *it); | ||
| 2761 | |||
| 2762 | it->current.overlay_string_index = -1; | 2756 | it->current.overlay_string_index = -1; |
| 2763 | it->current.dpvec_index = -1; | 2757 | it->current.dpvec_index = -1; |
| 2764 | it->base_face_id = remapped_base_face_id; | 2758 | it->base_face_id = remapped_base_face_id; |