Now on revision 108897. ------------------------------------------------------------ revno: 108897 author: Dmitry Gutov committer: martin rudalics branch nick: trunk timestamp: Fri 2012-07-06 08:22:56 +0200 message: In quit-window always restore window height when it's saved in quit-restore parameter. * window.el (quit-window): Always restore window height when it's saved in quit-restore parameter. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-07-06 04:31:46 +0000 +++ lisp/ChangeLog 2012-07-06 06:22:56 +0000 @@ -1,3 +1,8 @@ +2012-07-06 Dmitry Gutov + + * window.el (quit-window): Always restore window height when + it's saved in quit-restore parameter. + 2012-07-06 Glenn Morris * simple.el (kill-whole-line): Doc tweak. === modified file 'lisp/window.el' --- lisp/window.el 2012-06-22 21:24:54 +0000 +++ lisp/window.el 2012-07-06 06:22:56 +0000 @@ -3069,9 +3069,8 @@ (buffer-live-p (car quad)) (eq (nth 3 quit-restore) buffer)) ;; Show another buffer stored in quit-restore parameter. - (setq resize (with-current-buffer buffer - (and temp-buffer-resize-mode - (/= (nth 3 quad) (window-total-size window))))) + (setq resize (and (integerp (nth 3 quad)) + (/= (nth 3 quad) (window-total-size window)))) (set-window-dedicated-p window nil) (when resize ;; Try to resize WINDOW to its old height but don't signal an ------------------------------------------------------------ revno: 108896 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2012-07-06 09:07:44 +0400 message: Introduce fast path for the widely used marker operation. * alloc.c (build_marker): New function. * lisp.h (build_marker): New prototype. * buffer.c (clone_per_buffer_values, Fmake_indirect_buffer): Use it. * composite.c (autocmp_chars): Likewise. * editfns.c (buildmark): Remove. (Fpoint_marker, Fpoint_min_marker, Fpoint_max_marker) (save_restriction_save): Use build_marker. * marker.c (buf_charpos_to_bytepos, buf_bytepos_to_charpos): Likewise. * window.c (save_window_save): Likewise. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-06 04:42:30 +0000 +++ src/ChangeLog 2012-07-06 05:07:44 +0000 @@ -1,5 +1,18 @@ 2012-07-06 Dmitry Antipov + Introduce fast path for the widely used marker operation. + * alloc.c (build_marker): New function. + * lisp.h (build_marker): New prototype. + * buffer.c (clone_per_buffer_values, Fmake_indirect_buffer): Use it. + * composite.c (autocmp_chars): Likewise. + * editfns.c (buildmark): Remove. + (Fpoint_marker, Fpoint_min_marker, Fpoint_max_marker) + (save_restriction_save): Use build_marker. + * marker.c (buf_charpos_to_bytepos, buf_bytepos_to_charpos): Likewise. + * window.c (save_window_save): Likewise. + +2012-07-06 Dmitry Antipov + Do not use Fdelete_overlay in delete_all_overlays to avoid redundant calls to unchain_overlay. * buffer.c (drop_overlay): New function. === modified file 'src/alloc.c' --- src/alloc.c 2012-07-05 18:35:48 +0000 +++ src/alloc.c 2012-07-06 05:07:44 +0000 @@ -3641,6 +3641,33 @@ return val; } +/* Return a newly allocated marker which points into BUF + at character position CHARPOS and byte position BYTEPOS. */ + +Lisp_Object +build_marker (struct buffer *buf, ptrdiff_t charpos, ptrdiff_t bytepos) +{ + Lisp_Object obj; + struct Lisp_Marker *m; + + /* No dead buffers here. */ + eassert (!NILP (BVAR (buf, name))); + + /* Every character is at least one byte. */ + eassert (charpos <= bytepos); + + obj = allocate_misc (); + XMISCTYPE (obj) = Lisp_Misc_Marker; + m = XMARKER (obj); + m->buffer = buf; + m->charpos = charpos; + m->bytepos = bytepos; + m->insertion_type = 0; + m->next = BUF_MARKERS (buf); + BUF_MARKERS (buf) = m; + return obj; +} + /* Put MARKER back on the free list after using it temporarily. */ void === modified file 'src/buffer.c' --- src/buffer.c 2012-07-06 04:42:30 +0000 +++ src/buffer.c 2012-07-06 05:07:44 +0000 @@ -458,11 +458,8 @@ static void clone_per_buffer_values (struct buffer *from, struct buffer *to) { - Lisp_Object to_buffer; int offset; - XSETBUFFER (to_buffer, to); - for_each_per_buffer_object_at (offset) { Lisp_Object obj; @@ -475,9 +472,9 @@ if (MARKERP (obj) && XMARKER (obj)->buffer == from) { struct Lisp_Marker *m = XMARKER (obj); - obj = Fmake_marker (); + + obj = build_marker (to, m->charpos, m->bytepos); XMARKER (obj)->insertion_type = m->insertion_type; - set_marker_both (obj, to_buffer, m->charpos, m->bytepos); } PER_BUFFER_VALUE (to, offset) = obj; @@ -615,32 +612,24 @@ eassert (NILP (BVAR (b->base_buffer, begv_marker))); eassert (NILP (BVAR (b->base_buffer, zv_marker))); - BVAR (b->base_buffer, pt_marker) = Fmake_marker (); - set_marker_both (BVAR (b->base_buffer, pt_marker), base_buffer, - b->base_buffer->pt, - b->base_buffer->pt_byte); - - BVAR (b->base_buffer, begv_marker) = Fmake_marker (); - set_marker_both (BVAR (b->base_buffer, begv_marker), base_buffer, - b->base_buffer->begv, - b->base_buffer->begv_byte); - - BVAR (b->base_buffer, zv_marker) = Fmake_marker (); - set_marker_both (BVAR (b->base_buffer, zv_marker), base_buffer, - b->base_buffer->zv, - b->base_buffer->zv_byte); + BVAR (b->base_buffer, pt_marker) + = build_marker (b->base_buffer, b->base_buffer->pt, b->base_buffer->pt_byte); + + BVAR (b->base_buffer, begv_marker) + = build_marker (b->base_buffer, b->base_buffer->begv, b->base_buffer->begv_byte); + + BVAR (b->base_buffer, zv_marker) + = build_marker (b->base_buffer, b->base_buffer->zv, b->base_buffer->zv_byte); + XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1; } if (NILP (clone)) { /* Give the indirect buffer markers for its narrowing. */ - BVAR (b, pt_marker) = Fmake_marker (); - set_marker_both (BVAR (b, pt_marker), buf, b->pt, b->pt_byte); - BVAR (b, begv_marker) = Fmake_marker (); - set_marker_both (BVAR (b, begv_marker), buf, b->begv, b->begv_byte); - BVAR (b, zv_marker) = Fmake_marker (); - set_marker_both (BVAR (b, zv_marker), buf, b->zv, b->zv_byte); + BVAR (b, pt_marker) = build_marker (b, b->pt, b->pt_byte); + BVAR (b, begv_marker) = build_marker (b, b->begv, b->begv_byte); + BVAR (b, zv_marker) = build_marker (b, b->zv, b->zv_byte); XMARKER (BVAR (b, zv_marker))->insertion_type = 1; } else === modified file 'src/composite.c' --- src/composite.c 2012-07-05 18:35:48 +0000 +++ src/composite.c 2012-07-06 05:07:44 +0000 @@ -951,11 +951,8 @@ /* Save point as marker before calling out to lisp. */ if (NILP (string)) - { - Lisp_Object m = Fmake_marker (); - set_marker_both (m, Qnil, pt, pt_byte); - record_unwind_protect (restore_point_unwind, m); - } + record_unwind_protect (restore_point_unwind, + build_marker (current_buffer, pt, pt_byte)); args[0] = Vauto_composition_function; args[1] = AREF (rule, 2); === modified file 'src/editfns.c' --- src/editfns.c 2012-07-05 18:35:48 +0000 +++ src/editfns.c 2012-07-06 05:07:44 +0000 @@ -205,15 +205,6 @@ XSETFASTINT (val, 0); return val; } - -static Lisp_Object -buildmark (ptrdiff_t charpos, ptrdiff_t bytepos) -{ - register Lisp_Object mark; - mark = Fmake_marker (); - set_marker_both (mark, Qnil, charpos, bytepos); - return mark; -} DEFUN ("point", Fpoint, Spoint, 0, 0, 0, doc: /* Return value of point, as an integer. @@ -229,7 +220,7 @@ doc: /* Return value of point, as a marker object. */) (void) { - return buildmark (PT, PT_BYTE); + return build_marker (current_buffer, PT, PT_BYTE); } DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ", @@ -1003,7 +994,7 @@ This is the beginning, unless narrowing (a buffer restriction) is in effect. */) (void) { - return buildmark (BEGV, BEGV_BYTE); + return build_marker (current_buffer, BEGV, BEGV_BYTE); } DEFUN ("point-max", Fpoint_max, Spoint_max, 0, 0, 0, @@ -1023,7 +1014,7 @@ is in effect, in which case it is less. */) (void) { - return buildmark (ZV, ZV_BYTE); + return build_marker (current_buffer, ZV, ZV_BYTE); } DEFUN ("gap-position", Fgap_position, Sgap_position, 0, 0, 0, @@ -3289,8 +3280,8 @@ { Lisp_Object beg, end; - beg = buildmark (BEGV, BEGV_BYTE); - end = buildmark (ZV, ZV_BYTE); + beg = build_marker (current_buffer, BEGV, BEGV_BYTE); + end = build_marker (current_buffer, ZV, ZV_BYTE); /* END must move forward if text is inserted at its exact location. */ XMARKER (end)->insertion_type = 1; === modified file 'src/lisp.h' --- src/lisp.h 2012-07-05 06:32:41 +0000 +++ src/lisp.h 2012-07-06 05:07:44 +0000 @@ -2853,6 +2853,7 @@ extern Lisp_Object set_marker_both (Lisp_Object, Lisp_Object, ptrdiff_t, ptrdiff_t); extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object, ptrdiff_t, ptrdiff_t); +extern Lisp_Object build_marker (struct buffer *, ptrdiff_t, ptrdiff_t); extern void syms_of_marker (void); /* Defined in fileio.c */ === modified file 'src/marker.c' --- src/marker.c 2012-07-05 16:14:39 +0000 +++ src/marker.c 2012-07-06 05:07:44 +0000 @@ -187,12 +187,7 @@ cache the correspondence by creating a marker here. It will last until the next GC. */ if (record) - { - Lisp_Object marker, buffer; - marker = Fmake_marker (); - XSETBUFFER (buffer, b); - set_marker_both (marker, buffer, best_below, best_below_byte); - } + build_marker (b, best_below, best_below_byte); if (byte_debug_flag) byte_char_debug_check (b, charpos, best_below_byte); @@ -218,12 +213,7 @@ cache the correspondence by creating a marker here. It will last until the next GC. */ if (record) - { - Lisp_Object marker, buffer; - marker = Fmake_marker (); - XSETBUFFER (buffer, b); - set_marker_both (marker, buffer, best_above, best_above_byte); - } + build_marker (b, best_above, best_above_byte); if (byte_debug_flag) byte_char_debug_check (b, charpos, best_above_byte); @@ -365,12 +355,7 @@ But don't do it if BUF_MARKERS is nil; that is a signal from Fset_buffer_multibyte. */ if (record && BUF_MARKERS (b)) - { - Lisp_Object marker, buffer; - marker = Fmake_marker (); - XSETBUFFER (buffer, b); - set_marker_both (marker, buffer, best_below, best_below_byte); - } + build_marker (b, best_below, best_below_byte); if (byte_debug_flag) byte_char_debug_check (b, best_below, bytepos); @@ -398,12 +383,7 @@ But don't do it if BUF_MARKERS is nil; that is a signal from Fset_buffer_multibyte. */ if (record && BUF_MARKERS (b)) - { - Lisp_Object marker, buffer; - marker = Fmake_marker (); - XSETBUFFER (buffer, b); - set_marker_both (marker, buffer, best_above, best_above_byte); - } + build_marker (b, best_above, best_above_byte); if (byte_debug_flag) byte_char_debug_check (b, best_above, bytepos); === modified file 'src/window.c' --- src/window.c 2012-07-05 18:35:48 +0000 +++ src/window.c 2012-07-06 05:07:44 +0000 @@ -5911,12 +5911,9 @@ is the selected window, then get the value of point from the buffer; pointm is garbage in the selected window. */ if (EQ (window, selected_window)) - { - p->pointm = Fmake_marker (); - set_marker_both (p->pointm, w->buffer, - BUF_PT (XBUFFER (w->buffer)), - BUF_PT_BYTE (XBUFFER (w->buffer))); - } + p->pointm = build_marker (XBUFFER (w->buffer), + BUF_PT (XBUFFER (w->buffer)), + BUF_PT_BYTE (XBUFFER (w->buffer))); else p->pointm = Fcopy_marker (w->pointm, Qnil); XMARKER (p->pointm)->insertion_type ------------------------------------------------------------ revno: 108895 committer: Chong Yidong branch nick: trunk timestamp: Fri 2012-07-06 12:48:35 +0800 message: Tweak Emacs manual info menu ordering. * doc/emacs/emacs.texi: Re-order top-level menu to correspond to logical order, to avoid makeinfo warnings. * doc/emacs/ack.texi (Acknowledgments): Note new python.el. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2012-07-06 04:31:46 +0000 +++ doc/emacs/ChangeLog 2012-07-06 04:48:35 +0000 @@ -1,3 +1,10 @@ +2012-07-06 Chong Yidong + + * emacs.texi: Re-order top-level menu to correspond to logical + order, to avoid makeinfo warnings. + + * ack.texi (Acknowledgments): Note new python.el. + 2012-06-29 Chong Yidong * maintaining.texi (Basic VC Editing, VC Pull, Merging): === modified file 'doc/emacs/ack.texi' --- doc/emacs/ack.texi 2012-06-27 03:24:29 +0000 +++ doc/emacs/ack.texi 2012-07-06 04:48:35 +0000 @@ -364,6 +364,10 @@ flow control. @item +Fabián E. Gallina rewrote @file{python.el}, the major mode for the +Python programming language used in Emacs 24.2 onwards. + +@item Kevin Gallo added multiple-frame support for Windows NT and wrote @file{w32-win.el}, support functions for the MS-Windows window system. @@ -710,13 +714,13 @@ the current window on which point is; @file{cap-words.el}, a minor mode for motion in ``CapitalizedWordIdentifiers''; @file{latin1-disp.el}, a package that lets you display ISO 8859 characters on Latin-1 terminals -by setting up appropriate display tables; @file{python.el}, a major mode -for the Python programming language; @file{smiley.el}, a facility for -displaying smiley faces; @file{sym-comp.el}, a library for performing -mode-dependent symbol completion; @file{benchmark.el} for timing code -execution; and @file{tool-bar.el}, a mode to control the display of -the Emacs tool bar. With Riccardo Murri he wrote @file{vc-bzr.el}, -support for the Bazaar version control system. +by setting up appropriate display tables; the version of +@file{python.el} used prior to Emacs 24.2; @file{smiley.el}, a +facility for displaying smiley faces; @file{sym-comp.el}, a library +for performing mode-dependent symbol completion; @file{benchmark.el} +for timing code execution; and @file{tool-bar.el}, a mode to control +the display of the Emacs tool bar. With Riccardo Murri he wrote +@file{vc-bzr.el}, support for the Bazaar version control system. @item Eric Ludlam wrote the Speedbar package; @file{checkdoc.el}, for checking === modified file 'doc/emacs/emacs.texi' --- doc/emacs/emacs.texi 2012-06-17 05:13:40 +0000 +++ doc/emacs/emacs.texi 2012-07-06 04:48:35 +0000 @@ -131,17 +131,6 @@ @menu * Distrib:: How to get the latest Emacs distribution. * Intro:: An introduction to Emacs concepts. -@c Note that in the printed manual, the glossary and indices come last. -* Glossary:: Terms used in this manual. - -Indexes (each index contains a large menu) -* Key Index:: An item for each standard Emacs key sequence. -* Option Index:: An item for every command-line option. -* Command Index:: An item for each command name. -* Variable Index:: An item for each documented variable. -* Concept Index:: An item for each concept. - -* Acknowledgments:: Major contributors to GNU Emacs. Important General Concepts * Screen:: How to interpret what you see on the screen. @@ -224,6 +213,18 @@ * Microsoft Windows:: Using Emacs on Microsoft Windows and MS-DOS. * Manifesto:: What's GNU? Gnu's Not Unix! +* Glossary:: Terms used in this manual. +@ifnottex +* Acknowledgments:: Major contributors to GNU Emacs. +@end ifnottex + +Indexes (each index contains a large menu) +* Key Index:: An item for each standard Emacs key sequence. +* Option Index:: An item for every command-line option. +* Command Index:: An item for each command name. +* Variable Index:: An item for each documented variable. +* Concept Index:: An item for each concept. + @c Do NOT modify the following 3 lines! They must have this form to @c be correctly identified by `texinfo-multiple-files-update'. In @c particular, the detailed menu header line MUST be identical to the ------------------------------------------------------------ revno: 108894 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2012-07-06 08:42:30 +0400 message: Do not use Fdelete_overlay in delete_all_overlays to avoid redundant calls to unchain_overlay. * buffer.c (drop_overlay): New function. (delete_all_overlays, Fdelete_overlay): Use it. * minibuf.c (get_minibuffer): Fix comment. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-06 03:08:57 +0000 +++ src/ChangeLog 2012-07-06 04:42:30 +0000 @@ -1,3 +1,11 @@ +2012-07-06 Dmitry Antipov + + Do not use Fdelete_overlay in delete_all_overlays + to avoid redundant calls to unchain_overlay. + * buffer.c (drop_overlay): New function. + (delete_all_overlays, Fdelete_overlay): Use it. + * minibuf.c (get_minibuffer): Fix comment. + 2012-07-06 Paul Eggert Port to OpenBSD 5.1 amd64. === modified file 'src/buffer.c' --- src/buffer.c 2012-07-05 18:35:48 +0000 +++ src/buffer.c 2012-07-06 04:42:30 +0000 @@ -667,27 +667,40 @@ return buf; } +/* Mark OV as no longer associated with B. */ + +static void +drop_overlay (struct buffer *b, struct Lisp_Overlay *ov) +{ + eassert (b == XBUFFER (Fmarker_buffer (ov->start))); + modify_overlay (b, marker_position (ov->start), marker_position (ov->end)); + Fset_marker (ov->start, Qnil, Qnil); + Fset_marker (ov->end, Qnil, Qnil); + +} + +/* Delete all overlays of B and reset it's overlay lists. */ + void delete_all_overlays (struct buffer *b) { - Lisp_Object overlay; - - /* `reset_buffer' blindly sets the list of overlays to NULL, so we - have to empty the list, otherwise we end up with overlays that - think they belong to this buffer while the buffer doesn't know about - them any more. */ - while (b->overlays_before) - { - XSETMISC (overlay, b->overlays_before); - Fdelete_overlay (overlay); - } - while (b->overlays_after) - { - XSETMISC (overlay, b->overlays_after); - Fdelete_overlay (overlay); - } - eassert (b->overlays_before == NULL); - eassert (b->overlays_after == NULL); + struct Lisp_Overlay *ov, *next; + + for (ov = b->overlays_before; ov; ov = next) + { + drop_overlay (b, ov); + next = ov->next; + ov->next = NULL; + } + + for (ov = b->overlays_after; ov; ov = next) + { + drop_overlay (b, ov); + next = ov->next; + ov->next = NULL; + } + + b->overlays_before = b->overlays_after = NULL; } /* Reinitialize everything about a buffer except its name and contents @@ -3820,11 +3833,7 @@ = unchain_overlay (b->overlays_after, XOVERLAY (overlay)); eassert (XOVERLAY (overlay)->next == NULL); - modify_overlay (b, - marker_position (OVERLAY_START (overlay)), - marker_position (OVERLAY_END (overlay))); - Fset_marker (OVERLAY_START (overlay), Qnil, Qnil); - Fset_marker (OVERLAY_END (overlay), Qnil, Qnil); + drop_overlay (b, XOVERLAY (overlay)); /* When deleting an overlay with before or after strings, turn off display optimizations for the affected buffer, on the basis that === modified file 'src/minibuf.c' --- src/minibuf.c 2012-07-05 06:32:41 +0000 +++ src/minibuf.c 2012-07-06 04:42:30 +0000 @@ -804,10 +804,9 @@ else { ptrdiff_t count = SPECPDL_INDEX (); - /* `reset_buffer' blindly sets the list of overlays to NULL, so we - have to empty the list, otherwise we end up with overlays that - think they belong to this buffer while the buffer doesn't know about - them any more. */ + /* We have to empty both overlay lists. Otherwise we end + up with overlays that think they belong to this buffer + while the buffer doesn't know about them any more. */ delete_all_overlays (XBUFFER (buf)); reset_buffer (XBUFFER (buf)); record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); ------------------------------------------------------------ revno: 108893 [merge] committer: Chong Yidong branch nick: trunk timestamp: Fri 2012-07-06 12:33:03 +0800 message: Merge from emacs-24; up to r108065 diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2012-06-29 06:28:37 +0000 +++ doc/emacs/ChangeLog 2012-07-06 04:31:46 +0000 @@ -1,3 +1,8 @@ +2012-06-29 Chong Yidong + + * maintaining.texi (Basic VC Editing, VC Pull, Merging): + * basic.texi (Erasing, Basic Undo): Fix markup. + 2012-06-29 Glenn Morris * fixit.texi (Undo): Grammar fixes. (Bug#11779) === modified file 'doc/emacs/basic.texi' --- doc/emacs/basic.texi 2012-05-27 01:25:06 +0000 +++ doc/emacs/basic.texi 2012-07-06 04:31:46 +0000 @@ -345,7 +345,7 @@ Delete the character before point, or the region if it is active (@code{delete-backward-char}). -@itemx @key{Delete} +@item @key{Delete} Delete the character after point, or the region if it is active (@code{delete-forward-char}). @@ -403,7 +403,8 @@ @item C-/ Undo one entry of the undo records---usually, one command worth (@code{undo}). -@itemx C-x u + +@item C-x u @itemx C-_ The same. @end table === modified file 'doc/emacs/maintaining.texi' --- doc/emacs/maintaining.texi 2012-06-17 05:13:40 +0000 +++ doc/emacs/maintaining.texi 2012-07-06 04:31:46 +0000 @@ -426,7 +426,7 @@ one revision for each changed file. @table @kbd -@itemx C-x v v +@item C-x v v Perform the next appropriate version control operation on the current VC fileset. @end table @@ -1326,7 +1326,7 @@ @subsubsection Pulling Changes into a Branch @table @kbd -@itemx C-x v + +@item C-x v + On a decentralized version control system, update the current branch by ``pulling in'' changes from another location. @@ -1366,7 +1366,7 @@ @cindex merging changes @table @kbd -@itemx C-x v m +@item C-x v m On a decentralized version control system, merge changes from another branch into the current one. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-07-06 01:31:54 +0000 +++ lisp/ChangeLog 2012-07-06 04:31:46 +0000 @@ -1,5 +1,21 @@ 2012-07-06 Glenn Morris + * simple.el (kill-whole-line): Doc tweak. + +2012-07-06 Eli Zaretskii + + * files.el (file-relative-name): Compare file names + case-insensitively if on MS-Windows or MS-DOS, or if + read-file-name-completion-ignore-case is non-nil. Don't use + case-fold-search for this purpose. (Bug#11827) + +2012-07-06 Andreas Schwab + + * calendar/cal-dst.el (calendar-current-time-zone): Return + calendar-current-time-zone-cache if non-nil. + +2012-07-06 Glenn Morris + * Makefile.in (cvs-update): Remove old alias. 2012-07-05 Michael Albinus === modified file 'lisp/files.el' --- lisp/files.el 2012-07-04 15:59:12 +0000 +++ lisp/files.el 2012-07-06 04:31:46 +0000 @@ -4332,7 +4332,9 @@ default-directory)))) (setq filename (expand-file-name filename)) (let ((fremote (file-remote-p filename)) - (dremote (file-remote-p directory))) + (dremote (file-remote-p directory)) + (fold-case (or (memq system-type '(ms-dos cygwin windows-nt)) + read-file-name-completion-ignore-case))) (if ;; Conditions for separate trees (or ;; Test for different filesystems on DOS/Windows @@ -4341,7 +4343,7 @@ (memq system-type '(ms-dos cygwin windows-nt)) (or ;; Test for different drive letters - (not (eq t (compare-strings filename 0 2 directory 0 2))) + (not (eq t (compare-strings filename 0 2 directory 0 2 fold-case))) ;; Test for UNCs on different servers (not (eq t (compare-strings (progn @@ -4366,16 +4368,16 @@ (while (not (or (eq t (compare-strings filename-dir nil (length directory) - directory nil nil case-fold-search)) + directory nil nil fold-case)) (eq t (compare-strings filename nil (length directory) - directory nil nil case-fold-search)))) + directory nil nil fold-case)))) (setq directory (file-name-directory (substring directory 0 -1)) ancestor (if (equal ancestor ".") ".." (concat "../" ancestor)))) ;; Now ancestor is empty, or .., or ../.., etc. (if (eq t (compare-strings filename nil (length directory) - directory nil nil case-fold-search)) + directory nil nil fold-case)) ;; We matched within FILENAME's directory part. ;; Add the rest of FILENAME onto ANCESTOR. (let ((rest (substring filename (length directory)))) === modified file 'lisp/simple.el' --- lisp/simple.el 2012-06-28 07:21:41 +0000 +++ lisp/simple.el 2012-07-06 04:31:46 +0000 @@ -3541,7 +3541,7 @@ ;; kill-line and its subroutines. (defcustom kill-whole-line nil - "If non-nil, `kill-line' with no arg at beg of line kills the whole line." + "If non-nil, `kill-line' with no arg at start of line kills the whole line." :type 'boolean :group 'killing) ------------------------------------------------------------ revno: 108892 committer: Chong Yidong branch nick: trunk timestamp: Fri 2012-07-06 12:25:04 +0800 message: Misc fixes for Lisp manual. * doc/lispref/intro.texi (A Sample Function Description): Fix incorrect markup, undoing previous change. (A Sample Variable Description): Minor clarifications and markup improvements. * doc/lispref/elisp.texi (Top): * doc/lispref/text.texi (Text): Fix menu order. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-07-06 01:54:35 +0000 +++ doc/lispref/ChangeLog 2012-07-06 04:25:04 +0000 @@ -1,3 +1,13 @@ +2012-07-06 Chong Yidong + + * intro.texi (A Sample Function Description): Fix incorrect + markup, undoing previous change. + (A Sample Variable Description): Minor clarifications and markup + improvements. + + * elisp.texi (Top): + * text.texi (Text): Fix menu order. + 2012-07-06 Richard Stallman * intro.texi (Evaluation Notation, A Sample Function Description): === modified file 'doc/lispref/elisp.texi' --- doc/lispref/elisp.texi 2012-06-17 05:13:40 +0000 +++ doc/lispref/elisp.texi 2012-07-06 04:25:04 +0000 @@ -1123,9 +1123,9 @@ * Case Changes:: Case conversion of parts of the buffer. * Text Properties:: Assigning Lisp property lists to text characters. * Substitution:: Replacing a given character wherever it appears. -* Transposition:: Swapping two portions of a buffer. * Registers:: How registers are implemented. Accessing the text or position stored in a register. +* Transposition:: Swapping two portions of a buffer. * Base 64:: Conversion to or from base 64 encoding. * Checksum/Hash:: Computing cryptographic hashes. * Parsing HTML/XML:: Parsing HTML and XML. === modified file 'doc/lispref/intro.texi' --- doc/lispref/intro.texi 2012-07-06 01:54:35 +0000 +++ doc/lispref/intro.texi 2012-07-06 04:25:04 +0000 @@ -379,24 +379,25 @@ @end example @end defun - Any argument whose name contains the name of a type (e.g., -@var{integer}, @var{integer1} or @var{buffer}) is expected to be of that -type. A plural of a type (such as @var{buffers}) often means a list of -objects of that type. An argument named @var{object} may be of any type. -(For a list of Emacs object types, @pxref{Lisp Data Types}.) An argument -with some other sort of name (e.g., @var{new-file}) is discussed -specifically in the description of the function. In some sections, -features common to the arguments of several functions are described at -the beginning. + By convention, any argument whose name contains the name of a type +(e.g.@: @var{integer}, @var{integer1} or @var{buffer}) is expected to +be of that type. A plural of a type (such as @var{buffers}) often +means a list of objects of that type. An argument named @var{object} +may be of any type. (For a list of Emacs object types, @pxref{Lisp +Data Types}.) An argument with any other sort of name +(e.g.@: @var{new-file}) is specific to the function; if the function +has a documentation string, the type of the argument should be +described there (@pxref{Documentation}). - For a more complete description of arguments modified by -@code{&optional} and @code{&rest}, @pxref{Lambda Expressions}. + @xref{Lambda Expressions}, for a more complete description of +arguments modified by @code{&optional} and @code{&rest}. Command, macro, and special form descriptions have the same format, -but the word `Function' is replaced by `Command', `Macro', or `Special -Form', respectively. Commands are simply functions that may be called -interactively; macros process their arguments differently from functions -(the arguments are not evaluated), but are presented the same way. +but the word @samp{Function} is replaced by @samp{Command}, +@samp{Macro}, or @samp{Special Form}, respectively. Commands are +simply functions that may be called interactively; macros process +their arguments differently from functions (the arguments are not +evaluated), but are presented the same way. The descriptions of macros and special forms use a more complex notation to specify optional and repeated arguments, because they can @@ -445,14 +446,14 @@ @cindex variable descriptions @cindex option descriptions - A @dfn{variable} is a name that can be bound to an object; binding -is frequently referred to as @dfn{setting}, and the object to which -a variable is set is often called a @dfn{value} that the variable -@dfn{holds}. Although nearly all variables can be set by the user, -certain variables exist specifically so that users can change them; -these are called @dfn{user options}. Ordinary variables and user -options are described using a format like that for functions, except -that there are no arguments. + A @dfn{variable} is a name that can be @dfn{bound} (or @dfn{set}) to +an object. The object to which a variable is bound is called a +@dfn{value}; we say also that variable @dfn{holds} that value. +Although nearly all variables can be set by the user, certain +variables exist specifically so that users can change them; these are +called @dfn{user options}. Ordinary variables and user options are +described using a format like that for functions, except that there +are no arguments. Here is a description of the imaginary @code{electric-future-map} variable.@refill @@ -463,8 +464,8 @@ have not yet thought about executing. @end defvar - User option descriptions have the same format, but `Variable' is -replaced by `User Option'. + User option descriptions have the same format, but @samp{Variable} +is replaced by @samp{User Option}. @node Version Info @section Version Information === modified file 'doc/lispref/text.texi' --- doc/lispref/text.texi 2012-06-17 05:13:40 +0000 +++ doc/lispref/text.texi 2012-07-06 04:25:04 +0000 @@ -51,9 +51,9 @@ * Case Changes:: Case conversion of parts of the buffer. * Text Properties:: Assigning Lisp property lists to text characters. * Substitution:: Replacing a given character wherever it appears. -* Transposition:: Swapping two portions of a buffer. * Registers:: How registers are implemented. Accessing the text or position stored in a register. +* Transposition:: Swapping two portions of a buffer. * Base 64:: Conversion to or from base 64 encoding. * Checksum/Hash:: Computing cryptographic hashes. * Parsing HTML/XML:: Parsing HTML and XML. ------------------------------------------------------------ revno: 108891 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-07-06 03:08:57 +0000 message: Port to OpenBSD 5.1 amd64. diff: === modified file 'ChangeLog' --- ChangeLog 2012-07-04 08:35:34 +0000 +++ ChangeLog 2012-07-06 03:08:57 +0000 @@ -1,3 +1,9 @@ +2012-07-06 Paul Eggert + + Merge from gnulib. This is for OpenBSD 5.1 amd64. + * m4/sys_time_h.m4: New version from gnulib, incorporating: + 2012-07-05 sys_time: allow too-wide tv_sec + 2012-07-04 Paul Eggert Merge from gnulib. === modified file 'm4/sys_time_h.m4' --- m4/sys_time_h.m4 2012-06-22 21:26:37 +0000 +++ m4/sys_time_h.m4 2012-07-06 03:08:57 +0000 @@ -52,7 +52,9 @@ dnl (in and for mingw64, in only dnl for MSVC) with a tv_sec field of type 'long' (32-bit!), which is dnl smaller than the 'time_t' type mandated by POSIX. - AC_CACHE_CHECK([for correct struct timeval.tv_sec member], + dnl On OpenBSD 5.1 amd64, tv_sec is 64 bits and time_t 32 bits, but + dnl that is good enough. + AC_CACHE_CHECK([for wide-enough struct timeval.tv_sec member], [gl_cv_sys_struct_timeval_tv_sec], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( @@ -65,7 +67,9 @@ #endif ]], [[static struct timeval x; - typedef int verify_tv_sec_type[sizeof (x.tv_sec) == sizeof (time_t) ? 1 : -1]; + typedef int verify_tv_sec_type[ + sizeof (time_t) <= sizeof x.tv_sec ? 1 : -1 + ]; ]])], [gl_cv_sys_struct_timeval_tv_sec=yes], [gl_cv_sys_struct_timeval_tv_sec=no]) === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-06 01:29:54 +0000 +++ src/ChangeLog 2012-07-06 03:08:57 +0000 @@ -1,3 +1,13 @@ +2012-07-06 Paul Eggert + + Port to OpenBSD 5.1 amd64. + * sysdep.c [BSD_SYSTEM]: Include before . + This is needed for OpenBSD, and should be harmless on all BSD systems. + Also, include , as it should be available on all + BSD_SYSTEM hosts given that we're already calling sysctl in that case. + (list_system_processes) [__OpenBSD__]: Use DARWIN_OS style mib, but + use p_pid member, not kp_proc.pid. + 2012-07-06 Glenn Morris * Makefile.in (emacs$(EXEEXT)): Don't check for load-path shadows. === modified file 'src/sysdep.c' --- src/sysdep.c 2012-07-05 18:35:48 +0000 +++ src/sysdep.c 2012-07-06 03:08:57 +0000 @@ -38,17 +38,17 @@ #include "sysselect.h" #include "blockinput.h" +#ifdef BSD_SYSTEM +#include +#include +#endif + #ifdef __FreeBSD__ -#include #include #include #include #endif -#ifdef DARWIN_OS -#include -#endif - #ifdef WINDOWSNT #define read sys_read #define write sys_write @@ -2520,7 +2520,7 @@ Lisp_Object list_system_processes (void) { -#ifdef DARWIN_OS +#if defined DARWIN_OS || defined __OpenBSD__ int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL}; #else int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PROC}; @@ -2548,6 +2548,8 @@ { #ifdef DARWIN_OS proclist = Fcons (make_fixnum_or_float (procs[i].kp_proc.p_pid), proclist); +#elif defined __OpenBSD__ + proclist = Fcons (make_fixnum_or_float (procs[i].p_pid), proclist); #else proclist = Fcons (make_fixnum_or_float (procs[i].ki_pid), proclist); #endif ------------------------------------------------------------ revno: 108890 author: Richard Stallman committer: Glenn Morris branch nick: trunk timestamp: Thu 2012-07-05 21:54:35 -0400 message: * doc/lispref/intro.texi (A Sample Variable Description): Use @dfn more. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-07-06 01:48:45 +0000 +++ doc/lispref/ChangeLog 2012-07-06 01:54:35 +0000 @@ -1,7 +1,7 @@ 2012-07-06 Richard Stallman * intro.texi (Evaluation Notation, A Sample Function Description): - Improve/undo previous changes. + (A Sample Variable Description): Improve/undo previous changes. 2012-07-05 Glenn Morris === modified file 'doc/lispref/intro.texi' --- doc/lispref/intro.texi 2012-07-06 01:47:46 +0000 +++ doc/lispref/intro.texi 2012-07-06 01:54:35 +0000 @@ -446,9 +446,9 @@ @cindex option descriptions A @dfn{variable} is a name that can be bound to an object; binding -is frequently referred to as `setting', and the object to which -a variable is `set' is often called a `value' that the variable -`holds'. Although nearly all variables can be set by the user, +is frequently referred to as @dfn{setting}, and the object to which +a variable is set is often called a @dfn{value} that the variable +@dfn{holds}. Although nearly all variables can be set by the user, certain variables exist specifically so that users can change them; these are called @dfn{user options}. Ordinary variables and user options are described using a format like that for functions, except ------------------------------------------------------------ revno: 108889 author: Richard Stallman committer: Glenn Morris branch nick: trunk timestamp: Thu 2012-07-05 21:48:45 -0400 message: Committer missed ChangeLog for previous change. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-07-05 03:06:50 +0000 +++ doc/lispref/ChangeLog 2012-07-06 01:48:45 +0000 @@ -1,3 +1,8 @@ +2012-07-06 Richard Stallman + + * intro.texi (Evaluation Notation, A Sample Function Description): + Improve/undo previous changes. + 2012-07-05 Glenn Morris * intro.texi (A Sample Function Description): Fix cross-refs. ------------------------------------------------------------ revno: 108888 author: Richard Stallman committer: Glenn Morris branch nick: trunk timestamp: Thu 2012-07-05 21:47:46 -0400 message: * doc/lispref/intro.texi: Improve/undo previous changes. diff: === modified file 'doc/lispref/intro.texi' --- doc/lispref/intro.texi 2012-07-05 03:06:50 +0000 +++ doc/lispref/intro.texi 2012-07-06 01:47:46 +0000 @@ -235,7 +235,7 @@ @result{} c @end example - Sometimes to help describe one form, we show another form that + To help describe one form, we sometimes show another form that produces identical results. The exact equivalence of two forms is indicated with @samp{@equiv{}}. @@ -350,7 +350,7 @@ you call the function. The keyword @code{&rest} (which must be followed by a single -argument name) indicates that any number of arguments may follow. The +argument name) indicates that any number of arguments can follow. The single argument name following @code{&rest} receives, as its value, a list of all the remaining arguments passed to the function. Do not write @code{&rest} when you call the function. @@ -380,10 +380,9 @@ @end defun Any argument whose name contains the name of a type (e.g., -@var{integer}, @var{integer1} or @var{buffer}) is expected to be bound -to an object of that type. A plural of a type (such as @var{buffers}) -often means a list of objects of that type. An argument named with the -type @var{object} may be bound to an object of any type. +@var{integer}, @var{integer1} or @var{buffer}) is expected to be of that +type. A plural of a type (such as @var{buffers}) often means a list of +objects of that type. An argument named @var{object} may be of any type. (For a list of Emacs object types, @pxref{Lisp Data Types}.) An argument with some other sort of name (e.g., @var{new-file}) is discussed specifically in the description of the function. In some sections, ------------------------------------------------------------ revno: 108887 committer: Glenn Morris branch nick: trunk timestamp: Thu 2012-07-05 21:31:54 -0400 message: * lisp/Makefile.in (cvs-update): Remove old alias. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-07-05 06:57:57 +0000 +++ lisp/ChangeLog 2012-07-06 01:31:54 +0000 @@ -1,3 +1,7 @@ +2012-07-06 Glenn Morris + + * Makefile.in (cvs-update): Remove old alias. + 2012-07-05 Michael Albinus Sync with Tramp 2.2.6-pre. === modified file 'lisp/Makefile.in' --- lisp/Makefile.in 2012-06-22 21:24:54 +0000 +++ lisp/Makefile.in 2012-07-06 01:31:54 +0000 @@ -186,14 +186,13 @@ $(top_srcdir)/build-aux/update-subdirs $$file; \ done; +# Some modes of make-dist use this. updates: update-subdirs autoloads finder-data custom-deps -# This is useful after "bzr up". +# This is useful after "bzr up"; but it doesn't do anything that a +# plain "make" at top-level doesn't. bzr-update: recompile autoloads finder-data custom-deps -# For backwards compatibility: -cvs-update: bzr-update - # Update the AUTHORS file. update-authors: ------------------------------------------------------------ revno: 108886 committer: Glenn Morris branch nick: trunk timestamp: Thu 2012-07-05 21:29:54 -0400 message: * src/Makefile.in (emacs$(EXEEXT)): Don't check for load-path shadows. It has nothing to do with building Emacs, and no-one is likely to be paying attention to the result. The CANNOT_DUMP branch was pointless, since it sets EMACSLOADPATH=$(lispsource) it is impossible for there to ever be any shadows. The EMACSLOADPATH setting was probably necessary for emacs to work at all when uninstalled, given the way init_lread works for the CANNOT_DUMP case. Since -batch implies -q, in the non-CANNOT_DUMP branch, any shadows could only come from site-lisp files. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-05 18:35:48 +0000 +++ src/ChangeLog 2012-07-06 01:29:54 +0000 @@ -1,3 +1,7 @@ +2012-07-06 Glenn Morris + + * Makefile.in (emacs$(EXEEXT)): Don't check for load-path shadows. + 2012-07-05 Paul Eggert More xmalloc and related cleanup. === modified file 'src/Makefile.in' --- src/Makefile.in 2012-06-26 01:05:39 +0000 +++ src/Makefile.in 2012-07-06 01:29:54 +0000 @@ -395,7 +395,6 @@ $(leimdir)/leim-list.el: bootstrap-emacs$(EXEEXT) cd $(leimdir) && $(MAKE) $(MFLAGS) leim-list.el EMACS=$(bootstrap_exe) -## Does anyone ever pay attention to the load-path-shadows output here? ## The dumped Emacs is as functional and more efficient than ## bootstrap-emacs, so we replace the latter with the former. ## Strictly speaking, emacs does not depend directly on all of $lisp, @@ -404,13 +403,10 @@ emacs$(EXEEXT): temacs$(EXEEXT) $(etc)/DOC $(lisp) $(leimdir)/leim-list.el if test "$(CANNOT_DUMP)" = "yes"; then \ ln -f temacs$(EXEEXT) emacs$(EXEEXT); \ - EMACSLOADPATH=$(lispsource) ./emacs -batch \ - -f list-load-path-shadows || true; \ else \ LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \ test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \ ln -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ - ./emacs -batch -f list-load-path-shadows || true; \ fi ## We run make-docfile twice because the command line may get too long ------------------------------------------------------------ revno: 108885 committer: Paul Eggert branch nick: trunk timestamp: Thu 2012-07-05 11:35:48 -0700 message: More xmalloc and related cleanup. * alloc.c, bidi.c, buffer.c, buffer.h, bytecode.c, callint.c: * callproc.c, charset.c, coding.c, composite.c, data.c, dispnew.c: * doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, fns.c: * font.c, fontset.c, frame.c, fringe.c, ftfont.c, ftxfont.c, gmalloc.c: * gtkutil.c, image.c, keyboard.c, keymap.c, lread.c, macros.c, menu.c: * nsfns.m, nsfont.m, nsmenu.m, nsterm.m, print.c, process.c, ralloc.c: * regex.c, region-cache.c, scroll.c, search.c, sound.c, syntax.c: * sysdep.c, term.c, termcap.c, unexmacosx.c, window.c, xdisp.c: * xfaces.c, xfns.c, xftfont.c, xgselect.c, xmenu.c, xrdb.c, xselect.c: * xterm.c: Omit needless casts involving void * pointers and allocation. Prefer "P = xmalloc (sizeof *P)" to "P = xmalloc (sizeof (TYPE_OF_P))", as the former is more robust if P's type is changed. Prefer xzalloc to xmalloc + memset 0. Simplify malloc-or-realloc to realloc. Don't worry about xmalloc returning a null pointer. Prefer xstrdup to xmalloc + strcpy. * editfns.c (Fmessage_box): Grow message_text by at least 80 when growing it. * keyboard.c (apply_modifiers_uncached): Prefer local array to alloca of a constant. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-05 16:28:34 +0000 +++ src/ChangeLog 2012-07-05 18:35:48 +0000 @@ -1,3 +1,28 @@ +2012-07-05 Paul Eggert + + More xmalloc and related cleanup. + * alloc.c, bidi.c, buffer.c, buffer.h, bytecode.c, callint.c: + * callproc.c, charset.c, coding.c, composite.c, data.c, dispnew.c: + * doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, fns.c: + * font.c, fontset.c, frame.c, fringe.c, ftfont.c, ftxfont.c, gmalloc.c: + * gtkutil.c, image.c, keyboard.c, keymap.c, lread.c, macros.c, menu.c: + * nsfns.m, nsfont.m, nsmenu.m, nsterm.m, print.c, process.c, ralloc.c: + * regex.c, region-cache.c, scroll.c, search.c, sound.c, syntax.c: + * sysdep.c, term.c, termcap.c, unexmacosx.c, window.c, xdisp.c: + * xfaces.c, xfns.c, xftfont.c, xgselect.c, xmenu.c, xrdb.c, xselect.c: + * xterm.c: + Omit needless casts involving void * pointers and allocation. + Prefer "P = xmalloc (sizeof *P)" to "P = xmalloc (sizeof (TYPE_OF_P))", + as the former is more robust if P's type is changed. + Prefer xzalloc to xmalloc + memset 0. + Simplify malloc-or-realloc to realloc. + Don't worry about xmalloc returning a null pointer. + Prefer xstrdup to xmalloc + strcpy. + * editfns.c (Fmessage_box): Grow message_text by at least 80 when + growing it. + * keyboard.c (apply_modifiers_uncached): Prefer local array to + alloca of a constant. + 2012-07-05 Eli Zaretskii * xdisp.c (display_line): Fix horizontal pixel coordinates when === modified file 'src/alloc.c' --- src/alloc.c 2012-07-05 06:32:41 +0000 +++ src/alloc.c 2012-07-05 18:35:48 +0000 @@ -615,7 +615,7 @@ if (SIZE_MAX - overhead < size) abort (); - val = (unsigned char *) malloc (size + overhead); + val = malloc (size + overhead); if (val && check_depth == 1) { memcpy (val, xmalloc_overrun_check_header, XMALLOC_OVERRUN_CHECK_SIZE); @@ -923,7 +923,7 @@ allocated_mem_type = type; #endif - val = (void *) malloc (nbytes); + val = malloc (nbytes); #if ! USE_LSB_TAG /* If the memory just allocated cannot be addressed thru a Lisp @@ -1309,7 +1309,7 @@ __malloc_extra_blocks = malloc_hysteresis; #endif - value = (void *) malloc (size); + value = malloc (size); #ifdef GC_MALLOC_CHECK { @@ -1371,7 +1371,7 @@ dont_register_blocks = 1; #endif /* GC_MALLOC_CHECK */ - value = (void *) realloc (ptr, size); + value = realloc (ptr, size); #ifdef GC_MALLOC_CHECK dont_register_blocks = 0; @@ -1523,10 +1523,8 @@ { if (interval_block_index == INTERVAL_BLOCK_SIZE) { - register struct interval_block *newi; - - newi = (struct interval_block *) lisp_malloc (sizeof *newi, - MEM_TYPE_NON_LISP); + struct interval_block *newi + = lisp_malloc (sizeof *newi, MEM_TYPE_NON_LISP); newi->next = interval_block; interval_block = newi; @@ -1932,10 +1930,9 @@ add all the Lisp_Strings in it to the free-list. */ if (string_free_list == NULL) { - struct string_block *b; + struct string_block *b = lisp_malloc (sizeof *b, MEM_TYPE_STRING); int i; - b = (struct string_block *) lisp_malloc (sizeof *b, MEM_TYPE_STRING); b->next = string_blocks; string_blocks = b; @@ -2021,7 +2018,7 @@ mallopt (M_MMAP_MAX, 0); #endif - b = (struct sblock *) lisp_malloc (size + GC_STRING_EXTRA, MEM_TYPE_NON_LISP); + b = lisp_malloc (size + GC_STRING_EXTRA, MEM_TYPE_NON_LISP); #ifdef DOUG_LEA_MALLOC /* Back to a reasonable maximum of mmap'ed areas. */ @@ -2039,7 +2036,7 @@ < (needed + GC_STRING_EXTRA))) { /* Not enough room in the current sblock. */ - b = (struct sblock *) lisp_malloc (SBLOCK_SIZE, MEM_TYPE_NON_LISP); + b = lisp_malloc (SBLOCK_SIZE, MEM_TYPE_NON_LISP); b->next_free = &b->first_data; b->first_data.string = NULL; b->next = NULL; @@ -2619,10 +2616,8 @@ { if (float_block_index == FLOAT_BLOCK_SIZE) { - register struct float_block *new; - - new = (struct float_block *) lisp_align_malloc (sizeof *new, - MEM_TYPE_FLOAT); + struct float_block *new + = lisp_align_malloc (sizeof *new, MEM_TYPE_FLOAT); new->next = float_block; memset (new->gcmarkbits, 0, sizeof new->gcmarkbits); float_block = new; @@ -2738,9 +2733,8 @@ { if (cons_block_index == CONS_BLOCK_SIZE) { - register struct cons_block *new; - new = (struct cons_block *) lisp_align_malloc (sizeof *new, - MEM_TYPE_CONS); + struct cons_block *new + = lisp_align_malloc (sizeof *new, MEM_TYPE_CONS); memset (new->gcmarkbits, 0, sizeof new->gcmarkbits); new->next = cons_block; cons_block = new; @@ -2972,7 +2966,7 @@ static struct vector_block * allocate_vector_block (void) { - struct vector_block *block = xmalloc (sizeof (struct vector_block)); + struct vector_block *block = xmalloc (sizeof *block); #if GC_MARK_STACK && !defined GC_MALLOC_CHECK mem_insert (block->data, block->data + VECTOR_BLOCK_BYTES, @@ -3198,7 +3192,7 @@ p = allocate_vector_from_block (vroundup (nbytes)); else { - p = (struct Lisp_Vector *) lisp_malloc (nbytes, MEM_TYPE_VECTORLIKE); + p = lisp_malloc (nbytes, MEM_TYPE_VECTORLIKE); p->header.next.vector = large_vectors; large_vectors = p; } @@ -3253,7 +3247,7 @@ struct buffer * allocate_buffer (void) { - struct buffer *b = lisp_malloc (sizeof (struct buffer), MEM_TYPE_BUFFER); + struct buffer *b = lisp_malloc (sizeof *b, MEM_TYPE_BUFFER); XSETPVECTYPESIZE (b, PVEC_BUFFER, (offsetof (struct buffer, own_text) - header_size) / word_size); @@ -3487,9 +3481,8 @@ { if (symbol_block_index == SYMBOL_BLOCK_SIZE) { - struct symbol_block *new; - new = (struct symbol_block *) lisp_malloc (sizeof *new, - MEM_TYPE_SYMBOL); + struct symbol_block *new + = lisp_malloc (sizeof *new, MEM_TYPE_SYMBOL); new->next = symbol_block; symbol_block = new; symbol_block_index = 0; @@ -3580,9 +3573,7 @@ { if (marker_block_index == MARKER_BLOCK_SIZE) { - struct marker_block *new; - new = (struct marker_block *) lisp_malloc (sizeof *new, - MEM_TYPE_MISC); + struct marker_block *new = lisp_malloc (sizeof *new, MEM_TYPE_MISC); new->next = marker_block; marker_block = new; marker_block_index = 0; @@ -3775,25 +3766,25 @@ { #ifndef SYSTEM_MALLOC if (spare_memory[0] == 0) - spare_memory[0] = (char *) malloc (SPARE_MEMORY); + spare_memory[0] = malloc (SPARE_MEMORY); if (spare_memory[1] == 0) - spare_memory[1] = (char *) lisp_align_malloc (sizeof (struct cons_block), + spare_memory[1] = lisp_align_malloc (sizeof (struct cons_block), MEM_TYPE_CONS); if (spare_memory[2] == 0) - spare_memory[2] = (char *) lisp_align_malloc (sizeof (struct cons_block), - MEM_TYPE_CONS); + spare_memory[2] = lisp_align_malloc (sizeof (struct cons_block), + MEM_TYPE_CONS); if (spare_memory[3] == 0) - spare_memory[3] = (char *) lisp_align_malloc (sizeof (struct cons_block), - MEM_TYPE_CONS); + spare_memory[3] = lisp_align_malloc (sizeof (struct cons_block), + MEM_TYPE_CONS); if (spare_memory[4] == 0) - spare_memory[4] = (char *) lisp_align_malloc (sizeof (struct cons_block), - MEM_TYPE_CONS); + spare_memory[4] = lisp_align_malloc (sizeof (struct cons_block), + MEM_TYPE_CONS); if (spare_memory[5] == 0) - spare_memory[5] = (char *) lisp_malloc (sizeof (struct string_block), - MEM_TYPE_STRING); + spare_memory[5] = lisp_malloc (sizeof (struct string_block), + MEM_TYPE_STRING); if (spare_memory[6] == 0) - spare_memory[6] = (char *) lisp_malloc (sizeof (struct string_block), - MEM_TYPE_STRING); + spare_memory[6] = lisp_malloc (sizeof (struct string_block), + MEM_TYPE_STRING); if (spare_memory[0] && spare_memory[1] && spare_memory[5]) Vmemory_full = Qnil; #endif @@ -3893,7 +3884,7 @@ /* Create a new node. */ #ifdef GC_MALLOC_CHECK - x = (struct mem_node *) _malloc_internal (sizeof *x); + x = _malloc_internal (sizeof *x); if (x == NULL) abort (); #else @@ -5441,7 +5432,7 @@ { if (stack_copy_size < stack_size) { - stack_copy = (char *) xrealloc (stack_copy, stack_size); + stack_copy = xrealloc (stack_copy, stack_size); stack_copy_size = stack_size; } memcpy (stack_copy, stack, stack_size); === modified file 'src/bidi.c' --- src/bidi.c 2012-06-28 07:50:27 +0000 +++ src/bidi.c 2012-07-05 18:35:48 +0000 @@ -361,8 +361,7 @@ { if (bidi_cache_size > BIDI_CACHE_CHUNK) { - bidi_cache - = (struct bidi_it *) xrealloc (bidi_cache, BIDI_CACHE_CHUNK * elsz); + bidi_cache = xrealloc (bidi_cache, BIDI_CACHE_CHUNK * elsz); bidi_cache_size = BIDI_CACHE_CHUNK; } bidi_cache_reset (); === modified file 'src/buffer.c' --- src/buffer.c 2012-07-05 06:32:41 +0000 +++ src/buffer.c 2012-07-05 18:35:48 +0000 @@ -2793,11 +2793,11 @@ Lisp_Object *v, tem; size = 10; - v = (Lisp_Object *) alloca (size * sizeof *v); + v = alloca (size * sizeof *v); n = overlays_in (start, end, 0, &v, &size, NULL, NULL); if (n > size) { - v = (Lisp_Object *) alloca (n * sizeof *v); + v = alloca (n * sizeof *v); overlays_in (start, end, 0, &v, &n, NULL, NULL); } @@ -2885,8 +2885,7 @@ sort_overlays (Lisp_Object *overlay_vec, ptrdiff_t noverlays, struct window *w) { ptrdiff_t i, j; - struct sortvec *sortvec; - sortvec = (struct sortvec *) alloca (noverlays * sizeof (struct sortvec)); + struct sortvec *sortvec = alloca (noverlays * sizeof *sortvec); /* Put the valid and relevant overlays into sortvec. */ @@ -3893,7 +3892,7 @@ len = 10; /* We can't use alloca here because overlays_at can call xrealloc. */ - overlay_vec = xmalloc (len * sizeof (Lisp_Object)); + overlay_vec = xmalloc (len * sizeof *overlay_vec); /* Put all the overlays we want in a vector in overlay_vec. Store the length in len. */ @@ -3924,7 +3923,7 @@ CHECK_NUMBER_COERCE_MARKER (end); len = 10; - overlay_vec = xmalloc (len * sizeof (Lisp_Object)); + overlay_vec = xmalloc (len * sizeof *overlay_vec); /* Put all the overlays we want in a vector in overlay_vec. Store the length in len. */ @@ -3952,7 +3951,7 @@ CHECK_NUMBER_COERCE_MARKER (pos); len = 10; - overlay_vec = xmalloc (len * sizeof (Lisp_Object)); + overlay_vec = xmalloc (len * sizeof *overlay_vec); /* Put all the overlays we want in a vector in overlay_vec. Store the length in len. @@ -3996,7 +3995,7 @@ return pos; len = 10; - overlay_vec = xmalloc (len * sizeof (Lisp_Object)); + overlay_vec = xmalloc (len * sizeof *overlay_vec); /* Put all the overlays we want in a vector in overlay_vec. Store the length in len. @@ -4251,7 +4250,7 @@ First copy the vector contents, in case some of these hooks do subsequent modification of the buffer. */ ptrdiff_t size = last_overlay_modification_hooks_used; - Lisp_Object *copy = (Lisp_Object *) alloca (size * sizeof (Lisp_Object)); + Lisp_Object *copy = alloca (size * sizeof *copy); ptrdiff_t i; memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents, @@ -4873,7 +4872,7 @@ /* If you add, remove, or reorder Lisp_Objects in a struct buffer, make sure that this is still correct. Otherwise, mark_vectorlike may not trace all Lisp_Objects in buffer_defaults and buffer_local_symbols. */ - const int pvecsize + const int pvecsize = (offsetof (struct buffer, own_text) - sizeof (struct vectorlike_header)) / sizeof (Lisp_Object); @@ -5089,7 +5088,7 @@ if (!(IS_DIRECTORY_SEP (pwd[len - 1]))) { /* Grow buffer to add directory separator and '\0'. */ - pwd = (char *) realloc (pwd, len + 2); + pwd = realloc (pwd, len + 2); if (!pwd) fatal ("`get_current_dir_name' failed: %s\n", strerror (errno)); pwd[len] = DIRECTORY_SEP; === modified file 'src/buffer.h' --- src/buffer.h 2012-07-03 18:24:42 +0000 +++ src/buffer.h 2012-07-05 18:35:48 +0000 @@ -918,13 +918,13 @@ #define GET_OVERLAYS_AT(posn, overlays, noverlays, nextp, chrq) \ do { \ ptrdiff_t maxlen = 40; \ - overlays = (Lisp_Object *) alloca (maxlen * sizeof (Lisp_Object)); \ + overlays = alloca (maxlen * sizeof *overlays); \ noverlays = overlays_at (posn, 0, &overlays, &maxlen, \ nextp, NULL, chrq); \ if (noverlays > maxlen) \ { \ maxlen = noverlays; \ - overlays = (Lisp_Object *) alloca (maxlen * sizeof (Lisp_Object)); \ + overlays = alloca (maxlen * sizeof *overlays); \ noverlays = overlays_at (posn, 0, &overlays, &maxlen, \ nextp, NULL, chrq); \ } \ === modified file 'src/bytecode.c' --- src/bytecode.c 2012-06-19 16:56:28 +0000 +++ src/bytecode.c 2012-07-05 18:35:48 +0000 @@ -488,8 +488,7 @@ stack.constants = vector; if (MAX_ALLOCA / sizeof (Lisp_Object) <= XFASTINT (maxdepth)) memory_full (SIZE_MAX); - top = (Lisp_Object *) alloca ((XFASTINT (maxdepth) + 1) - * sizeof (Lisp_Object)); + top = alloca ((XFASTINT (maxdepth) + 1) * sizeof *top); #if BYTE_MAINTAIN_TOP stack.bottom = top + 1; stack.top = NULL; === modified file 'src/callint.c' --- src/callint.c 2012-06-16 12:24:15 +0000 +++ src/callint.c 2012-07-05 18:35:48 +0000 @@ -331,7 +331,7 @@ { /* Make a copy of string so that if a GC relocates specs, `string' will still be valid. */ - string = (char *) alloca (SBYTES (specs) + 1); + string = alloca (SBYTES (specs) + 1); memcpy (string, SSDATA (specs), SBYTES (specs) + 1); } else @@ -469,9 +469,9 @@ < nargs) memory_full (SIZE_MAX); - args = (Lisp_Object *) alloca (nargs * sizeof (Lisp_Object)); - visargs = (Lisp_Object *) alloca (nargs * sizeof (Lisp_Object)); - varies = (signed char *) alloca (nargs); + args = alloca (nargs * sizeof *args); + visargs = alloca (nargs * sizeof *visargs); + varies = alloca (nargs * sizeof *varies); for (i = 0; i < nargs; i++) { === modified file 'src/callproc.c' --- src/callproc.c 2012-07-05 06:32:41 +0000 +++ src/callproc.c 2012-07-05 18:35:48 +0000 @@ -1174,7 +1174,7 @@ on that. */ pwd_var = xmalloc (i + 6); #else - pwd_var = (char *) alloca (i + 6); + pwd_var = alloca (i + 6); #endif temp = pwd_var + 4; memcpy (pwd_var, "PWD=", 4); @@ -1242,7 +1242,7 @@ } /* new_length + 2 to include PWD and terminating 0. */ - env = new_env = (char **) alloca ((new_length + 2) * sizeof (char *)); + env = new_env = alloca ((new_length + 2) * sizeof *env); /* If we have a PWD envvar, pass one down, but with corrected value. */ if (egetenv ("PWD")) @@ -1250,7 +1250,7 @@ if (STRINGP (display)) { - char *vdata = (char *) alloca (sizeof "DISPLAY=" + SBYTES (display)); + char *vdata = alloca (sizeof "DISPLAY=" + SBYTES (display)); strcpy (vdata, "DISPLAY="); strcat (vdata, SSDATA (display)); new_env = add_env (env, new_env, vdata); === modified file 'src/charset.c' --- src/charset.c 2012-07-05 06:32:41 +0000 +++ src/charset.c 2012-07-05 18:35:48 +0000 @@ -294,7 +294,7 @@ else { if (! temp_charset_work) - temp_charset_work = xmalloc (sizeof (*temp_charset_work)); + temp_charset_work = xmalloc (sizeof *temp_charset_work); if (control_flag == 1) { memset (temp_charset_work->table.decoder, -1, === modified file 'src/coding.c' --- src/coding.c 2012-07-05 06:32:41 +0000 +++ src/coding.c 2012-07-05 18:35:48 +0000 @@ -1145,8 +1145,8 @@ { if (STRING_BYTES_BOUND - coding->dst_bytes < bytes) string_overflow (); - coding->destination = (unsigned char *) xrealloc (coding->destination, - coding->dst_bytes + bytes); + coding->destination = xrealloc (coding->destination, + coding->dst_bytes + bytes); coding->dst_bytes += bytes; } @@ -7010,7 +7010,7 @@ coding->charbuf = NULL; \ while (size > 1024) \ { \ - coding->charbuf = (int *) alloca (sizeof (int) * size); \ + coding->charbuf = alloca (sizeof (int) * size); \ if (coding->charbuf) \ break; \ size >>= 1; \ @@ -9568,7 +9568,7 @@ { Lisp_Object subsidiaries; ptrdiff_t base_name_len = SBYTES (SYMBOL_NAME (base)); - char *buf = (char *) alloca (base_name_len + 6); + char *buf = alloca (base_name_len + 6); int i; memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len); === modified file 'src/composite.c' --- src/composite.c 2012-07-05 06:32:41 +0000 +++ src/composite.c 2012-07-05 18:35:48 +0000 @@ -326,7 +326,7 @@ memory_full (SIZE_MAX); /* Register the composition in composition_table. */ - cmp = xmalloc (sizeof (struct composition)); + cmp = xmalloc (sizeof *cmp); cmp->method = method; cmp->hash_index = hash_index; === modified file 'src/data.c' --- src/data.c 2012-06-27 21:15:13 +0000 +++ src/data.c 2012-07-05 18:35:48 +0000 @@ -1463,8 +1463,7 @@ static struct Lisp_Buffer_Local_Value * make_blv (struct Lisp_Symbol *sym, int forwarded, union Lisp_Val_Fwd valcontents) { - struct Lisp_Buffer_Local_Value *blv - = xmalloc (sizeof (struct Lisp_Buffer_Local_Value)); + struct Lisp_Buffer_Local_Value *blv = xmalloc (sizeof *blv); Lisp_Object symbol; Lisp_Object tem; === modified file 'src/dispnew.c' --- src/dispnew.c 2012-07-05 06:32:41 +0000 +++ src/dispnew.c 2012-07-05 18:35:48 +0000 @@ -2023,9 +2023,7 @@ save_current_matrix (struct frame *f) { int i; - struct glyph_matrix *saved; - - saved = xzalloc (sizeof *saved); + struct glyph_matrix *saved = xzalloc (sizeof *saved); saved->nrows = f->current_matrix->nrows; saved->rows = xzalloc (saved->nrows * sizeof *saved->rows); @@ -2243,16 +2241,8 @@ static void adjust_frame_message_buffer (struct frame *f) { - ptrdiff_t size = FRAME_MESSAGE_BUF_SIZE (f) + 1; - - if (FRAME_MESSAGE_BUF (f)) - { - char *buffer = FRAME_MESSAGE_BUF (f); - char *new_buffer = (char *) xrealloc (buffer, size); - FRAME_MESSAGE_BUF (f) = new_buffer; - } - else - FRAME_MESSAGE_BUF (f) = xmalloc (size); + FRAME_MESSAGE_BUF (f) = xrealloc (FRAME_MESSAGE_BUF (f), + FRAME_MESSAGE_BUF_SIZE (f) + 1); } @@ -2261,9 +2251,8 @@ static void adjust_decode_mode_spec_buffer (struct frame *f) { - f->decode_mode_spec_buffer - = (char *) xrealloc (f->decode_mode_spec_buffer, - FRAME_MESSAGE_BUF_SIZE (f) + 1); + f->decode_mode_spec_buffer = xrealloc (f->decode_mode_spec_buffer, + FRAME_MESSAGE_BUF_SIZE (f) + 1); } @@ -2810,7 +2799,7 @@ int i; /* Make a copy of the original rows. */ - old_rows = (struct glyph_row *) alloca (nlines * sizeof *old_rows); + old_rows = alloca (nlines * sizeof *old_rows); memcpy (old_rows, new_rows, nlines * sizeof *old_rows); /* Assign new rows, maybe clear lines. */ @@ -2928,7 +2917,7 @@ struct glyph_row *old_rows; /* Make a copy of the original rows of matrix m. */ - old_rows = (struct glyph_row *) alloca (m->nrows * sizeof *old_rows); + old_rows = alloca (m->nrows * sizeof *old_rows); memcpy (old_rows, m->rows, m->nrows * sizeof *old_rows); for (i = 0; i < nlines; ++i) @@ -4845,10 +4834,10 @@ int unchanged_at_top, unchanged_at_bottom; int window_size; int changed_lines; - int *old_hash = (int *) alloca (FRAME_LINES (frame) * sizeof (int)); - int *new_hash = (int *) alloca (FRAME_LINES (frame) * sizeof (int)); - int *draw_cost = (int *) alloca (FRAME_LINES (frame) * sizeof (int)); - int *old_draw_cost = (int *) alloca (FRAME_LINES (frame) * sizeof (int)); + int *old_hash = alloca (FRAME_LINES (frame) * sizeof (int)); + int *new_hash = alloca (FRAME_LINES (frame) * sizeof (int)); + int *draw_cost = alloca (FRAME_LINES (frame) * sizeof (int)); + int *old_draw_cost = alloca (FRAME_LINES (frame) * sizeof (int)); register int i; int free_at_end_vpos = FRAME_LINES (frame); struct glyph_matrix *current_matrix = frame->current_matrix; === modified file 'src/doc.c' --- src/doc.c 2012-07-05 06:32:41 +0000 +++ src/doc.c 2012-07-05 18:35:48 +0000 @@ -577,14 +577,13 @@ (0) #endif /* CANNOT_DUMP */ { - name = (char *) alloca (SCHARS (filename) + 14); + name = alloca (SCHARS (filename) + 14); strcpy (name, "../etc/"); } else { CHECK_STRING (Vdoc_directory); - name = (char *) alloca (SCHARS (filename) - + SCHARS (Vdoc_directory) + 1); + name = alloca (SCHARS (filename) + SCHARS (Vdoc_directory) + 1); strcpy (name, SSDATA (Vdoc_directory)); } strcat (name, SSDATA (filename)); /*** Add this line ***/ @@ -828,7 +827,7 @@ ptrdiff_t offset = bufp - buf; if (STRING_BYTES_BOUND - 4 < bsize) string_overflow (); - buf = (char *) xrealloc (buf, bsize += 4); + buf = xrealloc (buf, bsize += 4); bufp = buf + offset; memcpy (bufp, "M-x ", 4); bufp += 4; @@ -924,7 +923,7 @@ ptrdiff_t offset = bufp - buf; if (STRING_BYTES_BOUND - length_byte < bsize) string_overflow (); - buf = (char *) xrealloc (buf, bsize += length_byte); + buf = xrealloc (buf, bsize += length_byte); bufp = buf + offset; memcpy (bufp, start, length_byte); bufp += length_byte; === modified file 'src/editfns.c' --- src/editfns.c 2012-07-05 16:00:20 +0000 +++ src/editfns.c 2012-07-05 18:35:48 +0000 @@ -397,14 +397,14 @@ /* First try with room for 40 overlays. */ noverlays = 40; - overlay_vec = (Lisp_Object *) alloca (noverlays * sizeof (Lisp_Object)); + overlay_vec = alloca (noverlays * sizeof *overlay_vec); noverlays = overlays_around (posn, overlay_vec, noverlays); /* If there are more than 40, make enough space for all, and try again. */ if (noverlays > 40) { - overlay_vec = (Lisp_Object *) alloca (noverlays * sizeof (Lisp_Object)); + overlay_vec = alloca (noverlays * sizeof *overlay_vec); noverlays = overlays_around (posn, overlay_vec, noverlays); } noverlays = sort_overlays (overlay_vec, noverlays, NULL); @@ -1330,7 +1330,7 @@ Lisp_Object login; login = Fuser_login_name (make_number (pw->pw_uid)); - r = (char *) alloca (strlen (p) + SCHARS (login) + 1); + r = alloca (strlen (p) + SCHARS (login) + 1); memcpy (r, p, q - p); r[q - p] = 0; strcat (r, SSDATA (login)); @@ -2154,7 +2154,7 @@ for (from = environ; *from; from++) continue; envptrs = from - environ + 2; - newenv = to = xmalloc (envptrs * sizeof (char *) + newenv = to = xmalloc (envptrs * sizeof *newenv + (tzstring ? strlen (tzstring) + 4 : 0)); /* Add TZSTRING to the end of environ, as a value for TZ. */ @@ -3472,15 +3472,11 @@ } #endif /* HAVE_MENUS */ /* Copy the data so that it won't move when we GC. */ - if (! message_text) - { - message_text = xmalloc (80); - message_length = 80; - } if (SBYTES (val) > message_length) { - message_text = (char *) xrealloc (message_text, SBYTES (val)); - message_length = SBYTES (val); + ptrdiff_t new_length = SBYTES (val) + 80; + message_text = xrealloc (message_text, new_length); + message_length = new_length; } memcpy (message_text, SDATA (val), SBYTES (val)); message2 (message_text, SBYTES (val), === modified file 'src/emacs.c' --- src/emacs.c 2012-07-05 06:32:41 +0000 +++ src/emacs.c 2012-07-05 18:35:48 +0000 @@ -1820,7 +1820,7 @@ static void sort_args (int argc, char **argv) { - char **new = xmalloc (sizeof (char *) * argc); + char **new = xmalloc (argc * sizeof *new); /* For each element of argv, the corresponding element of options is: 0 for an option that takes no arguments, === modified file 'src/eval.c' --- src/eval.c 2012-07-05 06:32:41 +0000 +++ src/eval.c 2012-07-05 18:35:48 +0000 @@ -138,7 +138,7 @@ init_eval_once (void) { enum { size = 50 }; - specpdl = xmalloc (size * sizeof (struct specbinding)); + specpdl = xmalloc (size * sizeof *specpdl); specpdl_size = size; specpdl_ptr = specpdl; /* Don't forget to update docs (lispref node "Local Variables"). */ @@ -2803,7 +2803,8 @@ { if (XSUBR (fun)->max_args > numargs) { - internal_args = (Lisp_Object *) alloca (XSUBR (fun)->max_args * sizeof (Lisp_Object)); + internal_args = alloca (XSUBR (fun)->max_args + * sizeof *internal_args); memcpy (internal_args, args + 1, numargs * sizeof (Lisp_Object)); for (i = numargs; i < XSUBR (fun)->max_args; i++) internal_args[i] = Qnil; === modified file 'src/fileio.c' --- src/fileio.c 2012-07-05 04:16:11 +0000 +++ src/fileio.c 2012-07-05 18:35:48 +0000 @@ -336,7 +336,7 @@ filename = FILE_SYSTEM_CASE (filename); #ifdef DOS_NT - beg = (char *) alloca (SBYTES (filename) + 1); + beg = alloca (SBYTES (filename) + 1); memcpy (beg, SSDATA (filename), SBYTES (filename) + 1); #else beg = SSDATA (filename); @@ -510,7 +510,7 @@ error ("Invalid handler in `file-name-handler-alist'"); } - buf = (char *) alloca (SBYTES (file) + 10); + buf = alloca (SBYTES (file) + 10); file_name_as_directory (buf, SSDATA (file)); return make_specified_string (buf, -1, strlen (buf), STRING_MULTIBYTE (file)); @@ -575,7 +575,7 @@ error ("Invalid handler in `file-name-handler-alist'"); } - buf = (char *) alloca (SBYTES (directory) + 20); + buf = alloca (SBYTES (directory) + 20); directory_file_name (SSDATA (directory), buf); return make_specified_string (buf, -1, strlen (buf), STRING_MULTIBYTE (directory)); @@ -878,7 +878,7 @@ } /* Make a local copy of nm[] to protect it from GC in DECODE_FILE below. */ - nm = (char *) alloca (SBYTES (name) + 1); + nm = alloca (SBYTES (name) + 1); memcpy (nm, SSDATA (name), SBYTES (name) + 1); #ifdef DOS_NT @@ -1186,7 +1186,7 @@ #endif ) { - char *temp = (char *) alloca (length); + char *temp = alloca (length); memcpy (temp, newdir, length - 1); temp[length - 1] = 0; newdir = temp; @@ -1202,10 +1202,10 @@ /* Reserve space for drive specifier and escape prefix, since either or both may need to be inserted. (The Microsoft x86 compiler produces incorrect code if the following two lines are combined.) */ - target = (char *) alloca (tlen + 4); + target = alloca (tlen + 4); target += 4; #else /* not DOS_NT */ - target = (char *) alloca (tlen); + target = alloca (tlen); #endif /* not DOS_NT */ *target = 0; @@ -1415,7 +1415,7 @@ unsigned char *ptr = (unsigned char *) strchr (user, '/'); ptrdiff_t len = ptr ? ptr - user : strlen (user); /* Copy the user name into temp storage. */ - o = (unsigned char *) alloca (len + 1); + o = alloca (len + 1); memcpy (o, user, len); o[len] = 0; @@ -1443,7 +1443,7 @@ /* Now concatenate the directory and name to new space in the stack frame. */ tlen = (newdir ? strlen (newdir) + 1 : 0) + strlen (nm) + 1; - target = (unsigned char *) alloca (tlen); + target = alloca (tlen); *target = 0; if (newdir) @@ -1593,7 +1593,7 @@ /* Always work on a copy of the string, in case GC happens during decode of environment variables, causing the original Lisp_String data to be relocated. */ - nm = (char *) alloca (SBYTES (filename) + 1); + nm = alloca (SBYTES (filename) + 1); memcpy (nm, SDATA (filename), SBYTES (filename) + 1); #ifdef DOS_NT @@ -1645,7 +1645,7 @@ } /* Copy out the variable name. */ - target = (char *) alloca (s - o + 1); + target = alloca (s - o + 1); strncpy (target, o, s - o); target[s - o] = 0; #ifdef DOS_NT @@ -1676,7 +1676,7 @@ /* If substitution required, recopy the string and do it. */ /* Make space in stack frame for the new copy. */ - xnm = (char *) alloca (SBYTES (filename) + total + 1); + xnm = alloca (SBYTES (filename) + total + 1); x = xnm; /* Copy the rest of the name through, replacing $ constructs with values. */ @@ -1708,7 +1708,7 @@ } /* Copy out the variable name. */ - target = (char *) alloca (s - o + 1); + target = alloca (s - o + 1); strncpy (target, o, s - o); target[s - o] = 0; #ifdef DOS_NT === modified file 'src/filelock.c' --- src/filelock.c 2012-07-05 06:32:41 +0000 +++ src/filelock.c 2012-07-05 18:35:48 +0000 @@ -294,7 +294,7 @@ trailing period plus one for the digit after it plus one for the null. */ #define MAKE_LOCK_NAME(lock, file) \ - (lock = (char *) alloca (SBYTES (file) + 2 + 1 + 1 + 1), \ + (lock = alloca (SBYTES (file) + 2 + 1 + 1 + 1), \ fill_in_lock_file_name (lock, (file))) static void === modified file 'src/fns.c' --- src/fns.c 2012-07-05 06:32:41 +0000 +++ src/fns.c 2012-07-05 18:35:48 +0000 @@ -4347,7 +4347,7 @@ /* The vector `used' is used to keep track of arguments that have been consumed. */ - used = (char *) alloca (nargs * sizeof *used); + used = alloca (nargs * sizeof *used); memset (used, 0, nargs * sizeof *used); /* See if there's a `:test TEST' among the arguments. */ === modified file 'src/font.c' --- src/font.c 2012-06-30 09:13:54 +0000 +++ src/font.c 2012-07-05 18:35:48 +0000 @@ -3402,7 +3402,7 @@ if (EQ (list->driver->type, driver->type)) error ("Duplicated font driver: %s", SDATA (SYMBOL_NAME (driver->type))); - list = xmalloc (sizeof (struct font_driver_list)); + list = xmalloc (sizeof *list); list->on = 0; list->driver = driver; list->next = NULL; @@ -3552,7 +3552,7 @@ if (! list) { - list = xmalloc (sizeof (struct font_data_list)); + list = xmalloc (sizeof *list); list->driver = driver; list->next = f->font_data_list; f->font_data_list = list; === modified file 'src/fontset.c' --- src/fontset.c 2012-06-28 07:50:50 +0000 +++ src/fontset.c 2012-07-05 18:35:48 +0000 @@ -1082,9 +1082,9 @@ we convert "*" to "[^-]*" which is much faster in regular expression matching. */ if (ndashes < 14) - p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 2 * nstars + 2 * nescs + 1); + p1 = regex = alloca (SBYTES (pattern) + 2 * nstars + 2 * nescs + 1); else - p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 5 * nstars + 2 * nescs + 1); + p1 = regex = alloca (SBYTES (pattern) + 5 * nstars + 2 * nescs + 1); *p1++ = '^'; for (p0 = SDATA (pattern); *p0; p0++) @@ -1893,8 +1893,7 @@ /* Recode fontsets realized on FRAME from the base fontset FONTSET in the table `realized'. */ - realized[0] = (Lisp_Object *) alloca (sizeof (Lisp_Object) - * ASIZE (Vfontset_table)); + realized[0] = alloca (sizeof (Lisp_Object) * ASIZE (Vfontset_table)); for (i = j = 0; i < ASIZE (Vfontset_table); i++) { elt = FONTSET_FROM_ID (i); @@ -1905,8 +1904,7 @@ } realized[0][j] = Qnil; - realized[1] = (Lisp_Object *) alloca (sizeof (Lisp_Object) - * ASIZE (Vfontset_table)); + realized[1] = alloca (sizeof (Lisp_Object) * ASIZE (Vfontset_table)); for (i = j = 0; ! NILP (realized[0][i]); i++) { elt = FONTSET_DEFAULT (realized[0][i]); === modified file 'src/frame.c' --- src/frame.c 2012-06-28 12:29:37 +0000 +++ src/frame.c 2012-07-05 18:35:48 +0000 @@ -647,7 +647,7 @@ : NULL)); if (!NILP (tty)) { - name = (char *) alloca (SBYTES (tty) + 1); + name = alloca (SBYTES (tty) + 1); strncpy (name, SSDATA (tty), SBYTES (tty)); name[SBYTES (tty)] = 0; } @@ -658,7 +658,7 @@ : NULL)); if (!NILP (tty_type)) { - type = (char *) alloca (SBYTES (tty_type) + 1); + type = alloca (SBYTES (tty_type) + 1); strncpy (type, SSDATA (tty_type), SBYTES (tty_type)); type[SBYTES (tty_type)] = 0; } @@ -2762,8 +2762,8 @@ for (tail = alist; CONSP (tail); tail = Fcdr (tail)) i++; - parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object)); - values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object)); + parms = alloca (i * sizeof *parms); + values = alloca (i * sizeof *values); /* Extract parm names and values into those vectors. */ @@ -3624,17 +3624,17 @@ /* Allocate space for the components, the dots which separate them, and the final '\0'. Make them big enough for the worst case. */ - name_key = (char *) alloca (SBYTES (Vx_resource_name) - + (STRINGP (component) - ? SBYTES (component) : 0) - + SBYTES (attribute) - + 3); + name_key = alloca (SBYTES (Vx_resource_name) + + (STRINGP (component) + ? SBYTES (component) : 0) + + SBYTES (attribute) + + 3); - class_key = (char *) alloca (SBYTES (Vx_resource_class) - + SBYTES (class) - + (STRINGP (subclass) - ? SBYTES (subclass) : 0) - + 3); + class_key = alloca (SBYTES (Vx_resource_class) + + SBYTES (class) + + (STRINGP (subclass) + ? SBYTES (subclass) : 0) + + 3); /* Start with emacs.FRAMENAME for the name (the specific one) and with `Emacs' for the class key (the general one). */ @@ -3710,8 +3710,7 @@ /* Allocate space for the components, the dots which separate them, and the final '\0'. */ SAFE_ALLOCA (name_key, char *, invocation_namelen + strlen (attribute) + 2); - class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) - + strlen (class) + 2); + class_key = alloca ((sizeof (EMACS_CLASS) - 1) + strlen (class) + 2); esprintf (name_key, "%s.%s", SSDATA (Vinvocation_name), attribute); sprintf (class_key, "%s.%s", EMACS_CLASS, class); === modified file 'src/fringe.c' --- src/fringe.c 2012-07-05 06:32:41 +0000 +++ src/fringe.c 2012-07-05 18:35:48 +0000 @@ -1616,12 +1616,10 @@ error ("No free fringe bitmap slots"); i = max_fringe_bitmaps; - fringe_bitmaps - = ((struct fringe_bitmap **) - xrealloc (fringe_bitmaps, bitmaps * sizeof *fringe_bitmaps)); - fringe_faces - = (Lisp_Object *) xrealloc (fringe_faces, - bitmaps * sizeof *fringe_faces); + fringe_bitmaps = xrealloc (fringe_bitmaps, + bitmaps * sizeof *fringe_bitmaps); + fringe_faces = xrealloc (fringe_faces, + bitmaps * sizeof *fringe_faces); for (i = max_fringe_bitmaps; i < bitmaps; i++) { @@ -1803,9 +1801,8 @@ max_fringe_bitmaps = MAX_STANDARD_FRINGE_BITMAPS + 20; - fringe_bitmaps - = xzalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *)); - fringe_faces = xmalloc (max_fringe_bitmaps * sizeof (Lisp_Object)); + fringe_bitmaps = xzalloc (max_fringe_bitmaps * sizeof *fringe_bitmaps); + fringe_faces = xmalloc (max_fringe_bitmaps * sizeof *fringe_faces); for (i = 0; i < max_fringe_bitmaps; i++) fringe_faces[i] = Qnil; === modified file 'src/ftfont.c' --- src/ftfont.c 2012-06-28 07:50:27 +0000 +++ src/ftfont.c 2012-07-05 18:35:48 +0000 @@ -392,7 +392,7 @@ args[1] = Qequal; ft_face_cache = Fmake_hash_table (2, args); } - cache_data = xmalloc (sizeof (struct ftfont_cache_data)); + cache_data = xmalloc (sizeof *cache_data); cache_data->ft_face = NULL; cache_data->fc_charset = NULL; val = make_save_value (NULL, 0); @@ -657,7 +657,7 @@ static struct OpenTypeSpec * ftfont_get_open_type_spec (Lisp_Object otf_spec) { - struct OpenTypeSpec *spec = malloc (sizeof (struct OpenTypeSpec)); + struct OpenTypeSpec *spec = malloc (sizeof *spec); Lisp_Object val; int i, j, negative; @@ -696,7 +696,7 @@ spec->features[i] = (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (int) < XINT (len) ? 0 - : malloc (sizeof (int) * XINT (len))); + : malloc (XINT (len) * sizeof *spec->features[i])); if (! spec->features[i]) { if (i > 0 && spec->features[0]) @@ -2460,15 +2460,16 @@ if (gstring.allocated == 0) { gstring.glyph_size = sizeof (MFLTGlyph); - gstring.glyphs = xnmalloc (len * 2, sizeof (MFLTGlyph)); + gstring.glyphs = xnmalloc (len * 2, sizeof *gstring.glyphs); gstring.allocated = len * 2; } else if (gstring.allocated < len * 2) { - gstring.glyphs = xnrealloc (gstring.glyphs, len * 2, sizeof (MFLTGlyph)); + gstring.glyphs = xnrealloc (gstring.glyphs, len * 2, + sizeof *gstring.glyphs); gstring.allocated = len * 2; } - memset (gstring.glyphs, 0, sizeof (MFLTGlyph) * len); + memset (gstring.glyphs, 0, len * sizeof *gstring.glyphs); for (i = 0; i < len; i++) { Lisp_Object g = LGSTRING_GLYPH (lgstring, i); === modified file 'src/ftxfont.c' --- src/ftxfont.c 2012-01-19 07:21:25 +0000 +++ src/ftxfont.c 2012-07-05 18:35:48 +0000 @@ -90,7 +90,7 @@ } } - new = malloc (sizeof (struct ftxfont_frame_data)); + new = malloc (sizeof *new); if (! new) return NULL; new->next = this; === modified file 'src/gmalloc.c' --- src/gmalloc.c 2012-06-26 01:05:39 +0000 +++ src/gmalloc.c 2012-07-05 18:35:48 +0000 @@ -1616,7 +1616,7 @@ break; if (l == NULL) { - l = malloc (sizeof (struct alignlist)); + l = malloc (sizeof *l); if (l != NULL) { l->next = _aligned_blocks; @@ -1811,7 +1811,7 @@ struct hdr *hdr; __malloc_hook = old_malloc_hook; - hdr = malloc (sizeof (struct hdr) + size + 1); + hdr = malloc (sizeof *hdr + size + 1); __malloc_hook = mallochook; if (hdr == NULL) return NULL; @@ -1842,7 +1842,7 @@ __free_hook = old_free_hook; __malloc_hook = old_malloc_hook; __realloc_hook = old_realloc_hook; - hdr = realloc (hdr, sizeof (struct hdr) + size + 1); + hdr = realloc (hdr, sizeof *hdr + size + 1); __free_hook = freehook; __malloc_hook = mallochook; __realloc_hook = reallochook; === modified file 'src/gtkutil.c' --- src/gtkutil.c 2012-07-05 15:44:53 +0000 +++ src/gtkutil.c 2012-07-05 18:35:48 +0000 @@ -215,7 +215,7 @@ } else { - wv = xmalloc (sizeof (widget_value)); + wv = xmalloc (sizeof *wv); malloc_cpt++; } memset (wv, 0, sizeof (widget_value)); @@ -2057,7 +2057,7 @@ { if (! cl_data) { - cl_data = xmalloc (sizeof (*cl_data)); + cl_data = xmalloc (sizeof *cl_data); cl_data->f = f; cl_data->menu_bar_vector = f->menu_bar_vector; cl_data->menu_bar_items_used = f->menu_bar_items_used; @@ -2357,7 +2357,7 @@ if (utf8_label) g_free (utf8_label); if (utf8_key) g_free (utf8_key); - cb_data = xmalloc (sizeof (xg_menu_item_cb_data)); + cb_data = xmalloc (sizeof *cb_data); xg_list_insert (&xg_menu_item_cb_list, &cb_data->ptrs); @@ -4336,7 +4336,7 @@ { #ifdef HAVE_GTK3 int ret = 0; - if (GTK_IS_BOX (vb)) + if (GTK_IS_BOX (vb)) { GtkOrientation ori = gtk_orientable_get_orientation (GTK_ORIENTABLE (vb)); ret = (ori == GTK_ORIENTATION_HORIZONTAL && is_horizontal) === modified file 'src/image.c' --- src/image.c 2012-07-05 06:32:41 +0000 +++ src/image.c 2012-07-05 18:35:48 +0000 @@ -1356,9 +1356,7 @@ /* This isn't called frequently so we get away with simply reallocating the color vector to the needed size, here. */ ptrdiff_t ncolors = img->ncolors + 1; - img->colors = - (unsigned long *) xrealloc (img->colors, - ncolors * sizeof *img->colors); + img->colors = xrealloc (img->colors, ncolors * sizeof *img->colors); img->colors[ncolors - 1] = color.pixel; img->ncolors = ncolors; result = color.pixel; @@ -2500,7 +2498,7 @@ w1 = (width + 7) / 8; /* nb of 8bits elt in X bitmap */ w2 = ((width + 15) / 16) * 2; /* nb of 16bits elt in W32 bitmap */ - bits = (unsigned char *) alloca (height * w2); + bits = alloca (height * w2); memset (bits, 0, height * w2); for (i = 0; i < height; i++) { @@ -2927,7 +2925,7 @@ char *p; int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR; - p = bits = (char *) alloca (nbytes * img->height); + p = bits = alloca (nbytes * img->height); for (i = 0; i < img->height; ++i, p += nbytes) { Lisp_Object line = AREF (data, i); @@ -2950,7 +2948,7 @@ invertedBits = bits; nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR * img->height; - bits = (char *) alloca (nbytes); + bits = alloca (nbytes); for (i = 0; i < nbytes; i++) bits[i] = XBM_BIT_SHUFFLE (invertedBits[i]); } @@ -3422,7 +3420,7 @@ /* Allocate an XpmColorSymbol array. */ size = attrs.numsymbols * sizeof *xpm_syms; - xpm_syms = (XpmColorSymbol *) alloca (size); + xpm_syms = alloca (size); memset (xpm_syms, 0, size); attrs.colorsymbols = xpm_syms; @@ -3445,14 +3443,14 @@ color = XCDR (XCAR (tail)); if (STRINGP (name)) { - xpm_syms[i].name = (char *) alloca (SCHARS (name) + 1); + xpm_syms[i].name = alloca (SCHARS (name) + 1); strcpy (xpm_syms[i].name, SSDATA (name)); } else xpm_syms[i].name = empty_string; if (STRINGP (color)) { - xpm_syms[i].value = (char *) alloca (SCHARS (color) + 1); + xpm_syms[i].value = alloca (SCHARS (color) + 1); strcpy (xpm_syms[i].value, SSDATA (color)); } else @@ -6449,8 +6447,7 @@ a default color, and we don't have to care about which colors can be freed safely, and which can't. */ init_color_table (); - colors = (unsigned long *) alloca (cinfo.actual_number_of_colors - * sizeof *colors); + colors = alloca (cinfo.actual_number_of_colors * sizeof *colors); for (i = 0; i < cinfo.actual_number_of_colors; ++i) { === modified file 'src/keyboard.c' --- src/keyboard.c 2012-07-05 06:32:41 +0000 +++ src/keyboard.c 2012-07-05 18:35:48 +0000 @@ -480,7 +480,7 @@ if (current_kboard->immediate_echo) { int size = KEY_DESCRIPTION_SIZE + 100; - char *buffer = (char *) alloca (size); + char *buffer = alloca (size); char *ptr = buffer; Lisp_Object echo_string; @@ -502,7 +502,7 @@ { int offset = ptr - buffer; size = max (2 * size, size + nbytes); - buffer = (char *) alloca (size); + buffer = alloca (size); ptr = buffer + offset; } @@ -520,7 +520,7 @@ { int offset = ptr - buffer; size += len; - buffer = (char *) alloca (size); + buffer = alloca (size); ptr = buffer + offset; } @@ -884,7 +884,7 @@ void push_kboard (struct kboard *k) { - struct kboard_stack *p = xmalloc (sizeof (struct kboard_stack)); + struct kboard_stack *p = xmalloc (sizeof *p); p->next = kboard_stack; p->kboard = current_kboard; @@ -6196,8 +6196,7 @@ /* Since BASE could contain nulls, we can't use intern here; we have to use Fintern, which expects a genuine Lisp_String, and keeps a reference to it. */ - char *new_mods - = (char *) alloca (sizeof ("A-C-H-M-S-s-down-drag-double-triple-")); + char new_mods[sizeof "A-C-H-M-S-s-down-drag-double-triple-"]; int mod_len; { @@ -7280,7 +7279,7 @@ /* Already added. */ return; - p = xmalloc (sizeof (struct user_signal_info)); + p = xmalloc (sizeof *p); p->sig = sig; p->name = xstrdup (name); p->npending = 0; @@ -7506,7 +7505,7 @@ Lisp_Object tem; ptrdiff_t nminor; nminor = current_minor_maps (NULL, &tmaps); - maps = (Lisp_Object *) alloca ((nminor + 3) * sizeof (maps[0])); + maps = alloca ((nminor + 3) * sizeof *maps); nmaps = 0; if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) maps[nmaps++] = tem; @@ -8033,7 +8032,7 @@ if (!NILP (Voverriding_local_map_menu_flag)) { /* Yes, use them (if non-nil) as well as the global map. */ - maps = (Lisp_Object *) alloca (3 * sizeof (maps[0])); + maps = alloca (3 * sizeof *maps); nmaps = 0; if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) maps[nmaps++] = KVAR (current_kboard, Voverriding_terminal_local_map); @@ -8050,7 +8049,7 @@ Lisp_Object tem; ptrdiff_t nminor; nminor = current_minor_maps (NULL, &tmaps); - maps = (Lisp_Object *) alloca ((nminor + 3) * sizeof (maps[0])); + maps = alloca ((nminor + 3) * sizeof *maps); nmaps = 0; if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) maps[nmaps++] = tem; @@ -8475,8 +8474,7 @@ && !EQ (XCAR (prev_event), Qtool_bar)) { /* Display the menu and get the selection. */ - Lisp_Object *realmaps - = (Lisp_Object *) alloca (nmaps * sizeof (Lisp_Object)); + Lisp_Object *realmaps = alloca (nmaps * sizeof *realmaps); Lisp_Object value; ptrdiff_t nmaps1 = 0; @@ -8570,7 +8568,7 @@ if (width + 4 > read_char_minibuf_menu_width) { read_char_minibuf_menu_text - = (char *) xrealloc (read_char_minibuf_menu_text, width + 4); + = xrealloc (read_char_minibuf_menu_text, width + 4); read_char_minibuf_menu_width = width + 4; } menu = read_char_minibuf_menu_text; @@ -9177,8 +9175,8 @@ { if (2 > nmaps_allocated) { - submaps = (Lisp_Object *) alloca (2 * sizeof (submaps[0])); - defs = (Lisp_Object *) alloca (2 * sizeof (defs[0])); + submaps = alloca (2 * sizeof *submaps); + defs = alloca (2 * sizeof *defs); nmaps_allocated = 2; } submaps[nmaps++] = KVAR (current_kboard, Voverriding_terminal_local_map); @@ -9187,8 +9185,8 @@ { if (2 > nmaps_allocated) { - submaps = (Lisp_Object *) alloca (2 * sizeof (submaps[0])); - defs = (Lisp_Object *) alloca (2 * sizeof (defs[0])); + submaps = alloca (2 * sizeof *submaps); + defs = alloca (2 * sizeof *defs); nmaps_allocated = 2; } submaps[nmaps++] = Voverriding_local_map; @@ -9204,8 +9202,8 @@ if (total > nmaps_allocated) { - submaps = (Lisp_Object *) alloca (total * sizeof (submaps[0])); - defs = (Lisp_Object *) alloca (total * sizeof (defs[0])); + submaps = alloca (total * sizeof *submaps); + defs = alloca (total * sizeof *defs); nmaps_allocated = total; } @@ -12187,7 +12185,7 @@ Vdebug_on_event = intern_c_string ("sigusr2"); /* Create the initial keyboard. */ - initial_kboard = xmalloc (sizeof (KBOARD)); + initial_kboard = xmalloc (sizeof *initial_kboard); init_kboard (initial_kboard); /* Vwindow_system is left at t for now. */ initial_kboard->next_kboard = all_kboards; === modified file 'src/keymap.c' --- src/keymap.c 2012-07-03 18:24:42 +0000 +++ src/keymap.c 2012-07-05 18:35:48 +0000 @@ -1478,7 +1478,7 @@ /* Use malloc here. See the comment above this function. Avoid realloc here; it causes spurious traps on GNU/Linux [KFS] */ BLOCK_INPUT; - newmodes = (Lisp_Object *) malloc (allocsize); + newmodes = malloc (allocsize); if (newmodes) { if (cmm_modes) @@ -1490,7 +1490,7 @@ cmm_modes = newmodes; } - newmaps = (Lisp_Object *) malloc (allocsize); + newmaps = malloc (allocsize); if (newmaps) { if (cmm_maps) @@ -2923,7 +2923,7 @@ if (!SYMBOLP (modes[i])) abort (); - p = title = (char *) alloca (42 + SCHARS (SYMBOL_NAME (modes[i]))); + p = title = alloca (42 + SCHARS (SYMBOL_NAME (modes[i]))); *p++ = '\f'; *p++ = '\n'; *p++ = '`'; === modified file 'src/lread.c' --- src/lread.c 2012-07-05 06:32:41 +0000 +++ src/lread.c 2012-07-05 18:35:48 +0000 @@ -1479,7 +1479,7 @@ this path element/specified file name and any possible suffix. */ want_length = max_suffix_len + SBYTES (filename); if (fn_size <= want_length) - fn = (char *) alloca (fn_size = 100 + want_length); + fn = alloca (fn_size = 100 + want_length); /* Loop over suffixes. */ for (tail = NILP (suffixes) ? Fcons (empty_unibyte_string, Qnil) : suffixes; @@ -2630,8 +2630,7 @@ } if (nskip > saved_doc_string_size) { - saved_doc_string = (char *) xrealloc (saved_doc_string, - nskip + extra); + saved_doc_string = xrealloc (saved_doc_string, nskip + extra); saved_doc_string_size = nskip + extra; } @@ -2894,8 +2893,7 @@ ptrdiff_t offset = p - read_buffer; if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size) memory_full (SIZE_MAX); - read_buffer = (char *) xrealloc (read_buffer, - read_buffer_size * 2); + read_buffer = xrealloc (read_buffer, read_buffer_size * 2); read_buffer_size *= 2; p = read_buffer + offset; end = read_buffer + read_buffer_size; @@ -3029,8 +3027,7 @@ ptrdiff_t offset = p - read_buffer; if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size) memory_full (SIZE_MAX); - read_buffer = (char *) xrealloc (read_buffer, - read_buffer_size * 2); + read_buffer = xrealloc (read_buffer, read_buffer_size * 2); read_buffer_size *= 2; p = read_buffer + offset; end = read_buffer + read_buffer_size; @@ -3060,8 +3057,7 @@ ptrdiff_t offset = p - read_buffer; if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size) memory_full (SIZE_MAX); - read_buffer = (char *) xrealloc (read_buffer, - read_buffer_size * 2); + read_buffer = xrealloc (read_buffer, read_buffer_size * 2); read_buffer_size *= 2; p = read_buffer + offset; end = read_buffer + read_buffer_size; === modified file 'src/macros.c' --- src/macros.c 2012-06-16 12:24:15 +0000 +++ src/macros.c 2012-07-05 18:35:48 +0000 @@ -63,8 +63,7 @@ if (!current_kboard->kbd_macro_buffer) { - current_kboard->kbd_macro_buffer - = (Lisp_Object *)xmalloc (30 * sizeof (Lisp_Object)); + current_kboard->kbd_macro_buffer = xmalloc (30 * sizeof (Lisp_Object)); current_kboard->kbd_macro_bufsize = 30; } update_mode_lines++; @@ -205,8 +204,7 @@ < kb->kbd_macro_bufsize) memory_full (SIZE_MAX); nbytes = kb->kbd_macro_bufsize * (2 * sizeof *kb->kbd_macro_buffer); - kb->kbd_macro_buffer - = (Lisp_Object *) xrealloc (kb->kbd_macro_buffer, nbytes); + kb->kbd_macro_buffer = xrealloc (kb->kbd_macro_buffer, nbytes); kb->kbd_macro_bufsize *= 2; kb->kbd_macro_ptr = kb->kbd_macro_buffer + ptr_offset; kb->kbd_macro_end = kb->kbd_macro_buffer + end_offset; === modified file 'src/menu.c' --- src/menu.c 2012-06-30 09:13:54 +0000 +++ src/menu.c 2012-07-05 18:35:48 +0000 @@ -632,8 +632,7 @@ widget_value **submenu_stack; int panes_seen = 0; - submenu_stack - = (widget_value **) alloca (menu_items_used * sizeof (widget_value *)); + submenu_stack = alloca (menu_items_used * sizeof *submenu_stack); wv = xmalloc_widget_value (); wv->name = "menu"; wv->value = 0; @@ -893,7 +892,7 @@ int i; entry = Qnil; - subprefix_stack = (Lisp_Object *) alloca (menu_bar_items_used * sizeof (Lisp_Object)); + subprefix_stack = alloca (menu_bar_items_used * sizeof *subprefix_stack); prefix = Qnil; i = 0; === modified file 'src/nsfns.m' --- src/nsfns.m 2012-06-29 01:35:32 +0000 +++ src/nsfns.m 2012-07-05 18:35:48 +0000 @@ -1203,8 +1203,7 @@ f->terminal = dpyinfo->terminal; f->output_method = output_ns; - f->output_data.ns = (struct ns_output *)xmalloc (sizeof *(f->output_data.ns)); - memset (f->output_data.ns, 0, sizeof *(f->output_data.ns)); + f->output_data.ns = xzalloc (sizeof *f->output_data.ns); FRAME_FONTSET (f) = -1; === modified file 'src/nsfont.m' --- src/nsfont.m 2012-02-10 18:58:48 +0000 +++ src/nsfont.m 2012-07-05 18:35:48 +0000 @@ -152,7 +152,7 @@ [fdAttrs setObject: tdict forKey: NSFontTraitsAttribute]; fdesc = [NSFontDescriptor fontDescriptorWithFontAttributes: fdAttrs]; - if (family != nil) + if (family != nil) { fdesc = [fdesc fontDescriptorWithFamily: family]; } @@ -779,14 +779,8 @@ if (!font) return Qnil; /* FIXME: other terms do, but return Qnil causes segfault */ - font_info->glyphs = (unsigned short **) - xmalloc (0x100 * sizeof (unsigned short *)); - font_info->metrics = (struct font_metrics **) - xmalloc (0x100 * sizeof (struct font_metrics *)); - if (!font_info->glyphs || !font_info->metrics) - return Qnil; - memset (font_info->glyphs, 0, 0x100 * sizeof (unsigned short *)); - memset (font_info->metrics, 0, 0x100 * sizeof (struct font_metrics *)); + font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs); + font_info->metrics = xzalloc (0x100 * sizeof *font_info->metrics); BLOCK_INPUT; @@ -831,8 +825,7 @@ [font_info->nsfont retain]; /* set up ns_font (defined in nsgui.h) */ - font_info->name = (char *)xmalloc (strlen (fontName)+1); - strcpy (font_info->name, fontName); + font_info->name = xstrdup (fontName); font_info->bold = [fontMgr traitsOfFont: nsfont] & NSBoldFontMask; font_info->ital = synthItal || ([fontMgr traitsOfFont: nsfont] & NSItalicFontMask); @@ -1371,8 +1364,7 @@ BLOCK_INPUT; sfont = [font_info->nsfont screenFont]; - font_info->metrics[block] = xmalloc (0x100 * sizeof (struct font_metrics)); - memset (font_info->metrics[block], 0, 0x100 * sizeof (struct font_metrics)); + font_info->metrics[block] = xzalloc (0x100 * sizeof (struct font_metrics)); if (!(font_info->metrics[block])) abort (); @@ -1417,7 +1409,7 @@ maxChar = 0; maxGlyph = 0; dict = [NSMutableDictionary new]; - cglyphs = (CGGlyph *)xmalloc (c * sizeof (CGGlyph)); + cglyphs = xmalloc (c * sizeof (CGGlyph)); return self; } === modified file 'src/nsmenu.m' --- src/nsmenu.m 2012-06-29 01:35:32 +0000 +++ src/nsmenu.m 2012-07-05 18:35:48 +0000 @@ -190,8 +190,7 @@ ptrdiff_t specpdl_count = SPECPDL_INDEX (); int previous_menu_items_used = f->menu_bar_items_used; Lisp_Object *previous_items - = (Lisp_Object *) alloca (previous_menu_items_used - * sizeof (Lisp_Object)); + = alloca (previous_menu_items_used * sizeof *previous_items); /* lisp preliminaries */ buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer; @@ -231,11 +230,11 @@ menu_items = f->menu_bar_vector; menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; - submenu_start = (int *) alloca (ASIZE (items) * sizeof (int *)); - submenu_end = (int *) alloca (ASIZE (items) * sizeof (int *)); - submenu_n_panes = (int *) alloca (ASIZE (items) * sizeof (int)); - submenu_top_level_items - = (int *) alloca (ASIZE (items) * sizeof (int *)); + submenu_start = alloca (ASIZE (items) * sizeof *submenu_start); + submenu_end = alloca (ASIZE (items) * sizeof *submenu_end); + submenu_n_panes = alloca (ASIZE (items) * sizeof *submenu_n_panes); + submenu_top_level_items = alloca (ASIZE (items) + * sizeof *submenu_top_level_items); init_menu_items (); for (i = 0; i < ASIZE (items); i += 4) { @@ -814,9 +813,9 @@ { widget_value *save_wv = 0, *prev_wv = 0; widget_value **submenu_stack - = (widget_value **) alloca (menu_items_used * sizeof (widget_value *)); + = alloca (menu_items_used * sizeof *submenu_stack); /* Lisp_Object *subprefix_stack - = (Lisp_Object *) alloca (menu_items_used * sizeof (Lisp_Object)); */ + = alloca (menu_items_used * sizeof *subprefix_stack); */ int submenu_depth = 0; int first_pane = 1; int i; === modified file 'src/nsterm.m' --- src/nsterm.m 2012-06-30 21:35:20 +0000 +++ src/nsterm.m 2012-07-05 18:35:48 +0000 @@ -1323,8 +1323,7 @@ { color_table->size = NS_COLOR_CAPACITY; color_table->avail = 1; /* skip idx=0 as marker */ - color_table->colors - = (NSColor **)xmalloc (color_table->size * sizeof (NSColor *)); + color_table->colors = xmalloc (color_table->size * sizeof (NSColor *)); color_table->colors[0] = nil; color_table->empty_indices = [[NSMutableSet alloc] init]; } @@ -2245,17 +2244,9 @@ /* grow bimgs if needed */ if (nBimgs < max_used_fringe_bitmap) { - EmacsImage **newBimgs - = xmalloc (max_used_fringe_bitmap * sizeof (EmacsImage *)); - memset (newBimgs, 0, max_used_fringe_bitmap * sizeof (EmacsImage *)); - - if (nBimgs) - { - memcpy (newBimgs, bimgs, nBimgs * sizeof (EmacsImage *)); - xfree (bimgs); - } - - bimgs = newBimgs; + bimgs = xrealloc (bimgs, max_used_fringe_bitmap * sizeof *bimgs); + memset (bimgs + nBimgs, 0, + (max_used_fringe_bitmap - nBimgs) * sizeof *bimgs); nBimgs = max_used_fringe_bitmap; } @@ -3889,8 +3880,7 @@ NSColorSpaceFromDepth (depth)]; dpyinfo->n_planes = NSBitsPerPixelFromDepth (depth); dpyinfo->image_cache = make_image_cache (); - dpyinfo->color_table - = (struct ns_color_table *)xmalloc (sizeof (struct ns_color_table)); + dpyinfo->color_table = xmalloc (sizeof *dpyinfo->color_table); dpyinfo->color_table->colors = NULL; dpyinfo->root_window = 42; /* a placeholder.. */ @@ -4071,13 +4061,12 @@ selector: @selector (logNotification:) name: nil object: nil]; */ - dpyinfo = (struct ns_display_info *)xmalloc (sizeof (struct ns_display_info)); - memset (dpyinfo, 0, sizeof (struct ns_display_info)); + dpyinfo = xzalloc (sizeof *dpyinfo); ns_initialize_display_info (dpyinfo); terminal = ns_create_terminal (dpyinfo); - terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); + terminal->kboard = xmalloc (sizeof *terminal->kboard); init_kboard (terminal->kboard); KVAR (terminal->kboard, Vwindow_system) = Qns; terminal->kboard->next_kboard = all_kboards; @@ -4098,7 +4087,7 @@ dpyinfo->name_list_element = XCAR (ns_display_name_list); /* Set the name of the terminal. */ - terminal->name = (char *) xmalloc (SBYTES (display_name) + 1); + terminal->name = xmalloc (SBYTES (display_name) + 1); strncpy (terminal->name, SDATA (display_name), SBYTES (display_name)); terminal->name[SBYTES (display_name)] = 0; @@ -5355,8 +5344,7 @@ char *pos = strstr (t, " — "); if (pos) *pos = '\0'; - old_title = (char *) xmalloc (strlen (t) + 1); - strcpy (old_title, t); + old_title = xstrdup (t); } size_title = xmalloc (strlen (old_title) + 40); esprintf (size_title, "%s — (%d x %d)", old_title, cols, rows); @@ -6076,7 +6064,7 @@ if (nr_screens == 1) return [super constrainFrameRect:frameRect toScreen:screen]; - + if (f->output_data.ns->dont_constrain || ns_menu_bar_should_be_hidden ()) return frameRect; === modified file 'src/print.c' --- src/print.c 2012-07-05 06:32:41 +0000 +++ src/print.c 2012-07-05 18:35:48 +0000 @@ -173,8 +173,7 @@ if (print_buffer_pos != print_buffer_pos_byte \ && NILP (BVAR (current_buffer, enable_multibyte_characters))) \ { \ - unsigned char *temp \ - = (unsigned char *) alloca (print_buffer_pos + 1); \ + unsigned char *temp = alloca (print_buffer_pos + 1); \ copy_text ((unsigned char *) print_buffer, temp, \ print_buffer_pos_byte, 1, 0); \ insert_1_both ((char *) temp, print_buffer_pos, \ === modified file 'src/process.c' --- src/process.c 2012-07-05 06:32:41 +0000 +++ src/process.c 2012-07-05 18:35:48 +0000 @@ -1365,7 +1365,7 @@ val = Vcoding_system_for_read; if (NILP (val)) { - args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); + args2 = alloca ((nargs + 1) * sizeof *args2); args2[0] = Qstart_process; for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; GCPRO2 (proc, current_dir); @@ -1384,7 +1384,7 @@ { if (EQ (coding_systems, Qt)) { - args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); + args2 = alloca ((nargs + 1) * sizeof *args2); args2[0] = Qstart_process; for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; GCPRO2 (proc, current_dir); @@ -1478,7 +1478,7 @@ /* Now that everything is encoded we can collect the strings into NEW_ARGV. */ - new_argv = (unsigned char **) alloca ((nargs - 1) * sizeof (char *)); + new_argv = alloca ((nargs - 1) * sizeof *new_argv); new_argv[nargs - 2] = 0; for (i = nargs - 2; i-- != 0; ) @@ -5037,7 +5037,7 @@ ptrdiff_t count = SPECPDL_INDEX (); Lisp_Object odeactivate; - chars = (char *) alloca (carryover + readmax); + chars = alloca (carryover + readmax); if (carryover) /* See the comment above. */ memcpy (chars, SDATA (p->decoding_buf), carryover); @@ -7083,8 +7083,7 @@ return; if (!proc_decode_coding_system[inch]) - proc_decode_coding_system[inch] - = xmalloc (sizeof (struct coding_system)); + proc_decode_coding_system[inch] = xmalloc (sizeof (struct coding_system)); coding_system = p->decode_coding_system; if (! NILP (p->filter)) ; @@ -7096,8 +7095,7 @@ setup_coding_system (coding_system, proc_decode_coding_system[inch]); if (!proc_encode_coding_system[outch]) - proc_encode_coding_system[outch] - = xmalloc (sizeof (struct coding_system)); + proc_encode_coding_system[outch] = xmalloc (sizeof (struct coding_system)); setup_coding_system (p->encode_coding_system, proc_encode_coding_system[outch]); #endif === modified file 'src/ralloc.c' --- src/ralloc.c 2012-06-29 06:28:37 +0000 +++ src/ralloc.c 2012-07-05 18:35:48 +0000 @@ -396,7 +396,7 @@ register bloc_ptr new_bloc; register heap_ptr heap; - if (! (new_bloc = (bloc_ptr) malloc (BLOC_PTR_SIZE)) + if (! (new_bloc = malloc (BLOC_PTR_SIZE)) || ! (new_bloc->data = obtain (break_value, size))) { free (new_bloc); === modified file 'src/regex.c' --- src/regex.c 2012-07-04 00:36:28 +0000 +++ src/regex.c 2012-07-05 18:35:48 +0000 @@ -212,8 +212,7 @@ static void * xmalloc (size_t size) { - register void *val; - val = (void *) malloc (size); + void *val = malloc (size); if (!val && size) { write (2, "virtual memory exhausted\n", 25); @@ -225,13 +224,13 @@ static void * xrealloc (void *block, size_t size) { - register void *val; + void *val; /* We must call malloc explicitly when BLOCK is 0, since some reallocs don't do this. */ if (! block) - val = (void *) malloc (size); + val = malloc (size); else - val = (void *) realloc (block, size); + val = realloc (block, size); if (!val && size) { write (2, "virtual memory exhausted\n", 25); @@ -1386,7 +1385,7 @@ #ifdef MATCH_MAY_ALLOCATE # define INIT_FAIL_STACK() \ do { \ - fail_stack.stack = (fail_stack_elt_t *) \ + fail_stack.stack = \ REGEX_ALLOCATE_STACK (INIT_FAILURE_ALLOC * TYPICAL_FAILURE_SIZE \ * sizeof (fail_stack_elt_t)); \ \ @@ -1429,8 +1428,7 @@ >= re_max_failures * TYPICAL_FAILURE_SIZE) \ ? 0 \ : ((fail_stack).stack \ - = (fail_stack_elt_t *) \ - REGEX_REALLOCATE_STACK ((fail_stack).stack, \ + = REGEX_REALLOCATE_STACK ((fail_stack).stack, \ (fail_stack).size * sizeof (fail_stack_elt_t), \ MIN (re_max_failures * TYPICAL_FAILURE_SIZE, \ ((fail_stack).size * sizeof (fail_stack_elt_t) \ @@ -2141,12 +2139,7 @@ extend_range_table_work_area (struct range_table_work_area *work_area) { work_area->allocated += 16 * sizeof (int); - if (work_area->table) - work_area->table - = (int *) realloc (work_area->table, work_area->allocated); - else - work_area->table - = (int *) malloc (work_area->allocated); + work_area->table = realloc (work_area->table, work_area->allocated); } #if 0 @@ -3741,16 +3734,8 @@ if (fail_stack.size < re_max_failures * TYPICAL_FAILURE_SIZE) { fail_stack.size = re_max_failures * TYPICAL_FAILURE_SIZE; - - if (! fail_stack.stack) - fail_stack.stack - = (fail_stack_elt_t *) malloc (fail_stack.size - * sizeof (fail_stack_elt_t)); - else - fail_stack.stack - = (fail_stack_elt_t *) realloc (fail_stack.stack, - (fail_stack.size - * sizeof (fail_stack_elt_t))); + falk_stack.stack = realloc (fail_stack.stack, + fail_stack.size * sizeof *falk_stack.stack); } regex_grow_registers (num_regs); @@ -6408,13 +6393,13 @@ if (!re_comp_buf.buffer) { - re_comp_buf.buffer = (unsigned char *) malloc (200); + re_comp_buf.buffer = malloc (200); if (re_comp_buf.buffer == NULL) /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */ return (char *) gettext (re_error_msgid[(int) REG_ESPACE]); re_comp_buf.allocated = 200; - re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH); + re_comp_buf.fastmap = malloc (1 << BYTEWIDTH); if (re_comp_buf.fastmap == NULL) /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */ return (char *) gettext (re_error_msgid[(int) REG_ESPACE]); @@ -6498,15 +6483,13 @@ preg->used = 0; /* Try to allocate space for the fastmap. */ - preg->fastmap = (char *) malloc (1 << BYTEWIDTH); + preg->fastmap = malloc (1 << BYTEWIDTH); if (cflags & REG_ICASE) { unsigned i; - preg->translate - = (RE_TRANSLATE_TYPE) malloc (CHAR_SET_SIZE - * sizeof (*(RE_TRANSLATE_TYPE)0)); + preg->translate = malloc (CHAR_SET_SIZE * sizeof *preg->translate); if (preg->translate == NULL) return (int) REG_ESPACE; === modified file 'src/region-cache.c' --- src/region-cache.c 2012-07-05 06:32:41 +0000 +++ src/region-cache.c 2012-07-05 18:35:48 +0000 @@ -132,7 +132,7 @@ struct region_cache * new_region_cache (void) { - struct region_cache *c = xmalloc (sizeof (struct region_cache)); + struct region_cache *c = xmalloc (sizeof *c); c->gap_start = 0; c->gap_len = NEW_CACHE_GAP; === modified file 'src/scroll.c' --- src/scroll.c 2012-06-28 07:50:50 +0000 +++ src/scroll.c 2012-07-05 18:35:48 +0000 @@ -253,11 +253,11 @@ /* A queue for line insertions to be done. */ struct queue { int count, pos; }; struct queue *queue_start - = (struct queue *) alloca (current_matrix->nrows * sizeof (struct queue)); + = alloca (current_matrix->nrows * sizeof *queue_start); struct queue *queue = queue_start; - char *retained_p = (char *) alloca (window_size * sizeof (char)); - int *copy_from = (int *) alloca (window_size * sizeof (int)); + char *retained_p = alloca (window_size * sizeof *retained_p); + int *copy_from = alloca (window_size * sizeof *copy_from); /* Zero means line is empty. */ memset (retained_p, 0, window_size * sizeof (char)); @@ -671,11 +671,11 @@ int write_follows_p = 1; /* For each row in the new matrix what row of the old matrix it is. */ - int *copy_from = (int *) alloca (window_size * sizeof (int)); + int *copy_from = alloca (window_size * sizeof *copy_from); /* Non-zero for each row in the new matrix that is retained from the old matrix. Lines not retained are empty. */ - char *retained_p = (char *) alloca (window_size * sizeof (char)); + char *retained_p = alloca (window_size * sizeof *retained_p); memset (retained_p, 0, window_size * sizeof (char)); === modified file 'src/search.c' --- src/search.c 2012-07-05 06:32:41 +0000 +++ src/search.c 2012-07-05 18:35:48 +0000 @@ -175,8 +175,7 @@ for (cp = searchbuf_head; cp != 0; cp = cp->next) { cp->buf.allocated = cp->buf.used; - cp->buf.buffer - = (unsigned char *) xrealloc (cp->buf.buffer, cp->buf.used); + cp->buf.buffer = xrealloc (cp->buf.buffer, cp->buf.used); } } @@ -1274,7 +1273,7 @@ raw_pattern_size_byte = count_size_as_multibyte (SDATA (string), raw_pattern_size); - raw_pattern = (unsigned char *) alloca (raw_pattern_size_byte + 1); + raw_pattern = alloca (raw_pattern_size_byte + 1); copy_text (SDATA (string), raw_pattern, SCHARS (string), 0, 1); } @@ -1288,7 +1287,7 @@ the chosen single-byte character set can possibly match. */ raw_pattern_size = SCHARS (string); raw_pattern_size_byte = SCHARS (string); - raw_pattern = (unsigned char *) alloca (raw_pattern_size + 1); + raw_pattern = alloca (raw_pattern_size + 1); copy_text (SDATA (string), raw_pattern, SBYTES (string), 1, 0); } @@ -1296,7 +1295,7 @@ /* Copy and optionally translate the pattern. */ len = raw_pattern_size; len_byte = raw_pattern_size_byte; - patbuf = (unsigned char *) alloca (len * MAX_MULTIBYTE_LENGTH); + patbuf = alloca (len * MAX_MULTIBYTE_LENGTH); pat = patbuf; base_pat = raw_pattern; if (multibyte) @@ -2741,8 +2740,7 @@ prev = Qnil; - data = (Lisp_Object *) alloca ((2 * search_regs.num_regs + 1) - * sizeof (Lisp_Object)); + data = alloca ((2 * search_regs.num_regs + 1) * sizeof *data); len = 0; for (i = 0; i < search_regs.num_regs; i++) @@ -3008,7 +3006,7 @@ CHECK_STRING (string); - temp = (char *) alloca (SBYTES (string) * 2); + temp = alloca (SBYTES (string) * 2); /* Now copy the data into the new string, inserting escapes. */ === modified file 'src/sound.c' --- src/sound.c 2012-07-05 06:32:41 +0000 +++ src/sound.c 2012-07-05 18:35:48 +0000 @@ -594,7 +594,7 @@ ptrdiff_t blksize = sd->period_size ? sd->period_size (sd) : 2048; ptrdiff_t data_left = header->data_length; - buffer = (char *) alloca (blksize); + buffer = alloca (blksize); lseek (s->fd, sizeof *header, SEEK_SET); while (data_left > 0 && (nbytes = emacs_read (s->fd, buffer, blksize)) > 0) @@ -688,7 +688,7 @@ lseek (s->fd, header->data_offset, SEEK_SET); /* Copy sound data to the device. */ - buffer = (char *) alloca (blksize); + buffer = alloca (blksize); while ((nbytes = emacs_read (s->fd, buffer, blksize)) > 0) sd->write (sd, buffer, nbytes); @@ -932,7 +932,7 @@ else file = DEFAULT_ALSA_SOUND_DEVICE; - p = xmalloc (sizeof (*p)); + p = xmalloc (sizeof *p); p->handle = NULL; p->hwparams = NULL; p->swparams = NULL; @@ -1364,10 +1364,10 @@ #ifndef WINDOWSNT file = Qnil; GCPRO2 (sound, file); - current_sound_device = xzalloc (sizeof (struct sound_device)); - current_sound = xzalloc (sizeof (struct sound)); + current_sound_device = xzalloc (sizeof *current_sound_device); + current_sound = xzalloc (sizeof *current_sound); record_unwind_protect (sound_cleanup, Qnil); - current_sound->header = (char *) alloca (MAX_SOUND_HEADER_BYTES); + current_sound->header = alloca (MAX_SOUND_HEADER_BYTES); if (STRINGP (attrs[SOUND_FILE])) { @@ -1399,7 +1399,7 @@ if (STRINGP (attrs[SOUND_DEVICE])) { int len = SCHARS (attrs[SOUND_DEVICE]); - current_sound_device->file = (char *) alloca (len + 1); + current_sound_device->file = alloca (len + 1); strcpy (current_sound_device->file, SSDATA (attrs[SOUND_DEVICE])); } @@ -1431,7 +1431,7 @@ lo_file = Fexpand_file_name (attrs[SOUND_FILE], Qnil); len = XSTRING (lo_file)->size; - psz_file = (char *) alloca (len + 1); + psz_file = alloca (len + 1); strcpy (psz_file, XSTRING (lo_file)->data); if (INTEGERP (attrs[SOUND_VOLUME])) { === modified file 'src/syntax.c' --- src/syntax.c 2012-07-03 18:24:42 +0000 +++ src/syntax.c 2012-07-05 18:35:48 +0000 @@ -1581,7 +1581,7 @@ fastmap[CHAR_LEADING_CODE (c)] = 1; range_start_byte = i; range_start_char = c; - char_ranges = (int *) alloca (sizeof (int) * 128 * 2); + char_ranges = alloca (sizeof *char_ranges * 128 * 2); for (i = 129; i < 0400; i++) { c = BYTE8_TO_CHAR (i); @@ -1602,7 +1602,7 @@ } else /* STRING is multibyte */ { - char_ranges = (int *) alloca (sizeof (int) * SCHARS (string) * 2); + char_ranges = alloca (sizeof *char_ranges * SCHARS (string) * 2); while (i_byte < size_byte) { === modified file 'src/sysdep.c' --- src/sysdep.c 2012-07-05 06:32:41 +0000 +++ src/sysdep.c 2012-07-05 18:35:48 +0000 @@ -143,7 +143,7 @@ #endif ) { - buf = (char *) malloc (strlen (pwd) + 1); + buf = malloc (strlen (pwd) + 1); if (!buf) return NULL; strcpy (buf, pwd); @@ -152,7 +152,7 @@ else { size_t buf_size = 1024; - buf = (char *) malloc (buf_size); + buf = malloc (buf_size); if (!buf) return NULL; for (;;) @@ -167,7 +167,7 @@ return NULL; } buf_size *= 2; - buf = (char *) realloc (buf, buf_size); + buf = realloc (buf, buf_size); if (!buf) return NULL; } @@ -176,7 +176,7 @@ else { /* We need MAXPATHLEN here. */ - buf = (char *) malloc (MAXPATHLEN + 1); + buf = malloc (MAXPATHLEN + 1); if (!buf) return NULL; if (getwd (buf) == NULL) @@ -516,7 +516,7 @@ goto xyzzy; dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil); - str_volatile = str = (unsigned char *) alloca (SCHARS (dir) + 2); + str_volatile = str = alloca (SCHARS (dir) + 2); len = SCHARS (dir); memcpy (str, SDATA (dir), len); if (str[len - 1] != '/') str[len++] = '/'; @@ -851,7 +851,7 @@ return; /* The tty is suspended. */ if (! tty_out->old_tty) - tty_out->old_tty = xmalloc (sizeof (struct emacs_tty)); + tty_out->old_tty = xmalloc (sizeof *tty_out->old_tty); emacs_get_tty (fileno (tty_out->input), tty_out->old_tty); @@ -1345,7 +1345,7 @@ Vsystem_name = build_string (uts.nodename); #else /* HAVE_GETHOSTNAME */ unsigned int hostname_size = 256; - char *hostname = (char *) alloca (hostname_size); + char *hostname = alloca (hostname_size); /* Try to get the host name; if the buffer is too short, try again. Apparently, the only indication gethostname gives of @@ -1361,7 +1361,7 @@ break; hostname_size <<= 1; - hostname = (char *) alloca (hostname_size); + hostname = alloca (hostname_size); } #ifdef HAVE_SOCKETS /* Turn the hostname into the official, fully-qualified hostname. === modified file 'src/term.c' --- src/term.c 2012-07-05 06:32:41 +0000 +++ src/term.c 2012-07-05 18:35:48 +0000 @@ -2858,13 +2858,11 @@ void create_tty_output (struct frame *f) { - struct tty_output *t; + struct tty_output *t = xzalloc (sizeof *t); if (! FRAME_TERMCAP_P (f)) abort (); - t = xzalloc (sizeof (struct tty_output)); - t->display_info = FRAME_TERMINAL (f)->display_info.tty; f->output_data.tty = t; @@ -3064,7 +3062,7 @@ been_here = 1; tty = &the_only_display_info; #else - tty = xzalloc (sizeof (struct tty_display_info)); + tty = xzalloc (sizeof *tty); #endif tty->next = tty_list; tty_list = tty; @@ -3073,7 +3071,7 @@ terminal->display_info.tty = tty; tty->terminal = terminal; - tty->Wcm = xmalloc (sizeof (struct cm)); + tty->Wcm = xmalloc (sizeof *tty->Wcm); Wcm_clear (tty); encode_terminal_src_size = 0; @@ -3343,7 +3341,7 @@ tty->mouse_highlight.mouse_face_window = Qnil; #endif - terminal->kboard = xmalloc (sizeof (KBOARD)); + terminal->kboard = xmalloc (sizeof *terminal->kboard); init_kboard (terminal->kboard); KVAR (terminal->kboard, Vwindow_system) = Qnil; terminal->kboard->next_kboard = all_kboards; === modified file 'src/termcap.c' --- src/termcap.c 2012-07-05 06:32:41 +0000 +++ src/termcap.c 2012-07-05 18:35:48 +0000 @@ -478,7 +478,7 @@ { ptrdiff_t offset1 = bp1 - bp, offset2 = tc_search_point - bp; malloc_size = offset1 + buf.size; - bp = termcap_name = (char *) xrealloc (bp, malloc_size); + bp = termcap_name = xrealloc (bp, malloc_size); bp1 = termcap_name + offset1; tc_search_point = termcap_name + offset2; } @@ -504,7 +504,7 @@ xfree (buf.beg); if (malloc_size) - bp = (char *) xrealloc (bp, bp1 - bp + 1); + bp = xrealloc (bp, bp1 - bp + 1); ret: term_entry = bp; === modified file 'src/unexmacosx.c' --- src/unexmacosx.c 2012-06-27 03:52:02 +0000 +++ src/unexmacosx.c 2012-07-05 18:35:48 +0000 @@ -394,7 +394,7 @@ } else { - r = (struct region_t *) malloc (sizeof (struct region_t)); + r = malloc (sizeof *r); if (!r) unexec_error ("cannot allocate region structure"); @@ -669,7 +669,7 @@ #endif nlc = mh.ncmds; - lca = (struct load_command **) malloc (nlc * sizeof (struct load_command *)); + lca = malloc (nlc * sizeof *lca); for (i = 0; i < nlc; i++) { @@ -678,7 +678,7 @@ size first and then read the rest. */ if (!unexec_read (&lc, sizeof (struct load_command))) unexec_error ("cannot read load command"); - lca[i] = (struct load_command *) malloc (lc.cmdsize); + lca[i] = malloc (lc.cmdsize); memcpy (lca[i], &lc, sizeof (struct load_command)); if (!unexec_read (lca[i] + 1, lc.cmdsize - sizeof (struct load_command))) unexec_error ("cannot read content of load command"); @@ -1378,7 +1378,7 @@ size_t old_size = ((unexec_malloc_header_t *) old_ptr)[-1].u.size; size_t size = new_size > old_size ? old_size : new_size; - p = (size_t *) malloc (new_size); + p = malloc (new_size); if (size) memcpy (p, old_ptr, size); } === modified file 'src/window.c' --- src/window.c 2012-07-04 17:58:55 +0000 +++ src/window.c 2012-07-05 18:35:48 +0000 @@ -5469,9 +5469,8 @@ really like to do is to free only those matrices not reused below. */ root_window = XWINDOW (FRAME_ROOT_WINDOW (f)); - leaf_windows - = (struct window **) alloca (count_windows (root_window) - * sizeof (struct window *)); + leaf_windows = alloca (count_windows (root_window) + * sizeof *leaf_windows); n_leaf_windows = get_leaf_windows (root_window, leaf_windows, 0); /* Kludge Alert! === modified file 'src/xdisp.c' --- src/xdisp.c 2012-07-05 16:28:34 +0000 +++ src/xdisp.c 2012-07-05 18:35:48 +0000 @@ -5400,8 +5400,7 @@ ptrdiff_t size = 20; ptrdiff_t n = 0, i, j; int invis_p; - struct overlay_entry *entries - = (struct overlay_entry *) alloca (size * sizeof *entries); + struct overlay_entry *entries = alloca (size * sizeof *entries); USE_SAFE_ALLOCA; if (charpos <= 0) @@ -14949,7 +14948,7 @@ return rc; #endif - /* Previously, there was a check for Lisp integer in the + /* Previously, there was a check for Lisp integer in the if-statement below. Now, this field is converted to ptrdiff_t, thus zero means invalid position in a buffer. */ eassert (w->last_point > 0); @@ -18012,7 +18011,7 @@ for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area) { - char *s = (char *) alloca (row->used[area] + 1); + char *s = alloca (row->used[area] + 1); int i; for (i = 0; i < row->used[area]; ++i) @@ -21137,7 +21136,7 @@ } else if (CHARACTERP (eoltype)) { - unsigned char *tmp = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH); + unsigned char *tmp = alloca (MAX_MULTIBYTE_LENGTH); int c = XFASTINT (eoltype); eol_str_len = CHAR_STRING (c, tmp); eol_str = tmp; @@ -23010,7 +23009,7 @@ #define BUILD_STRETCH_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \ do \ { \ - s = (struct glyph_string *) alloca (sizeof *s); \ + s = alloca (sizeof *s); \ INIT_GLYPH_STRING (s, NULL, w, row, area, START, HL); \ START = fill_stretch_glyph_string (s, START, END); \ append_glyph_string (&HEAD, &TAIL, s); \ @@ -23030,7 +23029,7 @@ #define BUILD_IMAGE_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \ do \ { \ - s = (struct glyph_string *) alloca (sizeof *s); \ + s = alloca (sizeof *s); \ INIT_GLYPH_STRING (s, NULL, w, row, area, START, HL); \ fill_image_glyph_string (s); \ append_glyph_string (&HEAD, &TAIL, s); \ @@ -23057,8 +23056,8 @@ \ face_id = (row)->glyphs[area][START].face_id; \ \ - s = (struct glyph_string *) alloca (sizeof *s); \ - char2b = (XChar2b *) alloca ((END - START) * sizeof *char2b); \ + s = alloca (sizeof *s); \ + char2b = alloca ((END - START) * sizeof *char2b); \ INIT_GLYPH_STRING (s, char2b, w, row, area, START, HL); \ append_glyph_string (&HEAD, &TAIL, s); \ s->x = (X); \ @@ -23086,13 +23085,13 @@ struct glyph_string *first_s = NULL; \ int n; \ \ - char2b = (XChar2b *) alloca ((sizeof *char2b) * cmp->glyph_len); \ + char2b = alloca (cmp->glyph_len * sizeof *char2b); \ \ /* Make glyph_strings for each glyph sequence that is drawable by \ the same face, and append them to HEAD/TAIL. */ \ for (n = 0; n < cmp->glyph_len;) \ { \ - s = (struct glyph_string *) alloca (sizeof *s); \ + s = alloca (sizeof *s); \ INIT_GLYPH_STRING (s, char2b, w, row, area, START, HL); \ append_glyph_string (&(HEAD), &(TAIL), s); \ s->cmp = cmp; \ @@ -23120,9 +23119,8 @@ face_id = (row)->glyphs[area][START].face_id; \ gstring = (composition_gstring_from_id \ ((row)->glyphs[area][START].u.cmp.id)); \ - s = (struct glyph_string *) alloca (sizeof *s); \ - char2b = (XChar2b *) alloca ((sizeof *char2b) \ - * LGSTRING_GLYPH_LEN (gstring)); \ + s = alloca (sizeof *s); \ + char2b = alloca (LGSTRING_GLYPH_LEN (gstring) * sizeof *char2b); \ INIT_GLYPH_STRING (s, char2b, w, row, area, START, HL); \ append_glyph_string (&(HEAD), &(TAIL), s); \ s->x = (X); \ @@ -23141,7 +23139,7 @@ \ face_id = (row)->glyphs[area][START].face_id; \ \ - s = (struct glyph_string *) alloca (sizeof *s); \ + s = alloca (sizeof *s); \ INIT_GLYPH_STRING (s, NULL, w, row, area, START, HL); \ append_glyph_string (&HEAD, &TAIL, s); \ s->x = (X); \ === modified file 'src/xfaces.c' --- src/xfaces.c 2012-07-05 06:32:41 +0000 +++ src/xfaces.c 2012-07-05 18:35:48 +0000 @@ -703,9 +703,8 @@ unsigned long mask, XGCValues *xgcv) { - GC gc = xmalloc (sizeof (*gc)); - if (gc) - memcpy (gc, xgcv, sizeof (XGCValues)); + GC gc = xmalloc (sizeof *gc); + memcpy (gc, xgcv, sizeof (XGCValues)); return gc; } @@ -2951,7 +2950,7 @@ else if (EQ (attr, QCunderline)) { int valid_p = 0; - + if (UNSPECIFIEDP (value) || IGNORE_DEFFACE_P (value)) valid_p = 1; else if (NILP (value) || EQ (value, Qt)) @@ -2971,8 +2970,8 @@ list = CDR_SAFE (list); val = CAR_SAFE (list); list = CDR_SAFE (list); - - if(NILP (key) || NILP (val)) + + if (NILP (key) || NILP (val)) { valid_p = 0; break; @@ -2985,8 +2984,8 @@ valid_p = 0; break; } - - else if (EQ (key, QCstyle) + + else if (EQ (key, QCstyle) && !(EQ (val, Qline) || EQ (val, Qwave))) { valid_p = 0; @@ -2994,10 +2993,10 @@ } } } - + if (!valid_p) signal_error ("Invalid face underline", value); - + old_value = LFACE_UNDERLINE (lface); LFACE_UNDERLINE (lface) = value; } @@ -5774,7 +5773,7 @@ } else if (CONSP (underline)) { - /* `(:color COLOR :style STYLE)'. + /* `(:color COLOR :style STYLE)'. STYLE being one of `line' or `wave'. */ face->underline_p = 1; face->underline_color = 0; @@ -5816,7 +5815,7 @@ } } } - + overline = attrs[LFACE_OVERLINE_INDEX]; if (STRINGP (overline)) { === modified file 'src/xfns.c' --- src/xfns.c 2012-07-05 06:32:41 +0000 +++ src/xfns.c 2012-07-05 18:35:48 +0000 @@ -1881,7 +1881,7 @@ /* Make a fontset name from the base font name. */ if (xic_default_fontset == base_fontname) - { + { /* There is no base font name, use the default. */ fontsetname = xmalloc (strlen (base_fontname) + 2); strcpy (fontsetname, base_fontname); @@ -1953,21 +1953,21 @@ /* Build the font spec that matches all charsets. */ len = p - base_fontname + strlen (allcs) + 1; - font_allcs = (char *) alloca (len); + font_allcs = alloca (len); memcpy (font_allcs, base_fontname, p - base_fontname); strcat (font_allcs, allcs); /* Build the font spec that matches all families and add-styles. */ len = p - p1 + strlen (allcs) + strlen (allfamilies) + 1; - font_allfamilies = (char *) alloca (len); + font_allfamilies = alloca (len); strcpy (font_allfamilies, allfamilies); memcpy (font_allfamilies + strlen (allfamilies), p1, p - p1); strcat (font_allfamilies, allcs); /* Build the font spec that matches all. */ len = p - p2 + strlen (allcs) + strlen (all) + strlen (allfamilies) + 1; - font_all = (char *) alloca (len); + font_all = alloca (len); strcpy (font_all, allfamilies); strcat (font_all, all); memcpy (font_all + strlen (all) + strlen (allfamilies), p2, p - p2); @@ -3129,7 +3129,7 @@ f->terminal = dpyinfo->terminal; f->output_method = output_x_window; - f->output_data.x = xzalloc (sizeof (struct x_output)); + f->output_data.x = xzalloc (sizeof *f->output_data.x); f->output_data.x->icon_bitmap = -1; FRAME_FONTSET (f) = -1; f->output_data.x->scroll_bar_foreground_pixel = -1; @@ -3957,7 +3957,7 @@ /* VALUE should be of the form CLASS-DEPTH, where CLASS is one of `PseudoColor', `TrueColor' etc. and DEPTH is the color depth, a decimal number. NAME is compared with case ignored. */ - char *s = (char *) alloca (SBYTES (value) + 1); + char *s = alloca (SBYTES (value) + 1); char *dash; int i, class = -1; XVisualInfo vinfo; @@ -4614,7 +4614,7 @@ from this point on, x_destroy_window might screw up reference counts etc. */ f->output_method = output_x_window; - f->output_data.x = xzalloc (sizeof (struct x_output)); + f->output_data.x = xzalloc (sizeof *f->output_data.x); f->output_data.x->icon_bitmap = -1; FRAME_FONTSET (f) = -1; f->output_data.x->scroll_bar_foreground_pixel = -1; === modified file 'src/xftfont.c' --- src/xftfont.c 2012-01-19 07:21:25 +0000 +++ src/xftfont.c 2012-07-05 18:35:48 +0000 @@ -527,7 +527,7 @@ } #endif - xftface_info = malloc (sizeof (struct xftface_info)); + xftface_info = malloc (sizeof *xftface_info); if (! xftface_info) return -1; xftfont_get_colors (f, face, face->gc, NULL, === modified file 'src/xgselect.c' --- src/xgselect.c 2012-06-22 21:17:42 +0000 +++ src/xgselect.c 2012-07-05 18:35:48 +0000 @@ -153,6 +153,6 @@ { #if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS) gfds_size = 128; - gfds = xmalloc (sizeof (*gfds)*gfds_size); + gfds = xmalloc (gfds_size * sizeof *gfds); #endif } === modified file 'src/xmenu.c' --- src/xmenu.c 2012-07-05 06:32:41 +0000 +++ src/xmenu.c 2012-07-05 18:35:48 +0000 @@ -980,8 +980,7 @@ ptrdiff_t specpdl_count = SPECPDL_INDEX (); int previous_menu_items_used = f->menu_bar_items_used; Lisp_Object *previous_items - = (Lisp_Object *) alloca (previous_menu_items_used - * sizeof (Lisp_Object)); + = alloca (previous_menu_items_used * sizeof *previous_items); int subitems; /* If we are making a new widget, its contents are empty, @@ -1028,10 +1027,11 @@ menu_items = f->menu_bar_vector; menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; subitems = ASIZE (items) / 4; - submenu_start = (int *) alloca ((subitems + 1) * sizeof (int)); - submenu_end = (int *) alloca (subitems * sizeof (int)); - submenu_n_panes = (int *) alloca (subitems * sizeof (int)); - submenu_top_level_items = (int *) alloca (subitems * sizeof (int)); + submenu_start = alloca ((subitems + 1) * sizeof *submenu_start); + submenu_end = alloca (subitems * sizeof *submenu_end); + submenu_n_panes = alloca (subitems * sizeof *submenu_n_panes); + submenu_top_level_items = alloca (subitems + * sizeof *submenu_top_level_items); init_menu_items (); for (i = 0; i < subitems; i++) { @@ -1639,9 +1639,9 @@ int i; widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; widget_value **submenu_stack - = (widget_value **) alloca (menu_items_used * sizeof (widget_value *)); + = alloca (menu_items_used * sizeof *submenu_stack); Lisp_Object *subprefix_stack - = (Lisp_Object *) alloca (menu_items_used * sizeof (Lisp_Object)); + = alloca (menu_items_used * sizeof *subprefix_stack); int submenu_depth = 0; int first_pane; @@ -2416,7 +2416,7 @@ { /* if alloca is fast, use that to make the space, to reduce gc needs. */ - item_data = (char *) alloca (maxwidth + SBYTES (descrip) + 1); + item_data = alloca (maxwidth + SBYTES (descrip) + 1); memcpy (item_data, SSDATA (item_name), SBYTES (item_name)); for (j = SCHARS (item_name); j < maxwidth; j++) item_data[j] = ' '; === modified file 'src/xrdb.c' --- src/xrdb.c 2012-07-05 06:32:41 +0000 +++ src/xrdb.c 2012-07-05 18:35:48 +0000 @@ -74,10 +74,8 @@ x_get_customization_string (XrmDatabase db, const char *name, const char *class) { - char *full_name - = (char *) alloca (strlen (name) + sizeof ("customization") + 3); - char *full_class - = (char *) alloca (strlen (class) + sizeof ("Customization") + 3); + char *full_name = alloca (strlen (name) + sizeof "customization" + 3); + char *full_class = alloca (strlen (class) + sizeof "Customization" + 3); char *result; sprintf (full_name, "%s.%s", name, "customization"); @@ -206,7 +204,7 @@ if (min (PTRDIFF_MAX, SIZE_MAX) / 2 - 1 - path_len < next_len) memory_full (SIZE_MAX); path_size = (path_len + next_len + 1) * 2; - path = (char *) xrealloc (path, path_size); + path = xrealloc (path, path_size); } memcpy (path + path_len, next, next_len); @@ -400,7 +398,7 @@ char *xdefault; home = gethomedir (); - xdefault = xmalloc (strlen (home) + sizeof (".Xdefaults")); + xdefault = xmalloc (strlen (home) + sizeof ".Xdefaults"); strcpy (xdefault, home); strcat (xdefault, ".Xdefaults"); db = XrmGetFileDatabase (xdefault); @@ -434,7 +432,7 @@ char *home = gethomedir (); char const *host = get_system_name (); ptrdiff_t pathsize = strlen (home) + sizeof xdefaults + strlen (host); - path = (char *) xrealloc (home, pathsize); + path = xrealloc (home, pathsize); strcat (strcat (path, xdefaults), host); p = path; } === modified file 'src/xselect.c' --- src/xselect.c 2012-07-05 06:32:41 +0000 +++ src/xselect.c 2012-07-05 18:35:48 +0000 @@ -180,7 +180,7 @@ } } - queue_tmp = xmalloc (sizeof (struct selection_event_queue)); + queue_tmp = xmalloc (sizeof *queue_tmp); TRACE1 ("QUEUE SELECTION EVENT %p", queue_tmp); queue_tmp->event = *event; queue_tmp->next = selection_queue; @@ -907,7 +907,7 @@ { if (for_multiple) { - cs = xmalloc (sizeof (struct selection_data)); + cs = xmalloc (sizeof *cs); cs->data = (unsigned char *) &conversion_fail_tag; cs->size = 1; cs->format = 32; @@ -924,7 +924,7 @@ } /* Otherwise, record the converted selection to binary. */ - cs = xmalloc (sizeof (struct selection_data)); + cs = xmalloc (sizeof *cs); cs->data = NULL; cs->nofree = 1; cs->property = property; @@ -1775,20 +1775,24 @@ } else if (SYMBOLP (obj)) { - *data_ret = xmalloc (sizeof (Atom) + 1); + void *data = xmalloc (sizeof (Atom) + 1); + Atom *x_atom_ptr = data; + *data_ret = data; *format_ret = 32; *size_ret = 1; (*data_ret) [sizeof (Atom)] = 0; - (*(Atom **) data_ret) [0] = symbol_to_x_atom (dpyinfo, obj); + *x_atom_ptr = symbol_to_x_atom (dpyinfo, obj); if (NILP (type)) type = QATOM; } else if (RANGED_INTEGERP (X_SHRT_MIN, obj, X_SHRT_MAX)) { - *data_ret = xmalloc (sizeof (short) + 1); + void *data = xmalloc (sizeof (short) + 1); + short *short_ptr = data; + *data_ret = data; *format_ret = 16; *size_ret = 1; (*data_ret) [sizeof (short)] = 0; - (*(short **) data_ret) [0] = XINT (obj); + *short_ptr = XINT (obj); if (NILP (type)) type = QINTEGER; } else if (INTEGERP (obj) @@ -1797,11 +1801,13 @@ || (CONSP (XCDR (obj)) && INTEGERP (XCAR (XCDR (obj))))))) { - *data_ret = xmalloc (sizeof (unsigned long) + 1); + void *data = xmalloc (sizeof (unsigned long) + 1); + unsigned long *x_long_ptr = data; + *data_ret = data; *format_ret = 32; *size_ret = 1; (*data_ret) [sizeof (unsigned long)] = 0; - (*(unsigned long **) data_ret) [0] = cons_to_x_long (obj); + *x_long_ptr = cons_to_x_long (obj); if (NILP (type)) type = QINTEGER; } else if (VECTORP (obj)) @@ -1816,23 +1822,28 @@ if (SYMBOLP (AREF (obj, 0))) /* This vector is an ATOM set */ { + void *data; + Atom *x_atoms; if (NILP (type)) type = QATOM; for (i = 0; i < size; i++) if (!SYMBOLP (AREF (obj, i))) signal_error ("All elements of selection vector must have same type", obj); - *data_ret = xnmalloc (size, sizeof (Atom)); + *data_ret = data = xnmalloc (size, sizeof *x_atoms); + x_atoms = data; *format_ret = 32; *size_ret = size; for (i = 0; i < size; i++) - (*(Atom **) data_ret) [i] - = symbol_to_x_atom (dpyinfo, AREF (obj, i)); + x_atoms[i] = symbol_to_x_atom (dpyinfo, AREF (obj, i)); } else /* This vector is an INTEGER set, or something like it */ { int format = 16; int data_size = sizeof (short); + void *data; + unsigned long *x_atoms; + short *shorts; if (NILP (type)) type = QINTEGER; for (i = 0; i < size; i++) { @@ -1847,17 +1858,17 @@ break; } } - *data_ret = xnmalloc (size, data_size); + *data_ret = data = xnmalloc (size, data_size); + x_atoms = data; + shorts = data; *format_ret = format; *size_ret = size; for (i = 0; i < size; i++) { if (format == 32) - (*((unsigned long **) data_ret)) [i] = - cons_to_x_long (AREF (obj, i)); + x_atoms[i] = cons_to_x_long (AREF (obj, i)); else - (*((short **) data_ret)) [i] = - XINT (AREF (obj, i)); + shorts[i] = XINT (AREF (obj, i)); } } } === modified file 'src/xterm.c' --- src/xterm.c 2012-07-05 06:32:41 +0000 +++ src/xterm.c 2012-07-05 18:35:48 +0000 @@ -6450,7 +6450,7 @@ if (status_return == XBufferOverflow) { copy_bufsiz = nbytes + 1; - copy_bufptr = (unsigned char *) alloca (copy_bufsiz); + copy_bufptr = alloca (copy_bufsiz); nbytes = XmbLookupString (FRAME_XIC (f), &event.xkey, (char *) copy_bufptr, copy_bufsiz, &keysym, @@ -7670,7 +7670,7 @@ void x_catch_errors (Display *dpy) { - struct x_error_message_stack *data = xmalloc (sizeof (*data)); + struct x_error_message_stack *data = xmalloc (sizeof *data); /* Make sure any errors from previous requests have been dealt with. */ XSync (dpy, False); @@ -7798,7 +7798,7 @@ Lisp_Object frame, tail; ptrdiff_t idx = SPECPDL_INDEX (); - error_msg = (char *) alloca (strlen (error_message) + 1); + error_msg = alloca (strlen (error_message) + 1); strcpy (error_msg, error_message); handling_signal = 0; @@ -8187,10 +8187,9 @@ if (use_xim) { #ifdef HAVE_X11R6_XIM - struct xim_inst_t *xim_inst; + struct xim_inst_t *xim_inst = xmalloc (sizeof *xim_inst); ptrdiff_t len; - xim_inst = xmalloc (sizeof (struct xim_inst_t)); dpyinfo->xim_callback_data = xim_inst; xim_inst->dpyinfo = dpyinfo; len = strlen (resource_name); @@ -10098,7 +10097,7 @@ /* We have definitely succeeded. Record the new connection. */ - dpyinfo = xzalloc (sizeof (struct x_display_info)); + dpyinfo = xzalloc (sizeof *dpyinfo); hlinfo = &dpyinfo->mouse_highlight; terminal = x_create_terminal (dpyinfo); @@ -10116,7 +10115,7 @@ terminal->kboard = share->terminal->kboard; else { - terminal->kboard = xmalloc (sizeof (KBOARD)); + terminal->kboard = xmalloc (sizeof *terminal->kboard); init_kboard (terminal->kboard); KVAR (terminal->kboard, Vwindow_system) = Qx; @@ -10370,8 +10369,8 @@ const int atom_count = sizeof (atom_refs) / sizeof (atom_refs[0]); /* 1 for _XSETTINGS_SN */ const int total_atom_count = 1 + atom_count; - Atom *atoms_return = xmalloc (sizeof (Atom) * total_atom_count); - char **atom_names = xmalloc (sizeof (char *) * total_atom_count); + Atom *atoms_return = xmalloc (total_atom_count * sizeof *atoms_return); + char **atom_names = xmalloc (total_atom_count * sizeof *atom_names); static char const xsettings_fmt[] = "_XSETTINGS_S%d"; char xsettings_atom_name[sizeof xsettings_fmt - 2 + INT_STRLEN_BOUND (int)]; @@ -10399,7 +10398,7 @@ dpyinfo->x_dnd_atoms_size = 8; dpyinfo->x_dnd_atoms_length = 0; - dpyinfo->x_dnd_atoms = xmalloc (sizeof (*dpyinfo->x_dnd_atoms) + dpyinfo->x_dnd_atoms = xmalloc (sizeof *dpyinfo->x_dnd_atoms * dpyinfo->x_dnd_atoms_size); dpyinfo->net_supported_atoms = NULL; ------------------------------------------------------------ revno: 108884 committer: Eli Zaretskii branch nick: trunk timestamp: Thu 2012-07-05 19:28:34 +0300 message: Avoid long futile looping on a TTY under huge values of hscroll. src/xdisp.c (display_line): Fix horizontal pixel coordinates when hscroll is larger than the line width. Fixes long and futile looping inside extend_face_to_end_of_line (on a TTY) producing glyphs that are not needed and thrown away. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-05 16:14:39 +0000 +++ src/ChangeLog 2012-07-05 16:28:34 +0000 @@ -1,3 +1,10 @@ +2012-07-05 Eli Zaretskii + + * xdisp.c (display_line): Fix horizontal pixel coordinates when + hscroll is larger than the line width. Fixes long and futile + looping inside extend_face_to_end_of_line (on a TTY) producing + glyphs that are not needed and thrown away. + 2012-07-05 Dmitry Antipov * marker.c (set_marker_restricted_both): Simplify by using === modified file 'src/xdisp.c' --- src/xdisp.c 2012-07-05 15:20:12 +0000 +++ src/xdisp.c 2012-07-05 16:28:34 +0000 @@ -19177,9 +19177,22 @@ if the first glyph is partially visible or if we hit a line end. */ if (it->current_x < it->first_visible_x) { + enum move_it_result move_result; + this_line_min_pos = row->start.pos; - move_it_in_display_line_to (it, ZV, it->first_visible_x, - MOVE_TO_POS | MOVE_TO_X); + move_result = move_it_in_display_line_to (it, ZV, it->first_visible_x, + MOVE_TO_POS | MOVE_TO_X); + /* If we are under a large hscroll, move_it_in_display_line_to + could hit the end of the line without reaching + it->first_visible_x. Pretend that we did reach it. This is + especially important on a TTY, where we will call + extend_face_to_end_of_line, which needs to know how many + blank glyphs to produce. */ + if (it->current_x < it->first_visible_x + && (move_result == MOVE_NEWLINE_OR_CR + || move_result == MOVE_POS_MATCH_OR_ZV)) + it->current_x = it->first_visible_x; + /* Record the smallest positions seen while we moved over display elements that are not visible. This is needed by redisplay_internal for optimizing the case where the cursor ------------------------------------------------------------ revno: 108883 committer: Dmitry Antipov branch nick: trunk timestamp: Thu 2012-07-05 20:14:39 +0400 message: * marker.c (set_marker_restricted_both): Simplify by using clip_to_bounds. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-05 16:00:20 +0000 +++ src/ChangeLog 2012-07-05 16:14:39 +0000 @@ -1,3 +1,8 @@ +2012-07-05 Dmitry Antipov + + * marker.c (set_marker_restricted_both): Simplify by using + clip_to_bounds. + 2012-07-05 Paul Eggert * editfns.c (region_limit): Simplify by using clip_to_bounds. === modified file 'src/marker.c' --- src/marker.c 2012-06-16 12:24:15 +0000 +++ src/marker.c 2012-07-05 16:14:39 +0000 @@ -667,14 +667,8 @@ } } - if (charpos < BUF_BEGV (b)) - charpos = BUF_BEGV (b); - if (charpos > BUF_ZV (b)) - charpos = BUF_ZV (b); - if (bytepos < BUF_BEGV_BYTE (b)) - bytepos = BUF_BEGV_BYTE (b); - if (bytepos > BUF_ZV_BYTE (b)) - bytepos = BUF_ZV_BYTE (b); + charpos = clip_to_bounds (BUF_BEGV (b), charpos, BUF_ZV (b)); + bytepos = clip_to_bounds (BUF_BEGV_BYTE (b), bytepos, BUF_ZV_BYTE (b)); /* In a single-byte buffer, the two positions must be equal. */ if (BUF_Z (b) == BUF_Z_BYTE (b) ------------------------------------------------------------ revno: 108882 committer: Paul Eggert branch nick: trunk timestamp: Thu 2012-07-05 09:00:20 -0700 message: * editfns.c (region_limit): Simplify by using clip_to_bounds. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-05 15:44:53 +0000 +++ src/ChangeLog 2012-07-05 16:00:20 +0000 @@ -1,3 +1,7 @@ +2012-07-05 Paul Eggert + + * editfns.c (region_limit): Simplify by using clip_to_bounds. + 2012-07-05 Jan Djärv * gtkutil.c (gtk_scrollbar_new, gtk_box_new): Define when HAVE_GTK3 is === modified file 'src/editfns.c' --- src/editfns.c 2012-07-05 06:32:41 +0000 +++ src/editfns.c 2012-07-05 16:00:20 +0000 @@ -281,13 +281,10 @@ if (NILP (m)) error ("The mark is not set now, so there is no region"); - if ((PT < XFASTINT (m)) == (beginningp != 0)) - return make_number (PT); - else - { /* Clip to the current narrowing (bug#11770). */ - ptrdiff_t mark = XFASTINT (m); - return make_number (mark < BEGV ? BEGV : mark > ZV ? ZV : mark); - } + /* Clip to the current narrowing (bug#11770). */ + return make_number ((PT < XFASTINT (m)) == (beginningp != 0) + ? PT + : clip_to_bounds (BEGV, XFASTINT (m), ZV)); } DEFUN ("region-beginning", Fregion_beginning, Sregion_beginning, 0, 0, 0, ------------------------------------------------------------ revno: 108881 fixes bug(s): http://debbugs.gnu.org/11768 committer: Jan D. branch nick: trunk timestamp: Thu 2012-07-05 17:44:53 +0200 message: Don't use deprecated functions when compiling with Gtk3. * gtkutil.c (gtk_scrollbar_new, gtk_box_new): Define when HAVE_GTK3 is not defined (Bug#11768). (xg_create_frame_widgets): Use gtk_plug_new_for_display (Bug#11768). (xg_create_frame_widgets, create_dialog, xg_get_file_with_chooser) (make_widget_for_menu_item, xg_make_tool_item): Use gtk_box_new followed by gtk_box_set_homogeneous (Bug#11768). (xg_update_menu_item): Use GTK_IS_BOX (Bug#11768). (update_theme_scrollbar_width, xg_create_scroll_bar): Use gtk_scrollbar_new (Bug#11768). (xg_event_is_for_scrollbar): Use Gdk Device functions for HAVE_GTK3. (is_box_type): New function (Bug#11768). (xg_tool_item_stale_p): Call is_box_type. (xg_initialize): Get settings by calling gtk_settings_get_for_screen with default display (Bug#11768). diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-05 15:20:12 +0000 +++ src/ChangeLog 2012-07-05 15:44:53 +0000 @@ -1,3 +1,20 @@ +2012-07-05 Jan Djärv + + * gtkutil.c (gtk_scrollbar_new, gtk_box_new): Define when HAVE_GTK3 is + not defined (Bug#11768). + (xg_create_frame_widgets): Use gtk_plug_new_for_display (Bug#11768). + (xg_create_frame_widgets, create_dialog, xg_get_file_with_chooser) + (make_widget_for_menu_item, xg_make_tool_item): Use gtk_box_new + followed by gtk_box_set_homogeneous (Bug#11768). + (xg_update_menu_item): Use GTK_IS_BOX (Bug#11768). + (update_theme_scrollbar_width, xg_create_scroll_bar): Use + gtk_scrollbar_new (Bug#11768). + (xg_event_is_for_scrollbar): Use Gdk Device functions for HAVE_GTK3. + (is_box_type): New function (Bug#11768). + (xg_tool_item_stale_p): Call is_box_type. + (xg_initialize): Get settings by calling gtk_settings_get_for_screen + with default display (Bug#11768). + 2012-07-05 Eli Zaretskii * xdisp.c (window_hscroll_limited): New function. === modified file 'src/gtkutil.c' --- src/gtkutil.c 2012-07-05 06:32:41 +0000 +++ src/gtkutil.c 2012-07-05 15:44:53 +0000 @@ -83,10 +83,16 @@ gdk_window_get_geometry (w, a, b, c, d, 0) #define gdk_x11_window_lookup_for_display(d, w) \ gdk_xid_table_lookup_for_display (d, w) +#define gtk_box_new(ori, spacing) \ + ((ori) == GTK_ORIENTATION_HORIZONTAL \ + ? gtk_hbox_new (FALSE, (spacing)) : gtk_vbox_new (FALSE, (spacing))) +#define gtk_scrollbar_new(ori, spacing) \ + ((ori) == GTK_ORIENTATION_HORIZONTAL \ + ? gtk_hscrollbar_new ((spacing)) : gtk_vscrollbar_new ((spacing))) #ifndef GDK_KEY_g #define GDK_KEY_g GDK_g #endif -#endif +#endif /* HAVE_GTK3 */ #define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x)) @@ -1097,7 +1103,10 @@ BLOCK_INPUT; if (FRAME_X_EMBEDDED_P (f)) - wtop = gtk_plug_new (f->output_data.x->parent_desc); + { + GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); + wtop = gtk_plug_new_for_display (gdpy, f->output_data.x->parent_desc); + } else wtop = gtk_window_new (GTK_WINDOW_TOPLEVEL); @@ -1111,8 +1120,10 @@ xg_set_screen (wtop, f); - wvbox = gtk_vbox_new (FALSE, 0); - whbox = gtk_hbox_new (FALSE, 0); + wvbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + whbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_box_set_homogeneous (GTK_BOX (wvbox), FALSE); + gtk_box_set_homogeneous (GTK_BOX (whbox), FALSE); #ifdef HAVE_GTK3 wfixed = emacs_fixed_new (f); @@ -1487,9 +1498,12 @@ if (make_two_rows) { - GtkWidget *wvbox = gtk_vbox_new (TRUE, button_spacing); - GtkWidget *whbox_up = gtk_hbox_new (FALSE, 0); - whbox_down = gtk_hbox_new (FALSE, 0); + GtkWidget *wvbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, button_spacing); + GtkWidget *whbox_up = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_box_set_homogeneous (GTK_BOX (wvbox), TRUE); + gtk_box_set_homogeneous (GTK_BOX (whbox_up), FALSE); + whbox_down = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_box_set_homogeneous (GTK_BOX (whbox_down), FALSE); gtk_box_pack_start (cur_box, wvbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (wvbox), whbox_up, FALSE, FALSE, 0); @@ -1777,7 +1791,8 @@ NULL); gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filewin), TRUE); - wbox = gtk_vbox_new (FALSE, 0); + wbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_box_set_homogeneous (GTK_BOX (wbox), FALSE); gtk_widget_show (wbox); wtoggle = gtk_check_button_new_with_label ("Show hidden files."); @@ -2189,7 +2204,8 @@ GtkWidget *wkey; GtkWidget *wbox; - wbox = gtk_hbox_new (FALSE, 0); + wbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_box_set_homogeneous (GTK_BOX (wbox), FALSE); wlbl = gtk_label_new (utf8_label); wkey = gtk_label_new (utf8_key); @@ -2846,7 +2862,7 @@ utf8_key = get_utf8_string (val->key); /* See if W is a menu item with a key. See make_menu_item above. */ - if (GTK_IS_HBOX (wchild)) + if (GTK_IS_BOX (wchild)) { GList *list = gtk_container_get_children (GTK_CONTAINER (wchild)); @@ -3400,7 +3416,7 @@ int w = 0, b = 0; vadj = gtk_adjustment_new (XG_SB_MIN, XG_SB_MIN, XG_SB_MAX, 0.1, 0.1, 0.1); - wscroll = gtk_vscrollbar_new (GTK_ADJUSTMENT (vadj)); + wscroll = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (vadj)); g_object_ref_sink (G_OBJECT (wscroll)); gtk_widget_style_get (wscroll, "slider-width", &w, "trough-border", &b, NULL); gtk_widget_destroy (wscroll); @@ -3477,7 +3493,7 @@ vadj = gtk_adjustment_new (XG_SB_MIN, XG_SB_MIN, XG_SB_MAX, 0.1, 0.1, 0.1); - wscroll = gtk_vscrollbar_new (GTK_ADJUSTMENT (vadj)); + wscroll = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (vadj)); webox = gtk_event_box_new (); gtk_widget_set_name (wscroll, scroll_bar_name); #ifndef HAVE_GTK3 @@ -3710,8 +3726,15 @@ { /* Check if press occurred outside the edit widget. */ GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); - retval = gdk_display_get_window_at_pointer (gdpy, NULL, NULL) - != gtk_widget_get_window (f->output_data.x->edit_widget); + GdkWindow *gwin; +#ifdef HAVE_GTK3 + GdkDevice *gdev = gdk_device_manager_get_client_pointer + (gdk_display_get_device_manager (gdpy)); + gdk_device_get_window_at_position (gdev, NULL, NULL); +#else + gwin = gdk_display_get_window_at_pointer (gdpy, NULL, NULL); +#endif + retval = gwin != gtk_widget_get_window (f->output_data.x->edit_widget); } else if (f && ((event->type == ButtonRelease && event->xbutton.button < 4) @@ -4232,11 +4255,16 @@ int i, int horiz, int text_image) { GtkToolItem *ti = gtk_tool_item_new (); - GtkWidget *vb = horiz ? gtk_hbox_new (FALSE, 0) : gtk_vbox_new (FALSE, 0); + GtkWidget *vb = gtk_box_new (horiz + ? GTK_ORIENTATION_HORIZONTAL + : GTK_ORIENTATION_VERTICAL, + 0); GtkWidget *wb = gtk_button_new (); /* The eventbox is here so we can have tooltips on disabled items. */ GtkWidget *weventbox = gtk_event_box_new (); + gtk_box_set_homogeneous (GTK_BOX (vb), FALSE); + if (wimage && !text_image) gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0); if (label) @@ -4304,6 +4332,24 @@ } static int +is_box_type (GtkWidget *vb, int is_horizontal) +{ +#ifdef HAVE_GTK3 + int ret = 0; + if (GTK_IS_BOX (vb)) + { + GtkOrientation ori = gtk_orientable_get_orientation (GTK_ORIENTABLE (vb)); + ret = (ori == GTK_ORIENTATION_HORIZONTAL && is_horizontal) + || (ori == GTK_ORIENTATION_VERTICAL && ! is_horizontal); + } + return ret; +#else + return is_horizontal ? GTK_IS_VBOX (vb) : GTK_IS_HBOX (vb); +#endif +} + + +static int xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name, const char *icon_name, const struct image *img, const char *label, int horiz) @@ -4331,14 +4377,14 @@ else if (wimage) { gpointer gold_img = g_object_get_data (G_OBJECT (wimage), - XG_TOOL_BAR_IMAGE_DATA); + XG_TOOL_BAR_IMAGE_DATA); Pixmap old_img = (Pixmap) gold_img; if (old_img != img->pixmap) return 1; } /* Check button configuration and label. */ - if ((horiz ? GTK_IS_VBOX (vb) : GTK_IS_HBOX (vb)) + if (is_box_type (vb, horiz) || (label ? (wlbl == NULL) : (wlbl != NULL))) return 1; @@ -4715,6 +4761,7 @@ xg_initialize (void) { GtkBindingSet *binding_set; + GtkSettings *settings; #if HAVE_XFT /* Work around a bug with corrupted data if libXft gets unloaded. This way @@ -4731,17 +4778,19 @@ id_to_widget.max_size = id_to_widget.used = 0; id_to_widget.widgets = 0; + settings = gtk_settings_get_for_screen (gdk_display_get_default_screen + (gdk_display_get_default ())); /* Remove F10 as a menu accelerator, it does not mix well with Emacs key bindings. It doesn't seem to be any way to remove properties, so we set it to VoidSymbol which in X means "no key". */ - gtk_settings_set_string_property (gtk_settings_get_default (), + gtk_settings_set_string_property (settings, "gtk-menu-bar-accel", "VoidSymbol", EMACS_CLASS); /* Make GTK text input widgets use Emacs style keybindings. This is Emacs after all. */ - gtk_settings_set_string_property (gtk_settings_get_default (), + gtk_settings_set_string_property (settings, "gtk-key-theme-name", "Emacs", EMACS_CLASS); ------------------------------------------------------------ revno: 108880 fixes bug(s): http://debbugs.gnu.org/11857 committer: Eli Zaretskii branch nick: trunk timestamp: Thu 2012-07-05 18:20:12 +0300 message: Revert hscroll and min_hscroll to ptrdiff_t. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-05 15:04:57 +0000 +++ src/ChangeLog 2012-07-05 15:20:12 +0000 @@ -5,9 +5,6 @@ coordinates when window's hscroll is set to insanely large values. (Bug#11857) - * window.h (struct window) : Change type to - 'int'. - 2012-07-05 Juanma Barranquero * makefile.w32-in ($(BLD)/dired.$(O), $(BLD)/fileio.$(O)): Fix typo. === modified file 'src/window.h' --- src/window.h 2012-07-05 15:04:57 +0000 +++ src/window.h 2012-07-05 15:20:12 +0000 @@ -238,11 +238,11 @@ int sequence_number; /* Number of columns display within the window is scrolled to the left. */ - int hscroll; + ptrdiff_t hscroll; /* Minimum hscroll for automatic hscrolling. This is the value the user has set, by set-window-hscroll for example. */ - int min_hscroll; + ptrdiff_t min_hscroll; /* Displayed buffer's text modification events counter as of last time display completed. */ === modified file 'src/xdisp.c' --- src/xdisp.c 2012-07-05 15:04:57 +0000 +++ src/xdisp.c 2012-07-05 15:20:12 +0000 @@ -1258,7 +1258,7 @@ static inline int window_hscroll_limited (struct window *w, struct frame *f) { - int window_hscroll = w->hscroll; + ptrdiff_t window_hscroll = w->hscroll; int window_text_width = window_box_width (w, TEXT_AREA); int colwidth = FRAME_COLUMN_WIDTH (f); ------------------------------------------------------------ revno: 108879 fixes bug(s): http://debbugs.gnu.org/11857 committer: Eli Zaretskii branch nick: trunk timestamp: Thu 2012-07-05 18:04:57 +0300 message: Fix bug #11857 with messed up display for insanely large hscroll values. src/xdisp.c (window_hscroll_limited): New function. (pos_visible_p, init_iterator): Use it to avoid overflow of pixel coordinates when window's hscroll is set to insanely large values. src/window.h (struct window) : Change type to 'int'. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-05 12:07:29 +0000 +++ src/ChangeLog 2012-07-05 15:04:57 +0000 @@ -1,3 +1,13 @@ +2012-07-05 Eli Zaretskii + + * xdisp.c (window_hscroll_limited): New function. + (pos_visible_p, init_iterator): Use it to avoid overflow of pixel + coordinates when window's hscroll is set to insanely large + values. (Bug#11857) + + * window.h (struct window) : Change type to + 'int'. + 2012-07-05 Juanma Barranquero * makefile.w32-in ($(BLD)/dired.$(O), $(BLD)/fileio.$(O)): Fix typo. === modified file 'src/window.h' --- src/window.h 2012-07-03 18:24:42 +0000 +++ src/window.h 2012-07-05 15:04:57 +0000 @@ -238,11 +238,11 @@ int sequence_number; /* Number of columns display within the window is scrolled to the left. */ - ptrdiff_t hscroll; + int hscroll; /* Minimum hscroll for automatic hscrolling. This is the value the user has set, by set-window-hscroll for example. */ - ptrdiff_t min_hscroll; + int min_hscroll; /* Displayed buffer's text modification events counter as of last time display completed. */ === modified file 'src/xdisp.c' --- src/xdisp.c 2012-07-05 06:32:41 +0000 +++ src/xdisp.c 2012-07-05 15:04:57 +0000 @@ -1251,6 +1251,23 @@ return spec; } + +/* Limit insanely large values of W->hscroll on frame F to the largest + value that will still prevent first_visible_x and last_visible_x of + 'struct it' from overflowing an int. */ +static inline int +window_hscroll_limited (struct window *w, struct frame *f) +{ + int window_hscroll = w->hscroll; + int window_text_width = window_box_width (w, TEXT_AREA); + int colwidth = FRAME_COLUMN_WIDTH (f); + + if (window_hscroll > (INT_MAX - window_text_width) / colwidth - 1) + window_hscroll = (INT_MAX - window_text_width) / colwidth - 1; + + return window_hscroll; +} + /* Return 1 if position CHARPOS is visible in window W. CHARPOS < 0 means return info about WINDOW_END position. If visible, set *X and *Y to pixel coordinates of top left corner. @@ -1563,7 +1580,9 @@ current_header_line_height = current_mode_line_height = -1; if (visible_p && w->hscroll > 0) - *x -= w->hscroll * WINDOW_FRAME_COLUMN_WIDTH (w); + *x -= + window_hscroll_limited (w, WINDOW_XFRAME (w)) + * WINDOW_FRAME_COLUMN_WIDTH (w); #if 0 /* Debugging code. */ @@ -2759,8 +2778,8 @@ } else { - it->first_visible_x - = it->w->hscroll * FRAME_COLUMN_WIDTH (it->f); + it->first_visible_x = + window_hscroll_limited (it->w, it->f) * FRAME_COLUMN_WIDTH (it->f); it->last_visible_x = (it->first_visible_x + window_box_width (w, TEXT_AREA)); ------------------------------------------------------------ revno: 108878 committer: Juanma Barranquero branch nick: trunk timestamp: Thu 2012-07-05 14:07:29 +0200 message: src/makefile.w32-in: Update dependencies. ($(BLD)/dired.$(O), $(BLD)/fileio.$(O)): Fix typo. ($(BLD)/terminal.$(O), $(BLD)/syntax.$(O)): Update dependencies. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-05 06:32:41 +0000 +++ src/ChangeLog 2012-07-05 12:07:29 +0000 @@ -1,3 +1,8 @@ +2012-07-05 Juanma Barranquero + + * makefile.w32-in ($(BLD)/dired.$(O), $(BLD)/fileio.$(O)): Fix typo. + ($(BLD)/terminal.$(O), $(BLD)/syntax.$(O)): Update dependencies. + 2012-07-05 Dmitry Antipov Cleanup xmalloc. === modified file 'src/makefile.w32-in' --- src/makefile.w32-in 2012-06-28 11:37:27 +0000 +++ src/makefile.w32-in 2012-07-05 12:07:29 +0000 @@ -707,7 +707,7 @@ $(FILEMODE_H) \ $(GRP_H) \ $(LISP_H) \ - $(STAT-TIME_H) \ + $(STAT_TIME_H) \ $(SYSTIME_H) $(BLD)/dispnew.$(O) : \ @@ -821,7 +821,7 @@ $(FRAME_H) \ $(INTERVALS_H) \ $(LISP_H) \ - $(STAT-TIME_H) \ + $(STAT_TIME_H) \ $(SYSTIME_H) \ $(WINDOW_H) @@ -1083,6 +1083,7 @@ $(INTERVALS_H) \ $(KEYBOARD_H) \ $(LISP_H) \ + $(STAT_TIME_H) \ $(TERMHOOKS_H) $(BLD)/macros.$(O) : \ @@ -1268,6 +1269,7 @@ $(SRC)/category.h \ $(SRC)/regex.h \ $(SRC)/syntax.h \ + $(NT_INC)/unistd.h \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CONFIG_H) \ ------------------------------------------------------------ revno: 108877 committer: Michael Albinus branch nick: trunk timestamp: Thu 2012-07-05 08:57:57 +0200 message: Sync with Tramp 2.2.6-pre. * net/tramp.el (tramp-drop-volume-letter): Provide an XEmacs compatible declaration. * net/tramp-cmds.el (tramp-append-tramp-buffers): Protect `list-load-path-shadows' call. * net/tramp-compat.el (top): Require packages, which aren't autoloaded anymore for XEmacs. Protect call of `tramp-file-name-handler' by `tramp-compat-funcall', pacifying the compiler. Do not require tramp-util.el and tramp-vc.el anymore, it hurts at least for SXEmacs. (tramp-compat-temporary-file-directory): In XEmacs, there is no standard-value for `temporary-file-directory'. * net/tramp-sh.el (tramp-do-directory-files-and-attributes-with-stat): Redirect stderr to /dev/null. (tramp-sh-handle-write-region): uid and gid can be floats. Reported by Russell Sim . (tramp-sh-handle-vc-registered): Hide errors. (tramp-vc-file-name-handler): Use dummy results for `process-file' and `start-file-process'. (tramp-maybe-open-connection): Check also whether `non-essential' is bound. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-07-04 16:32:54 +0000 +++ lisp/ChangeLog 2012-07-05 06:57:57 +0000 @@ -1,3 +1,31 @@ +2012-07-05 Michael Albinus + + Sync with Tramp 2.2.6-pre. + + * net/tramp.el (tramp-drop-volume-letter): Provide an XEmacs + compatible declaration. + + * net/tramp-cmds.el (tramp-append-tramp-buffers): Protect + `list-load-path-shadows' call. + + * net/tramp-compat.el (top): Require packages, which aren't + autoloaded anymore for XEmacs. Protect call of + `tramp-file-name-handler' by `tramp-compat-funcall', pacifying the + compiler. Do not require tramp-util.el and tramp-vc.el anymore, + it hurts at least for SXEmacs. + (tramp-compat-temporary-file-directory): In XEmacs, there is no + standard-value for `temporary-file-directory'. + + * net/tramp-sh.el (tramp-do-directory-files-and-attributes-with-stat): + Redirect stderr to /dev/null. + (tramp-sh-handle-write-region): uid and gid can be floats. + Reported by Russell Sim . + (tramp-sh-handle-vc-registered): Hide errors. + (tramp-vc-file-name-handler): Use dummy results for `process-file' + and `start-file-process'. + (tramp-maybe-open-connection): Check also whether `non-essential' + is bound. + 2012-07-04 Chong Yidong * xml.el (xml--parse-buffer): Use xml-syntax-table. === modified file 'lisp/net/tramp-cmds.el' --- lisp/net/tramp-cmds.el 2012-06-11 10:30:07 +0000 +++ lisp/net/tramp-cmds.el 2012-07-05 06:57:57 +0000 @@ -295,8 +295,9 @@ ;; Dump load-path shadows. (insert "\nload-path shadows:\n==================\n") (ignore-errors - (mapc (lambda (x) (when (string-match "tramp" x) (insert x "\n"))) - (split-string (list-load-path-shadows t) "\n"))) + (mapc + (lambda (x) (when (string-match "tramp" x) (insert x "\n"))) + (split-string (tramp-compat-funcall 'list-load-path-shadows t) "\n"))) ;; Append buffers only when we are in message mode. (when (and === modified file 'lisp/net/tramp-compat.el' --- lisp/net/tramp-compat.el 2012-06-11 10:30:07 +0000 +++ lisp/net/tramp-compat.el 2012-07-05 06:57:57 +0000 @@ -29,8 +29,6 @@ ;;; Code: -(require 'tramp-loaddefs) - (eval-when-compile ;; Pacify byte-compiler. @@ -38,11 +36,24 @@ (eval-and-compile + ;; Some packages must be required for XEmacs, because we compile + ;; with -no-autoloads. + (when (featurep 'xemacs) + (require 'cus-edit) + (require 'env) + (require 'executable) + (require 'outline) + (require 'passwd) + (require 'pp) + (require 'regexp-opt)) + (require 'advice) (require 'custom) (require 'format-spec) (require 'shell) + (require 'tramp-loaddefs) + ;; As long as password.el is not part of (X)Emacs, it shouldn't be ;; mandatory. (if (featurep 'xemacs) @@ -61,7 +72,8 @@ (require 'timer)) ;; We check whether `start-file-process' is bound. - (unless (fboundp 'start-file-process) + ;; Note: we deactivate this. There are problems, at least in SXEmacs. + (unless t;(fboundp 'start-file-process) ;; tramp-util offers integration into other (X)Emacs packages like ;; compile.el, gud.el etc. Not necessary in Emacs 23. @@ -127,7 +139,8 @@ (defalias 'file-remote-p (lambda (file &optional identification connected) (when (tramp-tramp-file-p file) - (tramp-file-name-handler + (tramp-compat-funcall + 'tramp-file-name-handler 'file-remote-p file identification connected))))) ;; `process-file' does not exist in XEmacs. @@ -153,8 +166,8 @@ (defalias 'set-file-times (lambda (filename &optional time) (when (tramp-tramp-file-p filename) - (tramp-file-name-handler - 'set-file-times filename time))))) + (tramp-compat-funcall + 'tramp-file-name-handler 'set-file-times filename time))))) ;; We currently use "[" and "]" in the filename format for IPv6 ;; hosts of GNU Emacs. This means that Emacs wants to expand @@ -221,11 +234,11 @@ For Emacs, this is the variable `temporary-file-directory', for XEmacs this is the function `temp-directory'." (let (file-name-handler-alist) + ;; We must return a local directory. If it is remote, we could + ;; run into an infloop. (cond - ;; We must return a local directory. If it is remote, we could - ;; run into an infloop. - ((boundp 'temporary-file-directory) - (eval (car (get 'temporary-file-directory 'standard-value)))) + ((and (boundp 'temporary-file-directory) + (eval (car (get 'temporary-file-directory 'standard-value))))) ((fboundp 'temp-directory) (tramp-compat-funcall 'temp-directory)) ((let ((d (getenv "TEMP"))) (and d (file-directory-p d))) (file-name-as-directory (getenv "TEMP"))) @@ -302,7 +315,8 @@ ((or (null id-format) (eq id-format 'integer)) (file-attributes filename)) ((tramp-tramp-file-p filename) - (tramp-file-name-handler 'file-attributes filename id-format)) + (tramp-compat-funcall + 'tramp-file-name-handler 'file-attributes filename id-format)) (t (condition-case nil (tramp-compat-funcall 'file-attributes filename id-format) (wrong-number-of-arguments (file-attributes filename)))))) === modified file 'lisp/net/tramp-sh.el' --- lisp/net/tramp-sh.el 2012-06-17 18:54:39 +0000 +++ lisp/net/tramp-sh.el 2012-07-05 06:57:57 +0000 @@ -1692,9 +1692,10 @@ ;; "-"; this would confuse xargs. "ls -aQ" might be a solution, ;; but it does not work on all remote systems. Therefore, we ;; quote the filenames via sed. - "cd %s; echo \"(\"; (%s -a | sed -e s/\\$/\\\"/g -e s/^/\\\"/g | xargs " - "%s -c '(\"%%n\" (\"%%N\") %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 \"%%A\" t %%ie0 -1)'); " - "echo \")\"") + "cd %s; echo \"(\"; (%s -a | sed -e s/\\$/\\\"/g -e s/^/\\\"/g | " + "xargs %s -c " + "'(\"%%n\" (\"%%N\") %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 \"%%A\" t %%ie0 -1)'" + " 2>/dev/null); echo \")\"") (tramp-shell-quote-argument localname) (tramp-get-ls-command vec) (tramp-get-remote-stat vec) @@ -3284,14 +3285,14 @@ (let (last-coding-system-used (need-chown t)) ;; Set file modification time. (when (or (eq visit t) (stringp visit)) - (let ((file-attr (file-attributes filename))) + (let ((file-attr (tramp-compat-file-attributes filename 'integer))) (set-visited-file-modtime ;; We must pass modtime explicitly, because filename can ;; be different from (buffer-file-name), f.e. if ;; `file-precious-flag' is set. (nth 5 file-attr)) - (when (and (eq (nth 2 file-attr) uid) - (eq (nth 3 file-attr) gid)) + (when (and (= (nth 2 file-attr) uid) + (= (nth 3 file-attr) gid)) (setq need-chown nil)))) ;; Set the ownership. @@ -3332,7 +3333,7 @@ `((,tramp-file-name-regexp . tramp-vc-file-name-handler)))) ;; Here we collect only file names, which need an operation. - (tramp-run-real-handler 'vc-registered (list file)) + (ignore-errors (tramp-run-real-handler 'vc-registered (list file))) (tramp-message v 10 "\n%s" tramp-vc-registered-file-names) ;; Send just one command, in order to fill the cache. @@ -3400,10 +3401,12 @@ ((and fn (memq operation '(file-exists-p file-readable-p))) (add-to-list 'tramp-vc-registered-file-names localname 'append) nil) + ;; `process-file' and `start-file-process' shall be ignored. + ((and fn (eq operation 'process-file) 0)) + ((and fn (eq operation 'start-file-process) nil)) ;; Tramp file name handlers like `expand-file-name'. They ;; must still work. - (fn - (save-match-data (apply (cdr fn) args))) + (fn (save-match-data (apply (cdr fn) args))) ;; Default file name handlers, we don't care. (t (tramp-run-real-handler operation args))))))) @@ -4294,7 +4297,7 @@ (tramp-get-buffer vec) ;; If `non-essential' is non-nil, don't reopen a new connection. - (when non-essential + (when (and (boundp 'non-essential) (symbol-value 'non-essential)) (throw 'non-essential 'non-essential)) (tramp-with-progress-reporter === modified file 'lisp/net/tramp.el' --- lisp/net/tramp.el 2012-06-17 18:54:39 +0000 +++ lisp/net/tramp.el 2012-07-05 06:57:57 +0000 @@ -1531,6 +1531,9 @@ 'identity)) +(if (featurep 'xemacs) + (defalias 'tramp-drop-volume-letter 'identity)) + (defun tramp-cleanup (vec) "Cleanup connection VEC, but keep the debug buffer." (with-current-buffer (tramp-get-debug-buffer vec) ------------------------------------------------------------ Use --include-merges or -n0 to see merged revisions.