aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit8
-rw-r--r--src/ChangeLog46
-rw-r--r--src/buffer.c6
-rw-r--r--src/fileio.c102
-rw-r--r--src/lisp.h19
-rw-r--r--src/mem-limits.h2
-rw-r--r--src/syntax.c21
-rw-r--r--src/xterm.c26
8 files changed, 182 insertions, 48 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index fc8eab6d1df..7cd828733b1 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -254,8 +254,8 @@ define pitx
254 while ($i < $it->sp && $i < 4) 254 while ($i < $it->sp && $i < 4)
255 set $e = $it->stack[$i] 255 set $e = $it->stack[$i]
256 printf "stack[%d]: ", $i 256 printf "stack[%d]: ", $i
257 pitmethod $e->method 257 pitmethod $e.method
258 printf "[%d]", $e->position.charpos 258 printf "[%d]", $e.position.charpos
259 printf "\n" 259 printf "\n"
260 set $i = $i + 1 260 set $i = $i + 1
261 end 261 end
@@ -1259,7 +1259,9 @@ end
1259 1259
1260define xreload 1260define xreload
1261 set $tagmask = (((long)1 << gdb_gctypebits) - 1) 1261 set $tagmask = (((long)1 << gdb_gctypebits) - 1)
1262 set $valmask = gdb_use_lsb ? ~($tagmask) : ((long)1 << gdb_valbits) - 1 1262 # The consing_since_gc business widens the 1 to EMACS_INT,
1263 # a symbol not directly visible to GDB.
1264 set $valmask = gdb_use_lsb ? ~($tagmask) : ((consing_since_gc - consing_since_gc + 1) << gdb_valbits) - 1
1263end 1265end
1264document xreload 1266document xreload
1265 When starting Emacs a second time in the same gdb session under 1267 When starting Emacs a second time in the same gdb session under
diff --git a/src/ChangeLog b/src/ChangeLog
index 12b4fa97c33..5a376c4ad5b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,49 @@
12012-02-22 Chong Yidong <cyd@gnu.org>
2
3 * xterm.c (x_draw_image_relief): Add missing type check for
4 Vtool_bar_button_margin (Bug#10743).
5
62012-02-21 Chong Yidong <cyd@gnu.org>
7
8 * fileio.c (Vfile_name_handler_alist): Doc fix.
9
10 * buffer.c (Fget_file_buffer): Protect against invalid file
11 handler return value.
12
132012-02-20 Paul Eggert <eggert@cs.ucla.edu>
14
15 * .gdbinit (xreload): Don't assume EMACS_INT fits in 'long'
16 when computing $valmask.
17
18 Fix crash due to non-contiguous EMACS_INT (Bug#10780).
19 * lisp.h (VALBITS): Move definition up, so that USE_LSB_TAG can use it.
20 (USE_LSB_TAG): Do not define if UINTPTR_MAX >> VALBITS == 0.
21 It's useless in that case, and it can cause problems on hosts
22 that allocate halves of EMACS_INT values separately.
23 Reported by Dan HorĂ¡k. Diagnosed by Andreas Schwab in
24 <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10780#30>.
25 * mem-limits.h (EXCEEDS_LISP_PTR): Define to 0 on hosts where
26 UINTPTR_MAX >> VALBITS == 0. This is required by the above change;
27 it avoids undefined behavior on hosts where shifting right by more
28 than the word width has undefined behavior.
29
302012-02-19 Chong Yidong <cyd@gnu.org>
31
32 * fileio.c (Ffile_name_directory, Ffile_name_nondirectory)
33 (Funhandled_file_name_directory, Ffile_name_as_directory)
34 (Fdirectory_file_name, Fexpand_file_name)
35 (Fsubstitute_in_file_name): Protect against invalid file handler
36 return values (Bug#10845).
37
382012-02-18 Eli Zaretskii <eliz@gnu.org>
39
40 * .gdbinit (pitx): Fix incorrect references to fields of the
41 iterator stack.
42
432012-02-17 Chong Yidong <cyd@gnu.org>
44
45 * syntax.c (Fscan_lists): Doc fix (Bug#10833).
46
12012-02-15 Paul Eggert <eggert@cs.ucla.edu> 472012-02-15 Paul Eggert <eggert@cs.ucla.edu>
2 48
3 * image.c (MAX_IMAGE_SIZE): Increase from 6.0 to 10.0; see 49 * image.c (MAX_IMAGE_SIZE): Increase from 6.0 to 10.0; see
diff --git a/src/buffer.c b/src/buffer.c
index a6f61a1936a..71a5e199c6f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -272,7 +272,11 @@ See also `find-buffer-visiting'. */)
272 call the corresponding file handler. */ 272 call the corresponding file handler. */
273 handler = Ffind_file_name_handler (filename, Qget_file_buffer); 273 handler = Ffind_file_name_handler (filename, Qget_file_buffer);
274 if (!NILP (handler)) 274 if (!NILP (handler))
275 return call2 (handler, Qget_file_buffer, filename); 275 {
276 Lisp_Object handled_buf = call2 (handler, Qget_file_buffer,
277 filename);
278 return BUFFERP (handled_buf) ? handled_buf : Qnil;
279 }
276 280
277 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) 281 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
278 { 282 {
diff --git a/src/fileio.c b/src/fileio.c
index 9e940c9a324..839dc07b6ce 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -328,7 +328,11 @@ Given a Unix syntax file name, returns a string ending in slash. */)
328 call the corresponding file handler. */ 328 call the corresponding file handler. */
329 handler = Ffind_file_name_handler (filename, Qfile_name_directory); 329 handler = Ffind_file_name_handler (filename, Qfile_name_directory);
330 if (!NILP (handler)) 330 if (!NILP (handler))
331 return call2 (handler, Qfile_name_directory, filename); 331 {
332 Lisp_Object handled_name = call2 (handler, Qfile_name_directory,
333 filename);
334 return STRINGP (handled_name) ? handled_name : Qnil;
335 }
332 336
333 filename = FILE_SYSTEM_CASE (filename); 337 filename = FILE_SYSTEM_CASE (filename);
334#ifdef DOS_NT 338#ifdef DOS_NT
@@ -397,7 +401,13 @@ or the entire name if it contains no slash. */)
397 call the corresponding file handler. */ 401 call the corresponding file handler. */
398 handler = Ffind_file_name_handler (filename, Qfile_name_nondirectory); 402 handler = Ffind_file_name_handler (filename, Qfile_name_nondirectory);
399 if (!NILP (handler)) 403 if (!NILP (handler))
400 return call2 (handler, Qfile_name_nondirectory, filename); 404 {
405 Lisp_Object handled_name = call2 (handler, Qfile_name_nondirectory,
406 filename);
407 if (STRINGP (handled_name))
408 return handled_name;
409 error ("Invalid handler in `file-name-handler-alist'");
410 }
401 411
402 beg = SSDATA (filename); 412 beg = SSDATA (filename);
403 end = p = beg + SBYTES (filename); 413 end = p = beg + SBYTES (filename);
@@ -434,7 +444,11 @@ get a current directory to run processes in. */)
434 call the corresponding file handler. */ 444 call the corresponding file handler. */
435 handler = Ffind_file_name_handler (filename, Qunhandled_file_name_directory); 445 handler = Ffind_file_name_handler (filename, Qunhandled_file_name_directory);
436 if (!NILP (handler)) 446 if (!NILP (handler))
437 return call2 (handler, Qunhandled_file_name_directory, filename); 447 {
448 Lisp_Object handled_name = call2 (handler, Qunhandled_file_name_directory,
449 filename);
450 return STRINGP (handled_name) ? handled_name : Qnil;
451 }
438 452
439 return Ffile_name_directory (filename); 453 return Ffile_name_directory (filename);
440} 454}
@@ -488,7 +502,13 @@ For a Unix-syntax file name, just appends a slash. */)
488 call the corresponding file handler. */ 502 call the corresponding file handler. */
489 handler = Ffind_file_name_handler (file, Qfile_name_as_directory); 503 handler = Ffind_file_name_handler (file, Qfile_name_as_directory);
490 if (!NILP (handler)) 504 if (!NILP (handler))
491 return call2 (handler, Qfile_name_as_directory, file); 505 {
506 Lisp_Object handled_name = call2 (handler, Qfile_name_as_directory,
507 file);
508 if (STRINGP (handled_name))
509 return handled_name;
510 error ("Invalid handler in `file-name-handler-alist'");
511 }
492 512
493 buf = (char *) alloca (SBYTES (file) + 10); 513 buf = (char *) alloca (SBYTES (file) + 10);
494 file_name_as_directory (buf, SSDATA (file)); 514 file_name_as_directory (buf, SSDATA (file));
@@ -547,7 +567,13 @@ In Unix-syntax, this function just removes the final slash. */)
547 call the corresponding file handler. */ 567 call the corresponding file handler. */
548 handler = Ffind_file_name_handler (directory, Qdirectory_file_name); 568 handler = Ffind_file_name_handler (directory, Qdirectory_file_name);
549 if (!NILP (handler)) 569 if (!NILP (handler))
550 return call2 (handler, Qdirectory_file_name, directory); 570 {
571 Lisp_Object handled_name = call2 (handler, Qdirectory_file_name,
572 directory);
573 if (STRINGP (handled_name))
574 return handled_name;
575 error ("Invalid handler in `file-name-handler-alist'");
576 }
551 577
552 buf = (char *) alloca (SBYTES (directory) + 20); 578 buf = (char *) alloca (SBYTES (directory) + 20);
553 directory_file_name (SSDATA (directory), buf); 579 directory_file_name (SSDATA (directory), buf);
@@ -747,7 +773,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
747 int is_escaped = 0; 773 int is_escaped = 0;
748#endif /* DOS_NT */ 774#endif /* DOS_NT */
749 ptrdiff_t length; 775 ptrdiff_t length;
750 Lisp_Object handler, result; 776 Lisp_Object handler, result, handled_name;
751 int multibyte; 777 int multibyte;
752 Lisp_Object hdir; 778 Lisp_Object hdir;
753 779
@@ -757,7 +783,14 @@ filesystem tree, not (expand-file-name ".." dirname). */)
757 call the corresponding file handler. */ 783 call the corresponding file handler. */
758 handler = Ffind_file_name_handler (name, Qexpand_file_name); 784 handler = Ffind_file_name_handler (name, Qexpand_file_name);
759 if (!NILP (handler)) 785 if (!NILP (handler))
760 return call3 (handler, Qexpand_file_name, name, default_directory); 786 {
787 handled_name = call3 (handler, Qexpand_file_name,
788 name, default_directory);
789 if (STRINGP (handled_name))
790 return handled_name;
791 error ("Invalid handler in `file-name-handler-alist'");
792 }
793
761 794
762 /* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */ 795 /* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */
763 if (NILP (default_directory)) 796 if (NILP (default_directory))
@@ -783,7 +816,13 @@ filesystem tree, not (expand-file-name ".." dirname). */)
783 { 816 {
784 handler = Ffind_file_name_handler (default_directory, Qexpand_file_name); 817 handler = Ffind_file_name_handler (default_directory, Qexpand_file_name);
785 if (!NILP (handler)) 818 if (!NILP (handler))
786 return call3 (handler, Qexpand_file_name, name, default_directory); 819 {
820 handled_name = call3 (handler, Qexpand_file_name,
821 name, default_directory);
822 if (STRINGP (handled_name))
823 return handled_name;
824 error ("Invalid handler in `file-name-handler-alist'");
825 }
787 } 826 }
788 827
789 { 828 {
@@ -1284,7 +1323,13 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1284 to be expanded again. */ 1323 to be expanded again. */
1285 handler = Ffind_file_name_handler (result, Qexpand_file_name); 1324 handler = Ffind_file_name_handler (result, Qexpand_file_name);
1286 if (!NILP (handler)) 1325 if (!NILP (handler))
1287 return call3 (handler, Qexpand_file_name, result, default_directory); 1326 {
1327 handled_name = call3 (handler, Qexpand_file_name,
1328 result, default_directory);
1329 if (STRINGP (handled_name))
1330 return handled_name;
1331 error ("Invalid handler in `file-name-handler-alist'");
1332 }
1288 1333
1289 return result; 1334 return result;
1290} 1335}
@@ -1537,7 +1582,13 @@ those `/' is discarded. */)
1537 call the corresponding file handler. */ 1582 call the corresponding file handler. */
1538 handler = Ffind_file_name_handler (filename, Qsubstitute_in_file_name); 1583 handler = Ffind_file_name_handler (filename, Qsubstitute_in_file_name);
1539 if (!NILP (handler)) 1584 if (!NILP (handler))
1540 return call2 (handler, Qsubstitute_in_file_name, filename); 1585 {
1586 Lisp_Object handled_name = call2 (handler, Qsubstitute_in_file_name,
1587 filename);
1588 if (STRINGP (handled_name))
1589 return handled_name;
1590 error ("Invalid handler in `file-name-handler-alist'");
1591 }
1541 1592
1542 /* Always work on a copy of the string, in case GC happens during 1593 /* Always work on a copy of the string, in case GC happens during
1543 decode of environment variables, causing the original Lisp_String 1594 decode of environment variables, causing the original Lisp_String
@@ -5589,18 +5640,25 @@ of file names regardless of the current language environment. */);
5589 make_pure_c_string ("Cannot set file date")); 5640 make_pure_c_string ("Cannot set file date"));
5590 5641
5591 DEFVAR_LISP ("file-name-handler-alist", Vfile_name_handler_alist, 5642 DEFVAR_LISP ("file-name-handler-alist", Vfile_name_handler_alist,
5592 doc: /* *Alist of elements (REGEXP . HANDLER) for file names handled specially. 5643 doc: /* Alist of elements (REGEXP . HANDLER) for file names handled specially.
5593If a file name matches REGEXP, then all I/O on that file is done by calling 5644If a file name matches REGEXP, all I/O on that file is done by calling
5594HANDLER. 5645HANDLER. If a file name matches more than one handler, the handler
5595 5646whose match starts last in the file name gets precedence. The
5596The first argument given to HANDLER is the name of the I/O primitive 5647function `find-file-name-handler' checks this list for a handler for
5597to be handled; the remaining arguments are the arguments that were 5648its argument.
5598passed to that primitive. For example, if you do 5649
5599 (file-exists-p FILENAME) 5650HANDLER should be a function. The first argument given to it is the
5600and FILENAME is handled by HANDLER, then HANDLER is called like this: 5651name of the I/O primitive to be handled; the remaining arguments are
5601 (funcall HANDLER 'file-exists-p FILENAME) 5652the arguments that were passed to that primitive. For example, if you
5602The function `find-file-name-handler' checks this list for a handler 5653do (file-exists-p FILENAME) and FILENAME is handled by HANDLER, then
5603for its argument. */); 5654HANDLER is called like this:
5655
5656 (funcall HANDLER 'file-exists-p FILENAME)
5657
5658Note that HANDLER must be able to handle all I/O primitives; if it has
5659nothing special to do for a primitive, it should reinvoke the
5660primitive to handle the operation \"the usual way\".
5661See Info node `(elisp)Magic File Names' for more details. */);
5604 Vfile_name_handler_alist = Qnil; 5662 Vfile_name_handler_alist = Qnil;
5605 5663
5606 DEFVAR_LISP ("set-auto-coding-function", 5664 DEFVAR_LISP ("set-auto-coding-function",
diff --git a/src/lisp.h b/src/lisp.h
index 97981ec5f83..9199c9aabcf 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -168,6 +168,10 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
168#define GCTYPEBITS 3 168#define GCTYPEBITS 3
169#endif 169#endif
170 170
171#ifndef VALBITS
172#define VALBITS (BITS_PER_EMACS_INT - GCTYPEBITS)
173#endif
174
171#ifndef NO_DECL_ALIGN 175#ifndef NO_DECL_ALIGN
172# ifndef DECL_ALIGN 176# ifndef DECL_ALIGN
173# if HAVE_ATTRIBUTE_ALIGNED 177# if HAVE_ATTRIBUTE_ALIGNED
@@ -191,7 +195,15 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
191 || defined DARWIN_OS || defined __sun) 195 || defined DARWIN_OS || defined __sun)
192/* We also need to be able to specify mult-of-8 alignment on static vars. */ 196/* We also need to be able to specify mult-of-8 alignment on static vars. */
193# if defined DECL_ALIGN 197# if defined DECL_ALIGN
194# define USE_LSB_TAG 198/* mark_maybe_object assumes that EMACS_INT values are contiguous,
199 but this is not true on some hosts where EMACS_INT is wider than a pointer,
200 as they may allocate the halves of an EMACS_INT separately.
201 On these hosts USE_LSB_TAG is not needed because the top bits of an
202 EMACS_INT are unused, so define USE_LSB_TAG only on hosts where it
203 might be useful. */
204# if UINTPTR_MAX >> VALBITS != 0
205# define USE_LSB_TAG
206# endif
195# endif 207# endif
196#endif 208#endif
197 209
@@ -309,11 +321,6 @@ enum Lisp_Fwd_Type
309 Lisp_Fwd_Kboard_Obj, /* Fwd to a Lisp_Object field of kboards. */ 321 Lisp_Fwd_Kboard_Obj, /* Fwd to a Lisp_Object field of kboards. */
310 }; 322 };
311 323
312/* These values are overridden by the m- file on some machines. */
313#ifndef VALBITS
314#define VALBITS (BITS_PER_EMACS_INT - GCTYPEBITS)
315#endif
316
317#ifdef USE_LISP_UNION_TYPE 324#ifdef USE_LISP_UNION_TYPE
318 325
319#ifndef WORDS_BIGENDIAN 326#ifndef WORDS_BIGENDIAN
diff --git a/src/mem-limits.h b/src/mem-limits.h
index 472e591b38d..244592a9768 100644
--- a/src/mem-limits.h
+++ b/src/mem-limits.h
@@ -34,7 +34,7 @@ extern int etext;
34#endif 34#endif
35 35
36extern char *start_of_data (void); 36extern char *start_of_data (void);
37#if defined USE_LSB_TAG 37#if defined USE_LSB_TAG || UINTPTR_MAX >> VALBITS == 0
38#define EXCEEDS_LISP_PTR(ptr) 0 38#define EXCEEDS_LISP_PTR(ptr) 0
39#elif defined DATA_SEG_BITS 39#elif defined DATA_SEG_BITS
40#define EXCEEDS_LISP_PTR(ptr) \ 40#define EXCEEDS_LISP_PTR(ptr) \
diff --git a/src/syntax.c b/src/syntax.c
index bb473a52b3a..16012d9f88e 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -2844,18 +2844,23 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf
2844 2844
2845DEFUN ("scan-lists", Fscan_lists, Sscan_lists, 3, 3, 0, 2845DEFUN ("scan-lists", Fscan_lists, Sscan_lists, 3, 3, 0,
2846 doc: /* Scan from character number FROM by COUNT lists. 2846 doc: /* Scan from character number FROM by COUNT lists.
2847Returns the character number of the position thus found. 2847Scan forward if COUNT is positive, backward if COUNT is negative.
2848Return the character number of the position thus found.
2849
2850A \"list", in this context, refers to a balanced parenthetical
2851grouping, as determined by the syntax table.
2848 2852
2849If DEPTH is nonzero, paren depth begins counting from that value, 2853If DEPTH is nonzero, treat that as the nesting depth of the starting
2850only places where the depth in parentheses becomes zero 2854point (i.e. the starting point is DEPTH parentheses deep). This
2851are candidates for stopping; COUNT such places are counted. 2855function scans over parentheses until the depth goes to zero COUNT
2852Thus, a positive value for DEPTH means go out levels. 2856times. Hence, positive DEPTH moves out that number of levels of
2857parentheses, while negative DEPTH moves to a deeper level.
2853 2858
2854Comments are ignored if `parse-sexp-ignore-comments' is non-nil. 2859Comments are ignored if `parse-sexp-ignore-comments' is non-nil.
2855 2860
2856If the beginning or end of (the accessible part of) the buffer is reached 2861If we reach the beginning or end of the accessible part of the buffer
2857and the depth is wrong, an error is signaled. 2862before we have scanned over COUNT lists, return nil if the depth at
2858If the depth is right but the count is not used up, nil is returned. */) 2863that point is zero, and signal a error if the depth is nonzero. */)
2859 (Lisp_Object from, Lisp_Object count, Lisp_Object depth) 2864 (Lisp_Object from, Lisp_Object count, Lisp_Object depth)
2860{ 2865{
2861 CHECK_NUMBER (from); 2866 CHECK_NUMBER (from);
diff --git a/src/xterm.c b/src/xterm.c
index 3581ea61eb2..483676227ea 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2295,7 +2295,8 @@ x_draw_image_foreground (struct glyph_string *s)
2295static void 2295static void
2296x_draw_image_relief (struct glyph_string *s) 2296x_draw_image_relief (struct glyph_string *s)
2297{ 2297{
2298 int x0, y0, x1, y1, thick, raised_p, extra; 2298 int x0, y0, x1, y1, thick, raised_p;
2299 int extra_x, extra_y;
2299 XRectangle r; 2300 XRectangle r;
2300 int x = s->x; 2301 int x = s->x;
2301 int y = s->ybase - image_ascent (s->img, s->face, &s->slice); 2302 int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
@@ -2326,13 +2327,24 @@ x_draw_image_relief (struct glyph_string *s)
2326 raised_p = s->img->relief > 0; 2327 raised_p = s->img->relief > 0;
2327 } 2328 }
2328 2329
2329 extra = s->face->id == TOOL_BAR_FACE_ID 2330 extra_x = extra_y = 0;
2330 ? XINT (Vtool_bar_button_margin) : 0; 2331 if (s->face->id == TOOL_BAR_FACE_ID)
2332 {
2333 if (CONSP (Vtool_bar_button_margin)
2334 && INTEGERP (XCAR (Vtool_bar_button_margin))
2335 && INTEGERP (XCDR (Vtool_bar_button_margin)))
2336 {
2337 extra_x = XINT (XCAR (Vtool_bar_button_margin));
2338 extra_y = XINT (XCDR (Vtool_bar_button_margin));
2339 }
2340 else if (INTEGERP (Vtool_bar_button_margin))
2341 extra_x = extra_y = XINT (Vtool_bar_button_margin);
2342 }
2331 2343
2332 x0 = x - thick - extra; 2344 x0 = x - thick - extra_x;
2333 y0 = y - thick - extra; 2345 y0 = y - thick - extra_y;
2334 x1 = x + s->slice.width + thick - 1 + extra; 2346 x1 = x + s->slice.width + thick - 1 + extra_x;
2335 y1 = y + s->slice.height + thick - 1 + extra; 2347 y1 = y + s->slice.height + thick - 1 + extra_y;
2336 2348
2337 x_setup_relief_colors (s); 2349 x_setup_relief_colors (s);
2338 get_glyph_string_clip_rect (s, &r); 2350 get_glyph_string_clip_rect (s, &r);