Now on revision 108877. ------------------------------------------------------------ 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) ------------------------------------------------------------ revno: 108876 committer: Dmitry Antipov branch nick: trunk timestamp: Thu 2012-07-05 10:32:41 +0400 message: Cleanup xmalloc. * admin/coccinelle/xzalloc.cocci: Semantic patch to convert calls to xmalloc with following memset to xzalloc. * src/lisp.h (xzalloc): New prototype. Omit needless casts. * src/alloc.c (xzalloc): New function. Omit needless casts. * src/charset.c: Omit needless casts. Convert all calls to malloc with following memset to xzalloc. * src/dispnew.c: Likewise. * src/fringe.c: Likewise. * src/image.c: Likewise. * src/sound.c: Likewise. * src/term.c: Likewise. * src/w32fns.c: Likewise. * src/w32font.c: Likewise. * src/w32term.c: Likewise. * src/xfaces.c: Likewise. * src/xfns.c: Likewise. * src/xterm.c: Likewise. * src/atimer.c: Omit needless casts. * src/buffer.c: Likewise. * src/callproc.c: Likewise. * src/ccl.c: Likewise. * src/coding.c: Likewise. * src/composite.c: Likewise. * src/doc.c: Likewise. * src/doprnt.c: Likewise. * src/editfns.c: Likewise. * src/emacs.c: Likewise. * src/eval.c: Likewise. * src/filelock.c: Likewise. * src/fns.c: Likewise. * src/gtkutil.c: Likewise. * src/keyboard.c: Likewise. * src/lisp.h: Likewise. * src/lread.c: Likewise. * src/minibuf.c: Likewise. * src/msdos.c: Likewise. * src/print.c: Likewise. * src/process.c: Likewise. * src/region-cache.c: Likewise. * src/search.c: Likewise. * src/sysdep.c: Likewise. * src/termcap.c: Likewise. * src/terminal.c: Likewise. * src/tparam.c: Likewise. * src/w16select.c: Likewise. * src/w32.c: Likewise. * src/w32reg.c: Likewise. * src/w32select.c: Likewise. * src/w32uniscribe.c: Likewise. * src/widget.c: Likewise. * src/xdisp.c: Likewise. * src/xmenu.c: Likewise. * src/xrdb.c: Likewise. * src/xselect.c: Likewise. diff: === modified file 'admin/ChangeLog' --- admin/ChangeLog 2012-07-04 16:46:42 +0000 +++ admin/ChangeLog 2012-07-05 06:32:41 +0000 @@ -1,3 +1,8 @@ +2012-07-05 Dmitry Antipov + + * coccinelle/xzalloc.cocci: Semantic patch to convert + calls to xmalloc with following memset to xzalloc. + 2012-07-04 Juanma Barranquero * CPP-DEFINES (LISP_FLOAT_TYPE): Remove, obsolete. === added file 'admin/coccinelle/xzalloc.cocci' --- admin/coccinelle/xzalloc.cocci 1970-01-01 00:00:00 +0000 +++ admin/coccinelle/xzalloc.cocci 2012-07-05 06:32:41 +0000 @@ -0,0 +1,10 @@ +@@ +expression x; +expression E; +@@ + x = +- xmalloc ++ xzalloc + (E) + ... +- memset (x, 0, E); === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-05 04:16:11 +0000 +++ src/ChangeLog 2012-07-05 06:32:41 +0000 @@ -1,3 +1,59 @@ +2012-07-05 Dmitry Antipov + + Cleanup xmalloc. + * lisp.h (xzalloc): New prototype. Omit needless casts. + * alloc.c (xzalloc): New function. Omit needless casts. + * charset.c: Omit needless casts. Convert all calls to + xmalloc with following memset to xzalloc. + * dispnew.c: Likewise. + * fringe.c: Likewise. + * image.c: Likewise. + * sound.c: Likewise. + * term.c: Likewise. + * w32fns.c: Likewise. + * w32font.c: Likewise. + * w32term.c: Likewise. + * xfaces.c: Likewise. + * xfns.c: Likewise. + * xterm.c: Likewise. + * atimer.c: Omit needless casts. + * buffer.c: Likewise. + * callproc.c: Likewise. + * ccl.c: Likewise. + * coding.c: Likewise. + * composite.c: Likewise. + * doc.c: Likewise. + * doprnt.c: Likewise. + * editfns.c: Likewise. + * emacs.c: Likewise. + * eval.c: Likewise. + * filelock.c: Likewise. + * fns.c: Likewise. + * gtkutil.c: Likewise. + * keyboard.c: Likewise. + * lisp.h: Likewise. + * lread.c: Likewise. + * minibuf.c: Likewise. + * msdos.c: Likewise. + * print.c: Likewise. + * process.c: Likewise. + * region-cache.c: Likewise. + * search.c: Likewise. + * sysdep.c: Likewise. + * termcap.c: Likewise. + * terminal.c: Likewise. + * tparam.c: Likewise. + * w16select.c: Likewise. + * w32.c: Likewise. + * w32reg.c: Likewise. + * w32select.c: Likewise. + * w32uniscribe.c: Likewise. + * widget.c: Likewise. + * xdisp.c: Likewise. + * xmenu.c: Likewise. + * xrdb.c: Likewise. + * xselect.c: Likewise. + 2012-07-05 Paul Eggert * fileio.c (time_error_value): Check the right error number. === modified file 'src/alloc.c' --- src/alloc.c 2012-07-04 16:52:51 +0000 +++ src/alloc.c 2012-07-05 06:32:41 +0000 @@ -735,6 +735,22 @@ return val; } +/* Like the above, but zeroes out the memory just allocated. */ + +void * +xzalloc (size_t size) +{ + void *val; + + MALLOC_BLOCK_INPUT; + val = malloc (size); + MALLOC_UNBLOCK_INPUT; + + if (!val && size) + memory_full (size); + memset (val, 0, size); + return val; +} /* Like realloc but check for no memory and block interrupt input.. */ @@ -867,7 +883,7 @@ xstrdup (const char *s) { size_t len = strlen (s) + 1; - char *p = (char *) xmalloc (len); + char *p = xmalloc (len); memcpy (p, s, len); return p; } @@ -3881,7 +3897,7 @@ if (x == NULL) abort (); #else - x = (struct mem_node *) xmalloc (sizeof *x); + x = xmalloc (sizeof *x); #endif x->start = start; x->end = end; @@ -5047,7 +5063,7 @@ /* Don't allocate a large amount here, because it might get mmap'd and then its address might not be usable. */ - purebeg = (char *) xmalloc (10000); + purebeg = xmalloc (10000); pure_size = 10000; pure_bytes_used_before_overflow += pure_bytes_used - size; pure_bytes_used = 0; === modified file 'src/atimer.c' --- src/atimer.c 2012-06-22 21:17:42 +0000 +++ src/atimer.c 2012-07-05 06:32:41 +0000 @@ -107,7 +107,7 @@ free_atimers = t->next; } else - t = (struct atimer *) xmalloc (sizeof *t); + t = xmalloc (sizeof *t); /* Fill the atimer structure. */ memset (t, 0, sizeof *t); === modified file 'src/buffer.c' --- src/buffer.c 2012-07-04 15:49:46 +0000 +++ src/buffer.c 2012-07-05 06:32:41 +0000 @@ -3893,7 +3893,7 @@ len = 10; /* We can't use alloca here because overlays_at can call xrealloc. */ - overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object)); + overlay_vec = xmalloc (len * sizeof (Lisp_Object)); /* Put all the overlays we want in a vector in overlay_vec. Store the length in len. */ @@ -3924,7 +3924,7 @@ CHECK_NUMBER_COERCE_MARKER (end); len = 10; - overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object)); + overlay_vec = xmalloc (len * sizeof (Lisp_Object)); /* Put all the overlays we want in a vector in overlay_vec. Store the length in len. */ @@ -3952,7 +3952,7 @@ CHECK_NUMBER_COERCE_MARKER (pos); len = 10; - overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object)); + overlay_vec = xmalloc (len * sizeof (Lisp_Object)); /* Put all the overlays we want in a vector in overlay_vec. Store the length in len. @@ -3996,7 +3996,7 @@ return pos; len = 10; - overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object)); + overlay_vec = xmalloc (len * sizeof (Lisp_Object)); /* Put all the overlays we want in a vector in overlay_vec. Store the length in len. === modified file 'src/callproc.c' --- src/callproc.c 2012-07-03 18:24:42 +0000 +++ src/callproc.c 2012-07-05 06:32:41 +0000 @@ -1172,7 +1172,7 @@ /* MSDOS must have all environment variables malloc'ed, because low-level libc functions that launch subsidiary processes rely on that. */ - pwd_var = (char *) xmalloc (i + 6); + pwd_var = xmalloc (i + 6); #else pwd_var = (char *) alloca (i + 6); #endif === modified file 'src/ccl.c' --- src/ccl.c 2012-06-26 02:33:51 +0000 +++ src/ccl.c 2012-07-05 06:32:41 +0000 @@ -2098,7 +2098,7 @@ outbufsize = (ccl.buf_magnification ? str_bytes * ccl.buf_magnification + 256 : str_bytes + 256); - outp = outbuf = (unsigned char *) xmalloc (outbufsize); + outp = outbuf = xmalloc (outbufsize); consumed_chars = consumed_bytes = 0; produced_chars = 0; === modified file 'src/charset.c' --- src/charset.c 2012-06-30 09:13:54 +0000 +++ src/charset.c 2012-07-05 06:32:41 +0000 @@ -912,8 +912,7 @@ if (! charset.code_linear_p) { - charset.code_space_mask = (unsigned char *) xmalloc (256); - memset (charset.code_space_mask, 0, 256); + charset.code_space_mask = xzalloc (256); for (i = 0; i < 4; i++) for (j = charset.code_space[i * 4]; j <= charset.code_space[i * 4 + 1]; j++) === modified file 'src/coding.c' --- src/coding.c 2012-06-19 16:56:28 +0000 +++ src/coding.c 2012-07-05 06:32:41 +0000 @@ -8006,7 +8006,7 @@ { ptrdiff_t dst_bytes = max (1, coding->src_chars); coding->dst_object = Qnil; - coding->destination = (unsigned char *) xmalloc (dst_bytes); + coding->destination = xmalloc (dst_bytes); coding->dst_bytes = dst_bytes; coding->dst_multibyte = 0; } === modified file 'src/composite.c' --- src/composite.c 2012-07-03 18:24:42 +0000 +++ src/composite.c 2012-07-05 06:32:41 +0000 @@ -326,7 +326,7 @@ memory_full (SIZE_MAX); /* Register the composition in composition_table. */ - cmp = (struct composition *) xmalloc (sizeof (struct composition)); + cmp = xmalloc (sizeof (struct composition)); cmp->method = method; cmp->hash_index = hash_index; === modified file 'src/dispnew.c' --- src/dispnew.c 2012-06-28 07:50:50 +0000 +++ src/dispnew.c 2012-07-05 06:32:41 +0000 @@ -344,11 +344,7 @@ static struct glyph_matrix * new_glyph_matrix (struct glyph_pool *pool) { - struct glyph_matrix *result; - - /* Allocate and clear. */ - result = (struct glyph_matrix *) xmalloc (sizeof *result); - memset (result, 0, sizeof *result); + struct glyph_matrix *result = xzalloc (sizeof *result); /* Increment number of allocated matrices. This count is used to detect memory leaks. */ @@ -1367,11 +1363,7 @@ static struct glyph_pool * new_glyph_pool (void) { - struct glyph_pool *result; - - /* Allocate a new glyph_pool and clear it. */ - result = (struct glyph_pool *) xmalloc (sizeof *result); - memset (result, 0, sizeof *result); + struct glyph_pool *result = xzalloc (sizeof *result); /* For memory leak and double deletion checking. */ ++glyph_pool_count; @@ -2033,19 +2025,16 @@ int i; struct glyph_matrix *saved; - saved = (struct glyph_matrix *) xmalloc (sizeof *saved); - memset (saved, 0, sizeof *saved); + saved = xzalloc (sizeof *saved); saved->nrows = f->current_matrix->nrows; - saved->rows = (struct glyph_row *) xmalloc (saved->nrows - * sizeof *saved->rows); - memset (saved->rows, 0, saved->nrows * sizeof *saved->rows); + saved->rows = xzalloc (saved->nrows * sizeof *saved->rows); for (i = 0; i < saved->nrows; ++i) { struct glyph_row *from = f->current_matrix->rows + i; struct glyph_row *to = saved->rows + i; ptrdiff_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph); - to->glyphs[TEXT_AREA] = (struct glyph *) xmalloc (nbytes); + to->glyphs[TEXT_AREA] = xmalloc (nbytes); memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes); to->used[TEXT_AREA] = from->used[TEXT_AREA]; } @@ -2263,7 +2252,7 @@ FRAME_MESSAGE_BUF (f) = new_buffer; } else - FRAME_MESSAGE_BUF (f) = (char *) xmalloc (size); + FRAME_MESSAGE_BUF (f) = xmalloc (size); } === modified file 'src/doc.c' --- src/doc.c 2012-07-03 18:24:42 +0000 +++ src/doc.c 2012-07-05 06:32:41 +0000 @@ -757,7 +757,7 @@ keymap = Voverriding_local_map; bsize = SBYTES (string); - bufp = buf = (char *) xmalloc (bsize); + bufp = buf = xmalloc (bsize); strp = SDATA (string); while (strp < SDATA (string) + SBYTES (string)) === modified file 'src/doprnt.c' --- src/doprnt.c 2012-07-04 08:26:20 +0000 +++ src/doprnt.c 2012-07-05 06:32:41 +0000 @@ -257,7 +257,7 @@ { if (big_buffer) xfree (big_buffer); - big_buffer = (char *) xmalloc (size_bound); + big_buffer = xmalloc (size_bound); sprintf_buffer = big_buffer; size_allocated = size_bound; } === modified file 'src/editfns.c' --- src/editfns.c 2012-07-03 18:24:42 +0000 +++ src/editfns.c 2012-07-05 06:32:41 +0000 @@ -2157,8 +2157,8 @@ for (from = environ; *from; from++) continue; envptrs = from - environ + 2; - newenv = to = (char **) xmalloc (envptrs * sizeof (char *) - + (tzstring ? strlen (tzstring) + 4 : 0)); + newenv = to = xmalloc (envptrs * sizeof (char *) + + (tzstring ? strlen (tzstring) + 4 : 0)); /* Add TZSTRING to the end of environ, as a value for TZ. */ if (tzstring) @@ -3477,7 +3477,7 @@ /* Copy the data so that it won't move when we GC. */ if (! message_text) { - message_text = (char *)xmalloc (80); + message_text = xmalloc (80); message_length = 80; } if (SBYTES (val) > message_length) === modified file 'src/emacs.c' --- src/emacs.c 2012-07-04 17:04:09 +0000 +++ src/emacs.c 2012-07-05 06:32:41 +0000 @@ -1820,7 +1820,7 @@ static void sort_args (int argc, char **argv) { - char **new = (char **) xmalloc (sizeof (char *) * argc); + char **new = xmalloc (sizeof (char *) * argc); /* 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-03 18:24:42 +0000 +++ src/eval.c 2012-07-05 06:32:41 +0000 @@ -138,7 +138,7 @@ init_eval_once (void) { enum { size = 50 }; - specpdl = (struct specbinding *) xmalloc (size * sizeof (struct specbinding)); + specpdl = xmalloc (size * sizeof (struct specbinding)); specpdl_size = size; specpdl_ptr = specpdl; /* Don't forget to update docs (lispref node "Local Variables"). */ === modified file 'src/filelock.c' --- src/filelock.c 2012-06-16 12:24:15 +0000 +++ src/filelock.c 2012-07-05 06:32:41 +0000 @@ -422,7 +422,7 @@ return -1; } len = at - lfinfo; - owner->user = (char *) xmalloc (len + 1); + owner->user = xmalloc (len + 1); memcpy (owner->user, lfinfo, len); owner->user[len] = 0; @@ -449,7 +449,7 @@ /* The host is everything in between. */ len = dot - at - 1; - owner->host = (char *) xmalloc (len + 1); + owner->host = xmalloc (len + 1); memcpy (owner->host, at + 1, len); owner->host[len] = 0; === modified file 'src/fns.c' --- src/fns.c 2012-07-04 14:38:02 +0000 +++ src/fns.c 2012-07-05 06:32:41 +0000 @@ -1018,7 +1018,7 @@ if (STRING_MULTIBYTE (string)) { ptrdiff_t bytes = SBYTES (string); - unsigned char *str = (unsigned char *) xmalloc (bytes); + unsigned char *str = xmalloc (bytes); memcpy (str, SDATA (string), bytes); bytes = str_as_unibyte (str, bytes); @@ -1100,7 +1100,7 @@ if (STRING_MULTIBYTE (string)) { ptrdiff_t chars = SCHARS (string); - unsigned char *str = (unsigned char *) xmalloc (chars); + unsigned char *str = xmalloc (chars); ptrdiff_t converted = str_to_unibyte (SDATA (string), str, chars, 0); if (converted < chars) === modified file 'src/fringe.c' --- src/fringe.c 2012-06-28 07:50:27 +0000 +++ src/fringe.c 2012-07-05 06:32:41 +0000 @@ -1639,8 +1639,7 @@ fb.dynamic = 1; - xfb = (struct fringe_bitmap *) xmalloc (sizeof fb - + fb.height * BYTES_PER_BITMAP_ROW); + xfb = xmalloc (sizeof fb + fb.height * BYTES_PER_BITMAP_ROW); fb.bits = b = (unsigned short *) (xfb + 1); memset (b, 0, fb.height); @@ -1805,15 +1804,11 @@ max_fringe_bitmaps = MAX_STANDARD_FRINGE_BITMAPS + 20; fringe_bitmaps - = (struct fringe_bitmap **) xmalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *)); - fringe_faces - = (Lisp_Object *) xmalloc (max_fringe_bitmaps * sizeof (Lisp_Object)); + = xzalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *)); + fringe_faces = xmalloc (max_fringe_bitmaps * sizeof (Lisp_Object)); for (i = 0; i < max_fringe_bitmaps; i++) - { - fringe_bitmaps[i] = NULL; - fringe_faces[i] = Qnil; - } + fringe_faces[i] = Qnil; } #ifdef HAVE_NTGUI === modified file 'src/gtkutil.c' --- src/gtkutil.c 2012-06-28 07:50:27 +0000 +++ src/gtkutil.c 2012-07-05 06:32:41 +0000 @@ -209,7 +209,7 @@ } else { - wv = (widget_value *) xmalloc (sizeof (widget_value)); + wv = xmalloc (sizeof (widget_value)); malloc_cpt++; } memset (wv, 0, sizeof (widget_value)); @@ -2042,7 +2042,7 @@ { if (! cl_data) { - cl_data = (xg_menu_cb_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; === modified file 'src/image.c' --- src/image.c 2012-07-03 18:24:42 +0000 +++ src/image.c 2012-07-05 06:32:41 +0000 @@ -319,7 +319,7 @@ id = x_allocate_bitmap_record (f); dpyinfo->bitmaps[id - 1].img = bitmap; dpyinfo->bitmaps[id - 1].refcount = 1; - dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (SBYTES (file) + 1); + dpyinfo->bitmaps[id - 1].file = xmalloc (SBYTES (file) + 1); dpyinfo->bitmaps[id - 1].depth = 1; dpyinfo->bitmaps[id - 1].height = ns_image_width (bitmap); dpyinfo->bitmaps[id - 1].width = ns_image_height (bitmap); @@ -365,7 +365,7 @@ dpyinfo->bitmaps[id - 1].pixmap = bitmap; dpyinfo->bitmaps[id - 1].have_mask = 0; dpyinfo->bitmaps[id - 1].refcount = 1; - dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (SBYTES (file) + 1); + dpyinfo->bitmaps[id - 1].file = xmalloc (SBYTES (file) + 1); dpyinfo->bitmaps[id - 1].depth = 1; dpyinfo->bitmaps[id - 1].height = height; dpyinfo->bitmaps[id - 1].width = width; @@ -599,7 +599,7 @@ { /* Make a copy of TYPE to avoid a bus error in a dumped Emacs. The initialized data segment is read-only. */ - struct image_type *p = (struct image_type *) xmalloc (sizeof *p); + struct image_type *p = xmalloc (sizeof *p); memcpy (p, type, sizeof *p); p->next = image_types; image_types = p; @@ -982,11 +982,10 @@ static struct image * make_image (Lisp_Object spec, EMACS_UINT hash) { - struct image *img = (struct image *) xmalloc (sizeof *img); + struct image *img = xzalloc (sizeof *img); Lisp_Object file = image_spec_value (spec, QCfile, NULL); eassert (valid_image_p (spec)); - memset (img, 0, sizeof *img); img->dependencies = NILP (file) ? Qnil : list1 (file); img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL)); eassert (img->type != NULL); @@ -1385,16 +1384,14 @@ struct image_cache * make_image_cache (void) { - struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c); + struct image_cache *c = xzalloc (sizeof *c); int size; - memset (c, 0, sizeof *c); size = 50; - c->images = (struct image **) xmalloc (size * sizeof *c->images); + c->images = xmalloc (size * sizeof *c->images); c->size = size; size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; - c->buckets = (struct image **) xmalloc (size); - memset (c->buckets, 0, size); + c->buckets = xzalloc (size); return c; } @@ -1969,7 +1966,7 @@ } /* Allocate image raster. */ - (*ximg)->data = (char *) xmalloc ((*ximg)->bytes_per_line * height); + (*ximg)->data = xmalloc ((*ximg)->bytes_per_line * height); /* Allocate a pixmap of the same size. */ *pixmap = XCreatePixmap (display, window, width, height, depth); @@ -2183,7 +2180,7 @@ if (stat (file, &st) == 0 && (fp = fopen (file, "rb")) != NULL && 0 <= st.st_size && st.st_size <= min (PTRDIFF_MAX, SIZE_MAX) - && (buf = (unsigned char *) xmalloc (st.st_size), + && (buf = xmalloc (st.st_size), fread (buf, 1, st.st_size, fp) == st.st_size)) { *size = st.st_size; @@ -2705,7 +2702,7 @@ } bytes_per_line = (*width + 7) / 8 + padding_p; nbytes = bytes_per_line * *height; - p = *data = (char *) xmalloc (nbytes); + p = *data = xmalloc (nbytes); if (v10) { @@ -3118,8 +3115,7 @@ xpm_init_color_cache (struct frame *f, XpmAttributes *attrs) { size_t nbytes = XPM_COLOR_CACHE_BUCKETS * sizeof *xpm_color_cache; - xpm_color_cache = (struct xpm_cached_color **) xmalloc (nbytes); - memset (xpm_color_cache, 0, nbytes); + xpm_color_cache = xzalloc (nbytes); init_color_table (); if (attrs->valuemask & XpmColorSymbols) @@ -3183,7 +3179,7 @@ bucket = xpm_color_bucket (color_name); nbytes = offsetof (struct xpm_cached_color, name) + strlen (color_name) + 1; - p = (struct xpm_cached_color *) xmalloc (nbytes); + p = xmalloc (nbytes); strcpy (p->name, color_name); p->color = *color; p->next = xpm_color_cache[bucket]; @@ -4154,8 +4150,7 @@ init_color_table (void) { int size = CT_SIZE * sizeof (*ct_table); - ct_table = (struct ct_color **) xmalloc (size); - memset (ct_table, 0, size); + ct_table = xzalloc (size); ct_colors_allocated = 0; } @@ -4250,7 +4245,7 @@ if (rc) { ++ct_colors_allocated; - p = (struct ct_color *) xmalloc (sizeof *p); + p = xmalloc (sizeof *p); p->r = r; p->g = g; p->b = b; @@ -4268,7 +4263,7 @@ color = RGB_TO_ULONG (r, g, b); #endif /* HAVE_NTGUI */ ++ct_colors_allocated; - p = (struct ct_color *) xmalloc (sizeof *p); + p = xmalloc (sizeof *p); p->r = r; p->g = g; p->b = b; @@ -4323,7 +4318,7 @@ { ++ct_colors_allocated; - p = (struct ct_color *) xmalloc (sizeof *p); + p = xmalloc (sizeof *p); p->r = color.red; p->g = color.green; p->b = color.blue; @@ -4355,8 +4350,7 @@ } else { - colors = (unsigned long *) xmalloc (ct_colors_allocated - * sizeof *colors); + colors = xmalloc (ct_colors_allocated * sizeof *colors); *n = ct_colors_allocated; for (i = j = 0; i < CT_SIZE; ++i) @@ -4445,7 +4439,7 @@ if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *colors / img->width < img->height) memory_full (SIZE_MAX); - colors = (XColor *) xmalloc (sizeof *colors * img->width * img->height); + colors = xmalloc (sizeof *colors * img->width * img->height); #ifndef HAVE_NTGUI /* Get the X image IMG->pixmap. */ @@ -4599,7 +4593,7 @@ if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *new / img->width < img->height) memory_full (SIZE_MAX); - new = (XColor *) xmalloc (sizeof *new * img->width * img->height); + new = xmalloc (sizeof *new * img->width * img->height); for (y = 0; y < img->height; ++y) { @@ -4852,8 +4846,7 @@ #else /* Create the bit array serving as mask. */ row_width = (img->width + 7) / 8; - mask_img = xmalloc (row_width * img->height); - memset (mask_img, 0, row_width * img->height); + mask_img = xzalloc (row_width * img->height); /* Create a memory device context for IMG->pixmap. */ frame_dc = get_frame_dc (f); @@ -5069,7 +5062,7 @@ if (stat (SDATA (file), &st) == 0 && (fp = fopen (SDATA (file), "rb")) != NULL && 0 <= st.st_size && st.st_size <= min (PTRDIFF_MAX, SIZE_MAX) - && (buf = (char *) xmalloc (st.st_size), + && (buf = xmalloc (st.st_size), fread (buf, 1, st.st_size, fp) == st.st_size)) { *size = st.st_size; @@ -5840,8 +5833,8 @@ if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *rows < height || min (PTRDIFF_MAX, SIZE_MAX) / sizeof *pixels / height < row_bytes) memory_full (SIZE_MAX); - pixels = (png_byte *) xmalloc (sizeof *pixels * row_bytes * height); - rows = (png_byte **) xmalloc (height * sizeof *rows); + pixels = xmalloc (sizeof *pixels * row_bytes * height); + rows = xmalloc (height * sizeof *rows); for (i = 0; i < height; ++i) rows[i] = pixels + i * row_bytes; @@ -6890,7 +6883,7 @@ return 0; } - buf = (uint32 *) xmalloc (sizeof *buf * width * height); + buf = xmalloc (sizeof *buf * width * height); rc = fn_TIFFReadRGBAImage (tiff, width, height, buf, 0); === modified file 'src/keyboard.c' --- src/keyboard.c 2012-07-03 18:24:42 +0000 +++ src/keyboard.c 2012-07-05 06:32:41 +0000 @@ -884,8 +884,7 @@ void push_kboard (struct kboard *k) { - struct kboard_stack *p - = (struct kboard_stack *) xmalloc (sizeof (struct kboard_stack)); + struct kboard_stack *p = xmalloc (sizeof (struct kboard_stack)); p->next = kboard_stack; p->kboard = current_kboard; @@ -8323,7 +8322,7 @@ const char *capt = STRINGP (tcapt) ? SSDATA (tcapt) : ""; ptrdiff_t max_lbl = 2 * max (0, min (tool_bar_max_label_size, STRING_BYTES_BOUND / 2)); - char *buf = (char *) xmalloc (max_lbl + 1); + char *buf = xmalloc (max_lbl + 1); Lisp_Object new_lbl; ptrdiff_t caption_len = strlen (capt); @@ -12188,7 +12187,7 @@ Vdebug_on_event = intern_c_string ("sigusr2"); /* Create the initial keyboard. */ - initial_kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); + initial_kboard = xmalloc (sizeof (KBOARD)); init_kboard (initial_kboard); /* Vwindow_system is left at t for now. */ initial_kboard->next_kboard = all_kboards; === modified file 'src/lisp.h' --- src/lisp.h 2012-07-04 14:38:02 +0000 +++ src/lisp.h 2012-07-05 06:32:41 +0000 @@ -3237,6 +3237,7 @@ extern int immediate_quit; /* Nonzero means ^G can quit instantly */ extern void *xmalloc (size_t); +extern void *xzalloc (size_t); extern void *xrealloc (void *, size_t); extern void xfree (void *); extern void *xnmalloc (ptrdiff_t, ptrdiff_t); @@ -3352,7 +3353,7 @@ buf = (type) alloca (size); \ else \ { \ - buf = (type) xmalloc (size); \ + buf = xmalloc (size); \ sa_must_free = 1; \ record_unwind_protect (safe_alloca_unwind, \ make_save_value (buf, 0)); \ @@ -3396,7 +3397,7 @@ else if ((nelt) < min (PTRDIFF_MAX, SIZE_MAX) / sizeof (Lisp_Object)) \ { \ Lisp_Object arg_; \ - buf = (Lisp_Object *) xmalloc ((nelt) * sizeof (Lisp_Object)); \ + buf = xmalloc ((nelt) * sizeof (Lisp_Object)); \ arg_ = make_save_value (buf, nelt); \ XSAVE_VALUE (arg_)->dogc = 1; \ sa_must_free = 1; \ === modified file 'src/lread.c' --- src/lread.c 2012-07-04 00:04:46 +0000 +++ src/lread.c 2012-07-05 06:32:41 +0000 @@ -2625,7 +2625,7 @@ if (saved_doc_string_size == 0) { - saved_doc_string = (char *) xmalloc (nskip + extra); + saved_doc_string = xmalloc (nskip + extra); saved_doc_string_size = nskip + extra; } if (nskip > saved_doc_string_size) @@ -3966,7 +3966,7 @@ DEFSYM (Qvariable_documentation, "variable-documentation"); - read_buffer = (char *) xmalloc (size); + read_buffer = xmalloc (size); read_buffer_size = size; } === modified file 'src/minibuf.c' --- src/minibuf.c 2012-06-28 12:29:37 +0000 +++ src/minibuf.c 2012-07-05 06:32:41 +0000 @@ -248,7 +248,7 @@ val = Qnil; size = 100; len = 0; - line = (char *) xmalloc (size); + line = xmalloc (size); while ((c = getchar ()) != '\n') { === modified file 'src/msdos.c' --- src/msdos.c 2012-07-02 08:00:05 +0000 +++ src/msdos.c 2012-07-05 06:32:41 +0000 @@ -2828,7 +2828,7 @@ { XMenu *menu; - menu = (XMenu *) xmalloc (sizeof (XMenu)); + menu = xmalloc (sizeof (XMenu)); menu->allocated = menu->count = menu->panecount = menu->width = 0; return menu; } @@ -2842,10 +2842,10 @@ if (menu->allocated == 0) { int count = menu->allocated = 10; - menu->text = (char **) xmalloc (count * sizeof (char *)); - menu->submenu = (XMenu **) xmalloc (count * sizeof (XMenu *)); - menu->panenumber = (int *) xmalloc (count * sizeof (int)); - menu->help_text = (const char **) xmalloc (count * sizeof (char *)); + menu->text = xmalloc (count * sizeof (char *)); + menu->submenu = xmalloc (count * sizeof (XMenu *)); + menu->panenumber = xmalloc (count * sizeof (int)); + menu->help_text = xmalloc (count * sizeof (char *)); } else if (menu->allocated == menu->count) { @@ -2926,7 +2926,7 @@ width = menu->width; /* We multiply width by 2 to account for possible control characters. FIXME: cater to non-ASCII characters in menus. */ - text = (struct glyph *) xmalloc ((width * 2 + 2) * sizeof (struct glyph)); + text = xmalloc ((width * 2 + 2) * sizeof (struct glyph)); ScreenGetCursor (&row, &col); mouse_get_xy (&mx, &my); IT_update_begin (sf); === modified file 'src/print.c' --- src/print.c 2012-06-28 11:11:48 +0000 +++ src/print.c 2012-07-05 06:32:41 +0000 @@ -157,7 +157,7 @@ else \ { \ int new_size = 1000; \ - print_buffer = (char *) xmalloc (new_size); \ + print_buffer = xmalloc (new_size); \ print_buffer_size = new_size; \ free_print_buffer = 1; \ } \ === modified file 'src/process.c' --- src/process.c 2012-07-03 18:24:42 +0000 +++ src/process.c 2012-07-05 06:32:41 +0000 @@ -3316,7 +3316,7 @@ { if (datagram_address[s].sa) abort (); - datagram_address[s].sa = (struct sockaddr *) xmalloc (lres->ai_addrlen); + datagram_address[s].sa = xmalloc (lres->ai_addrlen); datagram_address[s].len = lres->ai_addrlen; if (is_server) { @@ -6286,7 +6286,7 @@ if (!proc_encode_coding_system[new_outfd]) proc_encode_coding_system[new_outfd] - = (struct coding_system *) xmalloc (sizeof (struct coding_system)); + = xmalloc (sizeof (struct coding_system)); memcpy (proc_encode_coding_system[new_outfd], proc_encode_coding_system[old_outfd], sizeof (struct coding_system)); @@ -7084,7 +7084,7 @@ if (!proc_decode_coding_system[inch]) proc_decode_coding_system[inch] - = (struct coding_system *) xmalloc (sizeof (struct coding_system)); + = xmalloc (sizeof (struct coding_system)); coding_system = p->decode_coding_system; if (! NILP (p->filter)) ; @@ -7097,7 +7097,7 @@ if (!proc_encode_coding_system[outch]) proc_encode_coding_system[outch] - = (struct coding_system *) xmalloc (sizeof (struct coding_system)); + = xmalloc (sizeof (struct coding_system)); setup_coding_system (p->encode_coding_system, proc_encode_coding_system[outch]); #endif === modified file 'src/region-cache.c' --- src/region-cache.c 2012-06-16 12:24:15 +0000 +++ src/region-cache.c 2012-07-05 06:32:41 +0000 @@ -132,15 +132,13 @@ struct region_cache * new_region_cache (void) { - struct region_cache *c - = (struct region_cache *) xmalloc (sizeof (struct region_cache)); + struct region_cache *c = xmalloc (sizeof (struct region_cache)); c->gap_start = 0; c->gap_len = NEW_CACHE_GAP; c->cache_len = 0; - c->boundaries = - (struct boundary *) xmalloc ((c->gap_len + c->cache_len) - * sizeof (*c->boundaries)); + c->boundaries = xmalloc ((c->gap_len + c->cache_len) + * sizeof (*c->boundaries)); c->beg_unchanged = 0; c->end_unchanged = 0; === modified file 'src/search.c' --- src/search.c 2012-07-04 08:07:26 +0000 +++ src/search.c 2012-07-05 06:32:41 +0000 @@ -2064,8 +2064,8 @@ the match position. */ if (search_regs.num_regs == 0) { - search_regs.start = (regoff_t *) xmalloc (2 * sizeof (regoff_t)); - search_regs.end = (regoff_t *) xmalloc (2 * sizeof (regoff_t)); + search_regs.start = xmalloc (2 * sizeof (regoff_t)); + search_regs.end = xmalloc (2 * sizeof (regoff_t)); search_regs.num_regs = 2; } @@ -2500,7 +2500,7 @@ substed_alloc_size = ((STRING_BYTES_BOUND - 100) / 2 < length ? STRING_BYTES_BOUND : length * 2 + 100); - substed = (unsigned char *) xmalloc (substed_alloc_size); + substed = xmalloc (substed_alloc_size); substed_len = 0; /* Go thru NEWTEXT, producing the actual text to insert in @@ -3040,7 +3040,7 @@ for (i = 0; i < REGEXP_CACHE_SIZE; ++i) { searchbufs[i].buf.allocated = 100; - searchbufs[i].buf.buffer = (unsigned char *) xmalloc (100); + searchbufs[i].buf.buffer = xmalloc (100); searchbufs[i].buf.fastmap = searchbufs[i].fastmap; searchbufs[i].regexp = Qnil; searchbufs[i].whitespace_regexp = Qnil; === modified file 'src/sound.c' --- src/sound.c 2012-06-28 07:50:27 +0000 +++ src/sound.c 2012-07-05 06:32:41 +0000 @@ -1364,10 +1364,8 @@ #ifndef WINDOWSNT file = Qnil; GCPRO2 (sound, file); - current_sound_device = (struct sound_device *) xmalloc (sizeof (struct sound_device)); - memset (current_sound_device, 0, sizeof (struct sound_device)); - current_sound = (struct sound *) xmalloc (sizeof (struct sound)); - memset (current_sound, 0, sizeof (struct sound)); + current_sound_device = xzalloc (sizeof (struct sound_device)); + current_sound = xzalloc (sizeof (struct sound)); record_unwind_protect (sound_cleanup, Qnil); current_sound->header = (char *) alloca (MAX_SOUND_HEADER_BYTES); === modified file 'src/sysdep.c' --- src/sysdep.c 2012-06-30 15:32:51 +0000 +++ src/sysdep.c 2012-07-05 06:32:41 +0000 @@ -851,7 +851,7 @@ return; /* The tty is suspended. */ if (! tty_out->old_tty) - tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); + tty_out->old_tty = xmalloc (sizeof (struct emacs_tty)); emacs_get_tty (fileno (tty_out->input), tty_out->old_tty); === modified file 'src/term.c' --- src/term.c 2012-06-28 07:50:27 +0000 +++ src/term.c 2012-07-05 06:32:41 +0000 @@ -2863,8 +2863,7 @@ if (! FRAME_TERMCAP_P (f)) abort (); - t = xmalloc (sizeof (struct tty_output)); - memset (t, 0, sizeof (struct tty_output)); + t = xzalloc (sizeof (struct tty_output)); t->display_info = FRAME_TERMINAL (f)->display_info.tty; @@ -3065,9 +3064,8 @@ been_here = 1; tty = &the_only_display_info; #else - tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info)); + tty = xzalloc (sizeof (struct tty_display_info)); #endif - memset (tty, 0, sizeof (struct tty_display_info)); tty->next = tty_list; tty_list = tty; @@ -3075,7 +3073,7 @@ terminal->display_info.tty = tty; tty->terminal = terminal; - tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); + tty->Wcm = xmalloc (sizeof (struct cm)); Wcm_clear (tty); encode_terminal_src_size = 0; @@ -3136,7 +3134,7 @@ Wcm_clear (tty); - tty->termcap_term_buffer = (char *) xmalloc (buffer_size); + tty->termcap_term_buffer = xmalloc (buffer_size); /* On some systems, tgetent tries to access the controlling terminal. */ @@ -3177,7 +3175,7 @@ abort (); buffer_size = strlen (tty->termcap_term_buffer); #endif - tty->termcap_strings_buffer = area = (char *) xmalloc (buffer_size); + tty->termcap_strings_buffer = area = xmalloc (buffer_size); tty->TS_ins_line = tgetstr ("al", address); tty->TS_ins_multi_lines = tgetstr ("AL", address); tty->TS_bell = tgetstr ("bl", address); @@ -3345,7 +3343,7 @@ tty->mouse_highlight.mouse_face_window = Qnil; #endif - terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); + terminal->kboard = xmalloc (sizeof (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-05-21 15:36:54 +0000 +++ src/termcap.c 2012-07-05 06:32:41 +0000 @@ -153,7 +153,7 @@ p = ptr; while ((c = *p++) && c != ':' && c != '\n') ; - ret = (char *) xmalloc (p - ptr + 1); + ret = xmalloc (p - ptr + 1); } else ret = *area; @@ -377,7 +377,7 @@ if (!bp) { malloc_size = 1 + strlen (term); - bp = (char *) xmalloc (malloc_size); + bp = xmalloc (malloc_size); } strcpy (bp, term); goto ret; @@ -440,13 +440,13 @@ buf.size = BUFSIZE; /* Add 1 to size to ensure room for terminating null. */ - buf.beg = (char *) xmalloc (buf.size + 1); + buf.beg = xmalloc (buf.size + 1); term = indirect ? indirect : (char *)name; if (!bp) { malloc_size = indirect ? strlen (tcenv) + 1 : buf.size; - bp = (char *) xmalloc (malloc_size); + bp = xmalloc (malloc_size); } tc_search_point = bp1 = bp; === modified file 'src/terminal.c' --- src/terminal.c 2012-06-26 14:41:01 +0000 +++ src/terminal.c 2012-07-05 06:32:41 +0000 @@ -230,10 +230,8 @@ terminal->id = next_terminal_id++; - terminal->keyboard_coding = - (struct coding_system *) xmalloc (sizeof (struct coding_system)); - terminal->terminal_coding = - (struct coding_system *) xmalloc (sizeof (struct coding_system)); + terminal->keyboard_coding = xmalloc (sizeof (struct coding_system)); + terminal->terminal_coding = xmalloc (sizeof (struct coding_system)); /* If default coding systems for the terminal and the keyboard are already defined, use them in preference to the defaults. This is === modified file 'src/tparam.c' --- src/tparam.c 2012-05-21 15:36:54 +0000 +++ src/tparam.c 2012-07-05 06:32:41 +0000 @@ -98,7 +98,7 @@ if (outlen == 0) { outlen = len + 40; - new = (char *) xmalloc (outlen); + new = xmalloc (outlen); memcpy (new, outstring, offset); } else === modified file 'src/w16select.c' --- src/w16select.c 2012-06-16 12:24:15 +0000 +++ src/w16select.c 2012-07-05 06:32:41 +0000 @@ -493,7 +493,7 @@ setup_coding_system (Fcheck_coding_system (coding_system), &coding); coding.dst_bytes = nbytes * 4; - coding.destination = (unsigned char *) xmalloc (coding.dst_bytes); + coding.destination = xmalloc (coding.dst_bytes); Vnext_selection_coding_system = Qnil; coding.mode |= CODING_MODE_LAST_BLOCK; dst = coding.destination; @@ -572,7 +572,7 @@ goto unblock; if ((data_size = get_clipboard_data_size (CF_OEMTEXT)) == 0 || - (htext = (unsigned char *)xmalloc (data_size)) == 0) + (htext = xmalloc (data_size)) == 0) goto closeclip; /* need to know final size after '\r' chars are removed because === modified file 'src/w32.c' --- src/w32.c 2012-06-30 15:55:27 +0000 +++ src/w32.c 2012-07-05 06:32:41 +0000 @@ -1476,7 +1476,7 @@ lpvalue = NULL; if (RegQueryValueEx (hrootkey, key, NULL, NULL, NULL, &cbData) == ERROR_SUCCESS - && (lpvalue = (LPBYTE) xmalloc (cbData)) != NULL + && (lpvalue = xmalloc (cbData)) != NULL && RegQueryValueEx (hrootkey, key, NULL, lpdwtype, lpvalue, &cbData) == ERROR_SUCCESS) { RegCloseKey (hrootkey); @@ -1493,7 +1493,7 @@ lpvalue = NULL; if (RegQueryValueEx (hrootkey, key, NULL, NULL, NULL, &cbData) == ERROR_SUCCESS - && (lpvalue = (LPBYTE) xmalloc (cbData)) != NULL + && (lpvalue = xmalloc (cbData)) != NULL && RegQueryValueEx (hrootkey, key, NULL, lpdwtype, lpvalue, &cbData) == ERROR_SUCCESS) { RegCloseKey (hrootkey); @@ -2169,7 +2169,7 @@ entry if present. */ if (info == NULL) { - info = (volume_info_data *) xmalloc (sizeof (volume_info_data)); + info = xmalloc (sizeof (volume_info_data)); add_volume_info (root_dir, info); } else === modified file 'src/w32fns.c' --- src/w32fns.c 2012-06-28 19:09:41 +0000 +++ src/w32fns.c 2012-07-05 06:32:41 +0000 @@ -1006,8 +1006,7 @@ } /* not already mapped, so add to list and recreate Windows palette */ - list = (struct w32_palette_entry *) - xmalloc (sizeof (struct w32_palette_entry)); + list = xmalloc (sizeof (struct w32_palette_entry)); SET_W32_COLOR (list->entry, color); list->refcount = 1; list->next = FRAME_W32_DISPLAY_INFO (f)->color_list; @@ -1109,8 +1108,7 @@ if (entry == NULL && alloc) { /* not already mapped, so add to list */ - entry = (struct w32_palette_entry *) - xmalloc (sizeof (struct w32_palette_entry)); + entry = xmalloc (sizeof (struct w32_palette_entry)); SET_W32_COLOR (entry->entry, XUINT (tem)); entry->next = NULL; *prev = entry; @@ -3881,7 +3879,7 @@ { char *str = SSDATA (Vx_resource_name); - f->namebuf = (char *) xmalloc (strlen (str) + 1); + f->namebuf = xmalloc (strlen (str) + 1); strcpy (f->namebuf, str); } @@ -4145,9 +4143,7 @@ f->terminal = dpyinfo->terminal; f->output_method = output_w32; - f->output_data.w32 = - (struct w32_output *) xmalloc (sizeof (struct w32_output)); - memset (f->output_data.w32, 0, sizeof (struct w32_output)); + f->output_data.w32 = xzalloc (sizeof (struct w32_output)); FRAME_FONTSET (f) = -1; f->icon_name @@ -5230,9 +5226,7 @@ counts etc. */ f->terminal = dpyinfo->terminal; f->output_method = output_w32; - f->output_data.w32 = - (struct w32_output *) xmalloc (sizeof (struct w32_output)); - memset (f->output_data.w32, 0, sizeof (struct w32_output)); + f->output_data.w32 = xzalloc (sizeof (struct w32_output)); FRAME_FONTSET (f) = -1; f->icon_name = Qnil; @@ -6687,7 +6681,7 @@ return Qnil; } /* Allocate memory for the PRINTER_INFO_2 struct */ - ppi2 = (PRINTER_INFO_2 *) xmalloc (dwNeeded); + ppi2 = xmalloc (dwNeeded); if (!ppi2) { ClosePrinter (hPrn); === modified file 'src/w32font.c' --- src/w32font.c 2012-05-02 10:12:13 +0000 +++ src/w32font.c 2012-07-05 06:32:41 +0000 @@ -529,9 +529,7 @@ if (!w32_font->cached_metrics[block]) { w32_font->cached_metrics[block] - = xmalloc (CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache)); - memset (w32_font->cached_metrics[block], 0, - CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache)); + = xzalloc (CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache)); } char_metric = w32_font->cached_metrics[block] + pos_in_block; === modified file 'src/w32reg.c' --- src/w32reg.c 2012-01-19 07:21:25 +0000 +++ src/w32reg.c 2012-07-05 06:32:41 +0000 @@ -110,7 +110,7 @@ } ok = (keyname - && (lpvalue = (LPBYTE) xmalloc (cbData)) != NULL + && (lpvalue = xmalloc (cbData)) != NULL && RegQueryValueEx (hrootkey, keyname, NULL, NULL, lpvalue, &cbData) == ERROR_SUCCESS); RegCloseKey (hrootkey); === modified file 'src/w32select.c' --- src/w32select.c 2012-02-11 09:50:27 +0000 +++ src/w32select.c 2012-07-05 06:32:41 +0000 @@ -216,7 +216,7 @@ setup_windows_coding_system (coding_system, &coding); coding.dst_bytes = SBYTES (current_text) * 2; - coding.destination = (unsigned char *) xmalloc (coding.dst_bytes); + coding.destination = xmalloc (coding.dst_bytes); encode_coding_object (&coding, current_text, 0, 0, SCHARS (current_text), SBYTES (current_text), Qnil); === modified file 'src/w32term.c' --- src/w32term.c 2012-06-28 07:50:50 +0000 +++ src/w32term.c 2012-07-05 06:32:41 +0000 @@ -285,8 +285,7 @@ XGCValues * XCreateGC (void *ignore, Window window, unsigned long mask, XGCValues *xgcv) { - XGCValues *gc = (XGCValues *) xmalloc (sizeof (XGCValues)); - memset (gc, 0, sizeof (XGCValues)); + XGCValues *gc = xzalloc (sizeof (XGCValues)); XChangeGC (ignore, gc, mask, xgcv); @@ -6060,10 +6059,8 @@ w32_display_name_list); dpyinfo->name_list_element = XCAR (w32_display_name_list); - dpyinfo->w32_id_name - = (char *) xmalloc (SCHARS (Vinvocation_name) - + SCHARS (Vsystem_name) - + 2); + dpyinfo->w32_id_name = xmalloc (SCHARS (Vinvocation_name) + + SCHARS (Vsystem_name) + 2); sprintf (dpyinfo->w32_id_name, "%s@%s", SDATA (Vinvocation_name), SDATA (Vsystem_name)); @@ -6228,7 +6225,7 @@ /* We don't yet support separate terminals on W32, so don't try to share keyboards between virtual terminals that are on the same physical terminal like X does. */ - terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); + terminal->kboard = xmalloc (sizeof (KBOARD)); init_kboard (terminal->kboard); KVAR (terminal->kboard, Vwindow_system) = intern ("w32"); terminal->kboard->next_kboard = all_kboards; @@ -6280,7 +6277,7 @@ terminal = w32_create_terminal (dpyinfo); /* 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; === modified file 'src/w32uniscribe.c' --- src/w32uniscribe.c 2012-01-19 07:21:25 +0000 +++ src/w32uniscribe.c 2012-07-05 06:32:41 +0000 @@ -231,7 +231,7 @@ /* First we need to break up the glyph string into runs of glyphs that can be treated together. First try a single run. */ max_items = 2; - items = (SCRIPT_ITEM *) xmalloc (sizeof (SCRIPT_ITEM) * max_items + 1); + items = xmalloc (sizeof (SCRIPT_ITEM) * max_items + 1); while ((result = ScriptItemize (chars, nchars, max_items, NULL, NULL, items, &nitems)) == E_OUTOFMEMORY) === modified file 'src/widget.c' --- src/widget.c 2012-01-19 07:21:25 +0000 +++ src/widget.c 2012-07-05 06:32:41 +0000 @@ -435,7 +435,7 @@ flags & XNegative ? '-' : '+', x < 0 ? -x : x, flags & YNegative ? '-' : '+', y < 0 ? -y : y); len = strlen (shell_position) + 1; - tem = (char *) xmalloc (len); + tem = xmalloc (len); strncpy (tem, shell_position, len); XtVaSetValues (wmshell, XtNgeometry, tem, NULL); } @@ -445,7 +445,7 @@ char *tem; sprintf (shell_position, "=%dx%d", pixel_width, pixel_height); len = strlen (shell_position) + 1; - tem = (char *) xmalloc (len); + tem = xmalloc (len); strncpy (tem, shell_position, len); XtVaSetValues (wmshell, XtNgeometry, tem, NULL); } === modified file 'src/xdisp.c' --- src/xdisp.c 2012-06-29 18:52:54 +0000 +++ src/xdisp.c 2012-07-05 06:32:41 +0000 @@ -29055,7 +29055,7 @@ /* Allocate the buffer for frame titles. Also used for `format-mode-line'. */ int size = 100; - mode_line_noprop_buf = (char *) xmalloc (size); + mode_line_noprop_buf = xmalloc (size); mode_line_noprop_buf_end = mode_line_noprop_buf + size; mode_line_noprop_ptr = mode_line_noprop_buf; mode_line_target = MODE_LINE_DISPLAY; === modified file 'src/xfaces.c' --- src/xfaces.c 2012-06-28 07:50:50 +0000 +++ src/xfaces.c 2012-07-05 06:32:41 +0000 @@ -4148,8 +4148,7 @@ static struct face * make_realized_face (Lisp_Object *attr) { - struct face *face = (struct face *) xmalloc (sizeof *face); - memset (face, 0, sizeof *face); + struct face *face = xzalloc (sizeof *face); face->ascii_face = face; memcpy (face->lface, attr, sizeof face->lface); return face; @@ -4294,13 +4293,11 @@ struct face_cache *c; int size; - c = (struct face_cache *) xmalloc (sizeof *c); - memset (c, 0, sizeof *c); + c = xzalloc (sizeof *c); size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; - c->buckets = (struct face **) xmalloc (size); - memset (c->buckets, 0, size); + c->buckets = xzalloc (size); c->size = 50; - c->faces_by_id = (struct face **) xmalloc (c->size * sizeof *c->faces_by_id); + c->faces_by_id = xmalloc (c->size * sizeof *c->faces_by_id); c->f = f; c->menu_face_changed_p = menu_face_changed_default; return c; @@ -5582,7 +5579,7 @@ struct face_cache *cache = FRAME_FACE_CACHE (f); struct face *face; - face = (struct face *) xmalloc (sizeof *face); + face = xmalloc (sizeof *face); *face = *base_face; face->gc = 0; face->extra = NULL; === modified file 'src/xfns.c' --- src/xfns.c 2012-06-28 07:50:50 +0000 +++ src/xfns.c 2012-07-05 06:32:41 +0000 @@ -2368,7 +2368,7 @@ { char *str = SSDATA (Vx_resource_name); - f->namebuf = (char *) xmalloc (strlen (str) + 1); + f->namebuf = xmalloc (strlen (str) + 1); strcpy (f->namebuf, str); } @@ -3129,8 +3129,7 @@ f->terminal = dpyinfo->terminal; f->output_method = output_x_window; - f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output)); - memset (f->output_data.x, 0, sizeof (struct x_output)); + f->output_data.x = xzalloc (sizeof (struct x_output)); f->output_data.x->icon_bitmap = -1; FRAME_FONTSET (f) = -1; f->output_data.x->scroll_bar_foreground_pixel = -1; @@ -4615,8 +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 = (struct x_output *) xmalloc (sizeof (struct x_output)); - memset (f->output_data.x, 0, sizeof (struct x_output)); + f->output_data.x = xzalloc (sizeof (struct x_output)); f->output_data.x->icon_bitmap = -1; FRAME_FONTSET (f) = -1; f->output_data.x->scroll_bar_foreground_pixel = -1; === modified file 'src/xmenu.c' --- src/xmenu.c 2012-06-25 04:05:48 +0000 +++ src/xmenu.c 2012-07-05 06:32:41 +0000 @@ -961,7 +961,7 @@ else if (!f->output_data.x->saved_menu_event && !deep_p) { deep_p = 1; - f->output_data.x->saved_menu_event = (XEvent*)xmalloc (sizeof (XEvent)); + f->output_data.x->saved_menu_event = xmalloc (sizeof (XEvent)); f->output_data.x->saved_menu_event->type = 0; } === modified file 'src/xrdb.c' --- src/xrdb.c 2012-02-10 18:58:48 +0000 +++ src/xrdb.c 2012-07-05 06:32:41 +0000 @@ -87,7 +87,7 @@ if (result) { - char *copy = (char *) xmalloc (strlen (result) + 1); + char *copy = xmalloc (strlen (result) + 1); strcpy (copy, result); return copy; } @@ -132,7 +132,7 @@ char *lang = getenv ("LANG"); ptrdiff_t path_size = 100; - char *path = (char *) xmalloc (path_size); + char *path = xmalloc (path_size); ptrdiff_t path_len = 0; const char *p = string; @@ -258,7 +258,7 @@ if (ptr == NULL) return xstrdup ("/"); - copy = (char *) xmalloc (strlen (ptr) + 2); + copy = xmalloc (strlen (ptr) + 2); strcpy (copy, ptr); strcat (copy, "/"); @@ -400,7 +400,7 @@ char *xdefault; home = gethomedir (); - xdefault = (char *) xmalloc (strlen (home) + sizeof (".Xdefaults")); + xdefault = xmalloc (strlen (home) + sizeof (".Xdefaults")); strcpy (xdefault, home); strcat (xdefault, ".Xdefaults"); db = XrmGetFileDatabase (xdefault); === modified file 'src/xselect.c' --- src/xselect.c 2012-06-28 07:50:27 +0000 +++ src/xselect.c 2012-07-05 06:32:41 +0000 @@ -180,16 +180,11 @@ } } - queue_tmp - = (struct selection_event_queue *) xmalloc (sizeof (struct selection_event_queue)); - - if (queue_tmp != NULL) - { - TRACE1 ("QUEUE SELECTION EVENT %p", queue_tmp); - queue_tmp->event = *event; - queue_tmp->next = selection_queue; - selection_queue = queue_tmp; - } + queue_tmp = xmalloc (sizeof (struct selection_event_queue)); + TRACE1 ("QUEUE SELECTION EVENT %p", queue_tmp); + queue_tmp->event = *event; + queue_tmp->next = selection_queue; + selection_queue = queue_tmp; } /* Start queuing SELECTION_REQUEST_EVENT events. */ @@ -1085,7 +1080,7 @@ expect_property_change (Display *display, Window window, Atom property, int state) { - struct prop_location *pl = (struct prop_location *) xmalloc (sizeof *pl); + struct prop_location *pl = xmalloc (sizeof *pl); pl->identifier = ++prop_location_identifier; pl->display = display; pl->window = window; @@ -1446,7 +1441,7 @@ struct prop_location *wait_object; if (min (PTRDIFF_MAX, SIZE_MAX) < min_size_bytes) memory_full (SIZE_MAX); - *data_ret = (unsigned char *) xmalloc (min_size_bytes); + *data_ret = xmalloc (min_size_bytes); *size_bytes_ret = min_size_bytes; TRACE1 ("Read %u bytes incrementally", min_size_bytes); @@ -1780,7 +1775,7 @@ } else if (SYMBOLP (obj)) { - *data_ret = (unsigned char *) xmalloc (sizeof (Atom) + 1); + *data_ret = xmalloc (sizeof (Atom) + 1); *format_ret = 32; *size_ret = 1; (*data_ret) [sizeof (Atom)] = 0; @@ -1789,7 +1784,7 @@ } else if (RANGED_INTEGERP (X_SHRT_MIN, obj, X_SHRT_MAX)) { - *data_ret = (unsigned char *) xmalloc (sizeof (short) + 1); + *data_ret = xmalloc (sizeof (short) + 1); *format_ret = 16; *size_ret = 1; (*data_ret) [sizeof (short)] = 0; @@ -1802,7 +1797,7 @@ || (CONSP (XCDR (obj)) && INTEGERP (XCAR (XCDR (obj))))))) { - *data_ret = (unsigned char *) xmalloc (sizeof (unsigned long) + 1); + *data_ret = xmalloc (sizeof (unsigned long) + 1); *format_ret = 32; *size_ret = 1; (*data_ret) [sizeof (unsigned long)] = 0; === modified file 'src/xterm.c' --- src/xterm.c 2012-06-28 07:50:50 +0000 +++ src/xterm.c 2012-07-05 06:32:41 +0000 @@ -5777,9 +5777,9 @@ do \ { \ if (f->output_data.x->saved_menu_event == 0) \ - f->output_data.x->saved_menu_event \ - = (XEvent *) xmalloc (sizeof (XEvent)); \ - *f->output_data.x->saved_menu_event = event; \ + f->output_data.x->saved_menu_event = \ + xmalloc (sizeof (XEvent)); \ + *f->output_data.x->saved_menu_event = event; \ inev.ie.kind = MENU_BAR_ACTIVATE_EVENT; \ XSETFRAME (inev.ie.frame_or_window, f); \ } \ @@ -8190,11 +8190,11 @@ struct xim_inst_t *xim_inst; ptrdiff_t len; - xim_inst = (struct xim_inst_t *) xmalloc (sizeof (struct xim_inst_t)); + xim_inst = xmalloc (sizeof (struct xim_inst_t)); dpyinfo->xim_callback_data = xim_inst; xim_inst->dpyinfo = dpyinfo; len = strlen (resource_name); - xim_inst->resource_name = (char *) xmalloc (len + 1); + xim_inst->resource_name = xmalloc (len + 1); memcpy (xim_inst->resource_name, resource_name, len + 1); XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, resource_name, emacs_class, @@ -10098,8 +10098,7 @@ /* We have definitely succeeded. Record the new connection. */ - dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info)); - memset (dpyinfo, 0, sizeof *dpyinfo); + dpyinfo = xzalloc (sizeof (struct x_display_info)); hlinfo = &dpyinfo->mouse_highlight; terminal = x_create_terminal (dpyinfo); @@ -10117,7 +10116,7 @@ terminal->kboard = share->terminal->kboard; else { - terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); + terminal->kboard = xmalloc (sizeof (KBOARD)); init_kboard (terminal->kboard); KVAR (terminal->kboard, Vwindow_system) = Qx; @@ -10171,7 +10170,7 @@ dpyinfo->display = dpy; /* Set the name of the terminal. */ - terminal->name = (char *) xmalloc (SBYTES (display_name) + 1); + terminal->name = xmalloc (SBYTES (display_name) + 1); memcpy (terminal->name, SSDATA (display_name), SBYTES (display_name)); terminal->name[SBYTES (display_name)] = 0; @@ -10182,10 +10181,8 @@ lim = min (PTRDIFF_MAX, SIZE_MAX) - sizeof "@"; if (lim - SBYTES (Vinvocation_name) < SBYTES (Vsystem_name)) memory_full (SIZE_MAX); - dpyinfo->x_id_name - = (char *) xmalloc (SBYTES (Vinvocation_name) - + SBYTES (Vsystem_name) - + 2); + dpyinfo->x_id_name = xmalloc (SBYTES (Vinvocation_name) + + SBYTES (Vsystem_name) + 2); strcat (strcat (strcpy (dpyinfo->x_id_name, SSDATA (Vinvocation_name)), "@"), SSDATA (Vsystem_name)); ------------------------------------------------------------ revno: 108875 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-07-04 21:16:11 -0700 message: * fileio.c (time_error_value): Check the right error number. Problem reported by Troels Nielsen in . diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-04 17:58:55 +0000 +++ src/ChangeLog 2012-07-05 04:16:11 +0000 @@ -1,3 +1,9 @@ +2012-07-05 Paul Eggert + + * fileio.c (time_error_value): Check the right error number. + Problem reported by Troels Nielsen in + . + 2012-07-04 Paul Eggert * window.c (set_window_hscroll): Revert the 100000 hscroll limit. === modified file 'src/fileio.c' --- src/fileio.c 2012-07-04 17:11:11 +0000 +++ src/fileio.c 2012-07-05 04:16:11 +0000 @@ -3218,7 +3218,7 @@ time_error_value (int errnum) { EMACS_TIME t; - int ns = (errno == ENOENT || errno == EACCES || errno == ENOTDIR + int ns = (errnum == ENOENT || errnum == EACCES || errnum == ENOTDIR ? NONEXISTENT_MODTIME_NSECS : UNKNOWN_MODTIME_NSECS); EMACS_SET_SECS_NSECS (t, 0, ns); ------------------------------------------------------------ revno: 108874 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-07-04 20:06:50 -0700 message: * doc/lispref/intro.texi (A Sample Function Description): Fix cross-refs. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-07-05 02:52:00 +0000 +++ doc/lispref/ChangeLog 2012-07-05 03:06:50 +0000 @@ -1,3 +1,7 @@ +2012-07-05 Glenn Morris + + * intro.texi (A Sample Function Description): Fix cross-refs. + 2012-07-05 Michael Witten (tiny change) * intro.texi (Evaluation Notation, A Sample Function Description) === modified file 'doc/lispref/intro.texi' --- doc/lispref/intro.texi 2012-07-05 02:52:00 +0000 +++ doc/lispref/intro.texi 2012-07-05 03:06:50 +0000 @@ -384,14 +384,14 @@ 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. -(@xref{Lisp Data Types} for a list of Emacs object types.) An argument +(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. - @xref{Lambda Expressions} for a more complete description of arguments -modified by @code{&optional} and @code{&rest}. + For a more complete description of arguments modified by +@code{&optional} and @code{&rest}, @pxref{Lambda Expressions}. Command, macro, and special form descriptions have the same format, but the word `Function' is replaced by `Command', `Macro', or `Special ------------------------------------------------------------ revno: 108873 fixes bug(s): http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11862 author: Michael Witten committer: Stefan Monnier branch nick: trunk timestamp: Wed 2012-07-04 22:52:00 -0400 message: * doc/lispref/intro.texi (Evaluation Notation, A Sample Function Description) (A Sample Variable Description, Version Info): Copy edits. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-06-27 05:21:15 +0000 +++ doc/lispref/ChangeLog 2012-07-05 02:52:00 +0000 @@ -1,3 +1,8 @@ +2012-07-05 Michael Witten (tiny change) + + * intro.texi (Evaluation Notation, A Sample Function Description) + (A Sample Variable Description, Version Info): Copy edits (bug#11862). + 2012-06-27 Chong Yidong * processes.texi (Asynchronous Processes, Input to Processes): === modified file 'doc/lispref/intro.texi' --- doc/lispref/intro.texi 2012-05-27 01:34:14 +0000 +++ doc/lispref/intro.texi 2012-07-05 02:52:00 +0000 @@ -235,7 +235,7 @@ @result{} c @end example - Sometimes to help describe one form we show another form that + Sometimes to help describe one form, we show another form that produces identical results. The exact equivalence of two forms is indicated with @samp{@equiv{}}. @@ -350,8 +350,8 @@ you call the function. The keyword @code{&rest} (which must be followed by a single -argument name) indicates that any number of arguments can follow. The -single argument name following @code{&rest} will receive, as its +argument name) indicates that any number of arguments may 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,17 +380,18 @@ @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. Arguments named @var{object} may be of any type. -(@xref{Lisp Data Types}, for a list of Emacs object types.) Arguments -with other sorts of names (e.g., @var{new-file}) are discussed +@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. +(@xref{Lisp Data Types} for a list of Emacs object 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. - @xref{Lambda Expressions}, for a more complete description of optional -and rest arguments. + @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 @@ -445,11 +446,14 @@ @cindex variable descriptions @cindex option descriptions - A @dfn{variable} is a name that can hold a 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. + 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, +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 @@ -504,7 +508,7 @@ The value of this variable is the version of Emacs being run. It is a string such as @code{"23.1.1"}. The last number in this string is not really part of the Emacs release version number; it is incremented -each time you build Emacs in any given directory. A value with four +each time Emacs is built in any given directory. A value with four numeric components, such as @code{"22.0.91.1"}, indicates an unreleased test version. @end defvar ------------------------------------------------------------ revno: 108872 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-07-04 10:58:55 -0700 message: * window.c (set_window_hscroll): Revert the 100000 hscroll limit. This should be fixed in a better way; see Eli Zaretskii in . (HSCROLL_MAX): Remove; this is now internal to set_window_hscroll. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-04 17:11:11 +0000 +++ src/ChangeLog 2012-07-04 17:58:55 +0000 @@ -1,5 +1,10 @@ 2012-07-04 Paul Eggert + * window.c (set_window_hscroll): Revert the 100000 hscroll limit. + This should be fixed in a better way; see Eli Zaretskii in + . + (HSCROLL_MAX): Remove; this is now internal to set_window_hscroll. + * fileio.c (time_error_value): Rename from special_mtime. The old name's problems were noted by Eli Zaretskii in . === modified file 'src/window.c' --- src/window.c 2012-07-04 06:15:31 +0000 +++ src/window.c 2012-07-04 17:58:55 +0000 @@ -51,11 +51,6 @@ #include "nsterm.h" #endif -/* Horizontal scrolling has problems with large scroll amounts. - It's too slow with long lines, and even with small lines the - display can be messed up. Impose a reasonable maximum. */ -enum { HSCROLL_MAX = 100000 }; - Lisp_Object Qwindowp, Qwindow_live_p; static Lisp_Object Qwindow_configuration_p, Qrecord_window_buffer; static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer; @@ -680,7 +675,14 @@ static Lisp_Object set_window_hscroll (struct window *w, EMACS_INT hscroll) { - int new_hscroll = clip_to_bounds (0, hscroll, HSCROLL_MAX); + /* Horizontal scrolling has problems with large scroll amounts. + It's too slow with long lines, and even with small lines the + display can be messed up. For now, though, impose only the limits + required by the internal representation: horizontal scrolling must + fit in fixnum (since it's visible to Elisp) and into ptrdiff_t + (since it's stored in a ptrdiff_t). */ + ptrdiff_t hscroll_max = min (MOST_POSITIVE_FIXNUM, PTRDIFF_MAX); + ptrdiff_t new_hscroll = clip_to_bounds (0, hscroll, hscroll_max); /* Prevent redisplay shortcuts when changing the hscroll. */ if (w->hscroll != new_hscroll) ------------------------------------------------------------ revno: 108871 committer: Juanma Barranquero branch nick: trunk timestamp: Wed 2012-07-04 19:17:19 +0200 message: * nt/configure.bat (enablechecking): Enable checks through src/config.h. * nt/gmake.defs (DEBUG_CFLAGS): Add -fno-crossjumping. (CHECKING_CFLAGS): Remove. (CFLAGS, ESC_CFLAGS): Do not include $(CHECKING_CFLAGS). * nt/nmake.defs (CHECKING_CFLAGS): Remove. (CFLAGS, ESC_CFLAGS): Do not include $(CHECKING_CFLAGS). diff: === modified file 'nt/ChangeLog' --- nt/ChangeLog 2012-07-04 16:46:42 +0000 +++ nt/ChangeLog 2012-07-04 17:17:19 +0000 @@ -1,3 +1,16 @@ +2012-07-04 Juanma Barranquero + Eli Zaretskii + + * configure.bat (enablechecking): Enable checks through src/config.h, + not the compiler's command line. + + * nmake.defs (CHECKING_CFLAGS): Remove. + (CFLAGS, ESC_CFLAGS): Do not include $(CHECKING_CFLAGS). + + * gmake.defs (DEBUG_CFLAGS): Add -fno-crossjumping. + (CHECKING_CFLAGS): Remove. + (CFLAGS, ESC_CFLAGS): Do not include $(CHECKING_CFLAGS). + 2012-07-04 Juanma Barranquero * config.nt (LISP_FLOAT_TYPE, HAVE_XFREE386, USE_TEXT_PROPERTIES) === modified file 'nt/configure.bat' --- nt/configure.bat 2012-05-31 06:06:42 +0000 +++ nt/configure.bat 2012-07-04 17:17:19 +0000 @@ -145,7 +145,7 @@ echo. --with-msvc use MSVC to compile Emacs echo. --no-debug exclude debug info from executables echo. --no-opt disable optimization -echo. --enable-checking enable checks and assertions +echo. --enable-checking enable additional run-time checks echo. --profile enable profiling echo. --no-cygwin use -mno-cygwin option with GCC echo. --cflags FLAG pass FLAG to compiler @@ -769,7 +769,6 @@ if not "(%dbginfo%)" == "()" >>config.settings echo DEBUG_INFO=%dbginfo% if (%nodebug%) == (Y) >>config.settings echo NODEBUG=1 if (%noopt%) == (Y) >>config.settings echo NOOPT=1 -if (%enablechecking%) == (Y) >>config.settings echo ENABLECHECKS=1 if (%profile%) == (Y) >>config.settings echo PROFILE=1 if (%nocygwin%) == (Y) >>config.settings echo NOCYGWIN=1 if not "(%prefix%)" == "()" >>config.settings echo INSTALL_DIR=%prefix% @@ -794,6 +793,7 @@ if (%docflags%) == (Y) echo #define USER_CFLAGS " %escusercflags%" >>config.tmp if (%doldflags%) == (Y) echo #define USER_LDFLAGS " %escuserldflags%" >>config.tmp if (%profile%) == (Y) echo #define PROFILING 1 >>config.tmp +if (%enablechecking%) == (Y) echo #define ENABLE_CHECKING 1 >>config.tmp if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>config.tmp if not "(%HAVE_GNUTLS%)" == "()" echo #define HAVE_GNUTLS 1 >>config.tmp if not "(%HAVE_LIBXML2%)" == "()" echo #define HAVE_LIBXML2 1 >>config.tmp === modified file 'nt/gmake.defs' --- nt/gmake.defs 2012-06-28 09:06:11 +0000 +++ nt/gmake.defs 2012-07-04 17:17:19 +0000 @@ -199,21 +199,15 @@ OBJ2_c = $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ2)) ifdef NOOPT -DEBUG_CFLAGS = -DEMACSDEBUG +DEBUG_CFLAGS = -DEMACSDEBUG -fno-crossjumping else DEBUG_CFLAGS = endif -ifdef ENABLECHECKS -CHECKING_CFLAGS = -DENABLE_CHECKING -fno-crossjumping -else -CHECKING_CFLAGS = -endif - MWINDOWS = -mwindows -CFLAGS = -I. $(ARCH_CFLAGS) $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(PROFILE_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS) -ESC_CFLAGS = -I. $(ARCH_CFLAGS) $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(PROFILE_CFLAGS) $(ESC_USER_CFLAGS) $(LOCAL_FLAGS) +CFLAGS = -I. $(ARCH_CFLAGS) $(DEBUG_CFLAGS) $(PROFILE_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS) +ESC_CFLAGS = -I. $(ARCH_CFLAGS) $(DEBUG_CFLAGS) $(PROFILE_CFLAGS) $(ESC_USER_CFLAGS) $(LOCAL_FLAGS) EMACS_EXTRA_C_FLAGS = -DUSE_CRT_DLL=1 ifdef PROFILE === modified file 'nt/nmake.defs' --- nt/nmake.defs 2012-06-28 09:06:11 +0000 +++ nt/nmake.defs 2012-07-04 17:17:19 +0000 @@ -145,18 +145,12 @@ DEBUG_CFLAGS = !endif -!ifdef ENABLECHECKS -CHECKING_CFLAGS = -DENABLE_CHECKING -!else -CHECKING_CFLAGS = -!endif - MWINDOWS = -subsystem:windows -entry:mainCRTStartup CFLAGS = -I. $(ARCH_CFLAGS) \ - $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS) + $(DEBUG_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS) ESC_CFLAGS = -I. $(ARCH_CFLAGS) \ - $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(ESC_USER_CFLAGS) $(LOCAL_FLAGS) + $(DEBUG_CFLAGS) $(ESC_USER_CFLAGS) $(LOCAL_FLAGS) #SYS_LDFLAGS = -nologo -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj !ifdef NOOPT ------------------------------------------------------------ revno: 108870 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-07-04 10:11:11 -0700 message: * fileio.c (time_error_value): Rename from special_mtime. The old name's problems were noted by Eli Zaretskii in . diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-04 17:04:09 +0000 +++ src/ChangeLog 2012-07-04 17:11:11 +0000 @@ -1,5 +1,9 @@ 2012-07-04 Paul Eggert + * fileio.c (time_error_value): Rename from special_mtime. + The old name's problems were noted by Eli Zaretskii in + . + * emacs.c (gdb_pvec_type): Change it back to enum pvec_type. This variable's comment says Emacs needs at least one GDB-visible symbol of type enum pvec_type, to work around GDB problems. === modified file 'src/fileio.c' --- src/fileio.c 2012-07-04 00:04:46 +0000 +++ src/fileio.c 2012-07-04 17:11:11 +0000 @@ -3213,9 +3213,9 @@ return lseek (fd, offset, whence); } -/* Return a special mtime value indicating the error number ERRNUM. */ +/* Return a special time value indicating the error number ERRNUM. */ static EMACS_TIME -special_mtime (int errnum) +time_error_value (int errnum) { EMACS_TIME t; int ns = (errno == ENOENT || errno == EACCES || errno == ENOTDIR @@ -3336,7 +3336,7 @@ save_errno = errno; if (NILP (visit)) report_file_error ("Opening input file", Fcons (orig_filename, Qnil)); - mtime = special_mtime (save_errno); + mtime = time_error_value (save_errno); st.st_size = -1; how_much = 0; if (!NILP (Vcoding_system_for_read)) @@ -5106,7 +5106,7 @@ mtime = (stat (SSDATA (filename), &st) == 0 ? get_stat_mtime (&st) - : special_mtime (errno)); + : time_error_value (errno)); if ((EMACS_TIME_EQ (mtime, b->modtime) /* If both exist, accept them if they are off by one second. */ || (EMACS_TIME_VALID_P (mtime) && EMACS_TIME_VALID_P (b->modtime) ------------------------------------------------------------ revno: 108869 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-07-04 10:04:09 -0700 message: * emacs.c (gdb_pvec_type): Change it back to enum pvec_type. This variable's comment says Emacs needs at least one GDB-visible symbol of type enum pvec_type, to work around GDB problems. The symbol's value doesn't matter. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-04 16:52:51 +0000 +++ src/ChangeLog 2012-07-04 17:04:09 +0000 @@ -1,5 +1,10 @@ 2012-07-04 Paul Eggert + * emacs.c (gdb_pvec_type): Change it back to enum pvec_type. + This variable's comment says Emacs needs at least one GDB-visible + symbol of type enum pvec_type, to work around GDB problems. + The symbol's value doesn't matter. + * alloc.c (PSEUDOVECTOR_NBYTES): Remove stray ';' that causes compilation to fail on pre-C99 compilers. === modified file 'src/emacs.c' --- src/emacs.c 2012-07-04 14:38:02 +0000 +++ src/emacs.c 2012-07-04 17:04:09 +0000 @@ -119,7 +119,7 @@ ptrdiff_t gdb_array_mark_flag EXTERNALLY_VISIBLE = ARRAY_MARK_FLAG; /* GDB might say "No enum type named pvec_type" if we don't have at least one symbol with that type, and then xbacktrace could fail. */ -ptrdiff_t gdb_pvec_type EXTERNALLY_VISIBLE = PVEC_TYPE_MASK; +enum pvec_type const gdb_pvec_type EXTERNALLY_VISIBLE = 0; /* Empty lisp strings. To avoid having to build any others. */ Lisp_Object empty_unibyte_string, empty_multibyte_string; ------------------------------------------------------------ revno: 108868 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-07-04 09:52:51 -0700 message: * alloc.c (PSEUDOVECTOR_NBYTES): Remove stray ';' that causes compilation to fail on pre-C99 compilers. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-04 16:46:42 +0000 +++ src/ChangeLog 2012-07-04 16:52:51 +0000 @@ -1,3 +1,8 @@ +2012-07-04 Paul Eggert + + * alloc.c (PSEUDOVECTOR_NBYTES): Remove stray ';' + that causes compilation to fail on pre-C99 compilers. + 2012-07-04 Juanma Barranquero * s/ms-w32.h (LISP_FLOAT_TYPE, HAVE_MEMCMP, HAVE_MEMCPY) === modified file 'src/alloc.c' --- src/alloc.c 2012-07-04 14:38:02 +0000 +++ src/alloc.c 2012-07-04 16:52:51 +0000 @@ -3060,7 +3060,7 @@ #define PSEUDOVECTOR_NBYTES(vector) \ (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_FREE) \ ? vector->header.size & PSEUDOVECTOR_SIZE_MASK \ - : vector->header.next.nbytes); + : vector->header.next.nbytes) /* Reclaim space used by unmarked vectors. */ ------------------------------------------------------------ revno: 108867 committer: Juanma Barranquero branch nick: trunk timestamp: Wed 2012-07-04 18:46:42 +0200 message: Remove obsolete configuration options (Windows port). * admin/CPP-DEFINES (LISP_FLOAT_TYPE): Remove, obsolete. * nt/config.nt (LISP_FLOAT_TYPE, HAVE_XFREE386, USE_TEXT_PROPERTIES) (GSSAPI, HAVE_LIBINTL, HAVE_LIBGSSAPI_KRB5, HAVE_LIBGSSAPI) (HAVE_GSSAPI_H, HAVE_LIBXBD, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET) (HAVE_MEMCMP): Remove, obsolete. * src/s/ms-w32.h (LISP_FLOAT_TYPE, HAVE_MEMCMP, HAVE_MEMCPY) (HAVE_MEMMOVE, HAVE_MEMSET): Don't set, obsolete. diff: === modified file 'admin/CPP-DEFINES' --- admin/CPP-DEFINES 2012-06-22 21:17:42 +0000 +++ admin/CPP-DEFINES 2012-07-04 16:46:42 +0000 @@ -173,7 +173,6 @@ IS_DIRECTORY_SEP LINKER LINUX_VERSION_CODE -LISP_FLOAT_TYPE LNOFLSH LOCALTIME_CACHE MAIL_USE_FLOCK === modified file 'admin/ChangeLog' --- admin/ChangeLog 2012-06-26 05:00:30 +0000 +++ admin/ChangeLog 2012-07-04 16:46:42 +0000 @@ -1,3 +1,7 @@ +2012-07-04 Juanma Barranquero + + * CPP-DEFINES (LISP_FLOAT_TYPE): Remove, obsolete. + 2012-06-26 Dmitry Antipov * coccinelle/build_string.cocci: Semantic patch === modified file 'nt/ChangeLog' --- nt/ChangeLog 2012-06-30 21:10:50 +0000 +++ nt/ChangeLog 2012-07-04 16:46:42 +0000 @@ -1,3 +1,10 @@ +2012-07-04 Juanma Barranquero + + * config.nt (LISP_FLOAT_TYPE, HAVE_XFREE386, USE_TEXT_PROPERTIES) + (GSSAPI, HAVE_LIBINTL, HAVE_LIBGSSAPI_KRB5, HAVE_LIBGSSAPI) + (HAVE_GSSAPI_H, HAVE_LIBXBD, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET) + (HAVE_MEMCMP): Remove, obsolete. + 2012-06-30 Glenn Morris * paths.h (PATH_SITELOADSEARCH): New. === modified file 'nt/config.nt' --- nt/config.nt 2012-06-24 18:31:31 +0000 +++ nt/config.nt 2012-07-04 16:46:42 +0000 @@ -27,10 +27,6 @@ /* These are all defined in the top-level Makefile by configure. They're here only for reference. */ -/* Define LISP_FLOAT_TYPE if you want emacs to support floating-point - numbers. */ -#undef LISP_FLOAT_TYPE - /* Define GNU_MALLOC if you want to use the GNU memory allocator. */ #define GNU_MALLOC @@ -58,9 +54,6 @@ /* Define if using an X toolkit. */ #undef USE_X_TOOLKIT -/* Define this if you're using XFree386. */ -#undef HAVE_XFREE386 - /* Define this if you have Motif 2.1 or newer. */ #undef HAVE_MOTIF_2_1 @@ -84,10 +77,6 @@ #define HAVE_MOUSE #endif -/* Define USE_TEXT_PROPERTIES to support visual and other properties - on text. */ -#define USE_TEXT_PROPERTIES - /* Define USER_FULL_NAME to return a string that is the user's full name. It can assume that the variable `pw' @@ -112,8 +101,6 @@ #undef KERBEROS /* Define to use Kerberos 5 instead of Kerberos 4 */ #undef KERBEROS5 -/* Define to support GSS-API in addition to (or instead of) Kerberos */ -#undef GSSAPI /* Define to support using a Hesiod database to find the POP server. */ #undef HESIOD @@ -138,7 +125,6 @@ #undef HAVE_LIBPTHREADS #undef HAVE_LIBRESOLV #undef HAVE_LIBXMU -#undef HAVE_LIBINTL /* movemail Kerberos support */ /* libraries */ @@ -159,11 +145,6 @@ #undef HAVE_KERBEROS_KRB_H #undef HAVE_COM_ERR_H -/* GSS-API libraries and headers */ -#undef HAVE_LIBGSSAPI_KRB5 -#undef HAVE_LIBGSSAPI -#undef HAVE_GSSAPI_H - /* Mail-file locking */ #undef HAVE_LIBMAIL #undef HAVE_MAILLOCK_H @@ -200,7 +181,6 @@ #undef CRAY_STACKSEG_END -#undef HAVE_LIBXBSD #undef HAVE_XRMSETDATABASE #undef HAVE_XSCREENRESOURCESTRING #undef HAVE_XSCREENNUMBEROFSCREEN @@ -209,10 +189,6 @@ #undef HAVE_RMDIR #undef HAVE_RANDOM #undef HAVE_LRAND48 -#undef HAVE_MEMCPY -#undef HAVE_MEMMOVE -#undef HAVE_MEMSET -#undef HAVE_MEMCMP #undef HAVE_LOGB #undef HAVE_FREXP #undef HAVE_FMOD === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-04 16:32:54 +0000 +++ src/ChangeLog 2012-07-04 16:46:42 +0000 @@ -1,3 +1,8 @@ +2012-07-04 Juanma Barranquero + + * s/ms-w32.h (LISP_FLOAT_TYPE, HAVE_MEMCMP, HAVE_MEMCPY) + (HAVE_MEMMOVE, HAVE_MEMSET): Don't set, obsolete. + 2012-07-04 Dmitry Antipov * buffer.c (init_buffer_once): Fix initialization of === modified file 'src/s/ms-w32.h' --- src/s/ms-w32.h 2012-06-30 15:55:27 +0000 +++ src/s/ms-w32.h 2012-07-04 16:46:42 +0000 @@ -105,7 +105,6 @@ #endif #define HAVE_SOUND 1 -#define LISP_FLOAT_TYPE 1 #define HAVE_SYS_TIMEB_H 1 #define HAVE_SYS_TIME_H 1 @@ -133,10 +132,6 @@ #define HAVE_RANDOM 1 #undef HAVE_SYSINFO #undef HAVE_LRAND48 -#define HAVE_MEMCMP 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMSET 1 #define HAVE_LOGB 1 #define HAVE_FREXP 1 #define HAVE_FMOD 1 ------------------------------------------------------------ revno: 108866 committer: Juanma Barranquero branch nick: trunk timestamp: Wed 2012-07-04 18:32:54 +0200 message: Fix ChangeLog typos. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-07-04 16:14:05 +0000 +++ lisp/ChangeLog 2012-07-04 16:32:54 +0000 @@ -1772,7 +1772,7 @@ * calendar/icalendar.el (icalendar-export-region): Export UID properly. -2012-05-29 Leo +2012-05-29 Leo Liu * calendar/icalendar.el (icalendar-import-format): Add `icalendar-import-format-uid' (Bug#11525). (icalendar-import-format-uid): New. @@ -2106,7 +2106,7 @@ Simplify; Don't bother removing a ] just to add it back. * textmodes/ispell.el (ispell-program-name): Use executable-find. -2012-05-18 Rüdiger Sonderfeld +2012-05-18 Rüdiger Sonderfeld * calc/calc-lang.el (math-C-parse-bess, math-C-parse-fma): New functions. @@ -5270,7 +5270,7 @@ files from Git, SVN, Bazaar, and Mercurial. (save-place-to-alist): Use it. -2012-02-17 Lawrence Mitchell +2012-02-17 Lawrence Mitchell Stefan Monnier * newcomment.el (uncomment-region-default): Don't leave extra space === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-04 15:49:46 +0000 +++ src/ChangeLog 2012-07-04 16:32:54 +0000 @@ -1,6 +1,6 @@ 2012-07-04 Dmitry Antipov - * buffer.c (init_buffer_once): Fix initialization of + * buffer.c (init_buffer_once): Fix initialization of headers for buffer_defaults and buffer_local_symbols. Reported by Juanma Barranquero . @@ -105,8 +105,8 @@ * fileio.c (Fmake_symbolic_link): No longer static. * eval.c (Ffetch_bytecode): No longer static. * editfns.c (Fuser_full_name): No longer static. - * doc.c: (Fdocumentation_property, Fsnarf_documentation): No - longer static. + * doc.c (Fdocumentation_property, Fsnarf_documentation): + No longer static. * buffer.c (Fset_buffer_major_mode, Fdelete_overlay): No longer static. * dired.c (Ffile_attributes): No longer static. @@ -381,11 +381,11 @@ 2012-06-27 Dmitry Antipov - * alloc.c (allocate_string): Fix last change. + * alloc.c (allocate_string): Fix last change. 2012-06-27 Dmitry Antipov - * alloc.c (allocate_string): Remove two redundant calls + * alloc.c (allocate_string): Remove two redundant calls to memset, add explicit initialization where appropriate. 2012-06-27 Glenn Morris ------------------------------------------------------------ revno: 108865 committer: Chong Yidong branch nick: trunk timestamp: Thu 2012-07-05 00:14:05 +0800 message: Clean up syntax-table usage in xml.el * xml.el (xml--parse-buffer): Use xml-syntax-table. (xml-parse-tag): Likewise, and avoid changing entity tables. (xml-syntax-table): Define from scratch, making sure not to give x2000 and other Unicode spaces whitespace syntax, since those are not spaces in XML. (xml-parse-fragment): Delete unused function. (xml-name-start-char-re, xml-name-char-re, xml-name-re) (xml-names-re, xml-nmtoken-re, xml-nmtokens-re, xml-char-ref-re) (xml-entity-ref, xml-pe-reference-re) (xml-reference-re,xml-att-value-re, xml-tokenized-type-re) (xml-notation-type-re, xml-enumeration-re, xml-enumerated-type-re) (xml-att-type-re, xml-default-decl-re, xml-att-def-re) (xml-entity-value-re): Use syntax references in regexps where possible; no need to define inside a let-binding. (xml-parse-dtd): Use xml-pe-reference-re. (xml-entity-or-char-ref-re): New defconst. (xml-parse-string, xml-substitute-special): Use it. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-07-04 15:59:12 +0000 +++ lisp/ChangeLog 2012-07-04 16:14:05 +0000 @@ -1,3 +1,23 @@ +2012-07-04 Chong Yidong + + * xml.el (xml--parse-buffer): Use xml-syntax-table. + (xml-parse-tag): Likewise, and avoid changing entity tables. + (xml-syntax-table): Define from scratch, making sure not to give + x2000 and other Unicode spaces whitespace syntax, since those are + not spaces in XML. + (xml-parse-fragment): Delete unused function. + (xml-name-start-char-re, xml-name-char-re, xml-name-re) + (xml-names-re, xml-nmtoken-re, xml-nmtokens-re, xml-char-ref-re) + (xml-entity-ref, xml-pe-reference-re) + (xml-reference-re,xml-att-value-re, xml-tokenized-type-re) + (xml-notation-type-re, xml-enumeration-re, xml-enumerated-type-re) + (xml-att-type-re, xml-default-decl-re, xml-att-def-re) + (xml-entity-value-re): Use syntax references in regexps where + possible; no need to define inside a let-binding. + (xml-parse-dtd): Use xml-pe-reference-re. + (xml-entity-or-char-ref-re): New defconst. + (xml-parse-string, xml-substitute-special): Use it. + 2012-07-04 Stefan Monnier * files.el (locate-dominating-file): Allow `name' to be a predicate. === modified file 'lisp/xml.el' --- lisp/xml.el 2012-07-04 03:31:34 +0000 +++ lisp/xml.el 2012-07-04 16:14:05 +0000 @@ -164,93 +164,107 @@ See also `xml-get-attribute-or-nil'." (or (xml-get-attribute-or-nil node attribute) "")) -;;; Creating the list - -;;;###autoload -(defun xml-parse-file (file &optional parse-dtd parse-ns) - "Parse the well-formed XML file FILE. -Return the top node with all its children. -If PARSE-DTD is non-nil, the DTD is parsed rather than skipped. -If PARSE-NS is non-nil, then QNAMES are expanded." - (with-temp-buffer - (insert-file-contents file) - (xml--parse-buffer parse-dtd parse-ns))) - +;;; Regular expressions for XML components + +;; The following regexps are used as subexpressions in regexps that +;; are `eval-when-compile'd for efficiency, so they must be defined at +;; compile time. (eval-and-compile -(let* ((start-chars (concat "[:alpha:]:_")) - (name-chars (concat "-[:digit:]." start-chars)) - ;;[3] S ::= (#x20 | #x9 | #xD | #xA)+ - (whitespace "[ \t\n\r]")) - ;; [4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] - ;; | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] - ;; | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] - ;; | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] - ;; | [#x10000-#xEFFFF] - (defconst xml-name-start-char-re (concat "[" start-chars "]")) - ;; [4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 - ;; | [#x0300-#x036F] | [#x203F-#x2040] - (defconst xml-name-char-re (concat "[" name-chars "]")) - ;; [5] Name ::= NameStartChar (NameChar)* - (defconst xml-name-re (concat xml-name-start-char-re xml-name-char-re "*")) - ;; [6] Names ::= Name (#x20 Name)* - (defconst xml-names-re (concat xml-name-re "\\(?: " xml-name-re "\\)*")) - ;; [7] Nmtoken ::= (NameChar)+ - (defconst xml-nmtoken-re (concat xml-name-char-re "+")) - ;; [8] Nmtokens ::= Nmtoken (#x20 Nmtoken)* - (defconst xml-nmtokens-re (concat xml-nmtoken-re "\\(?: " xml-name-re "\\)*")) - ;; [66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';' - (defconst xml-char-ref-re "\\(?:&#[0-9]+;\\|&#x[0-9a-fA-F]+;\\)") - ;; [68] EntityRef ::= '&' Name ';' - (defconst xml-entity-ref (concat "&" xml-name-re ";")) - ;; [69] PEReference ::= '%' Name ';' - (defconst xml-pe-reference-re (concat "%" xml-name-re ";")) - ;; [67] Reference ::= EntityRef | CharRef - (defconst xml-reference-re (concat "\\(?:" xml-entity-ref "\\|" xml-char-ref-re "\\)")) - ;; [10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'" - (defconst xml-att-value-re (concat "\\(?:\"\\(?:[^&\"]\\|" xml-reference-re "\\)*\"\\|" - "'\\(?:[^&']\\|" xml-reference-re "\\)*'\\)")) - ;; [56] TokenizedType ::= 'ID' [VC: ID] [VC: One ID / Element Type] [VC: ID Attribute Default] - ;; | 'IDREF' [VC: IDREF] - ;; | 'IDREFS' [VC: IDREF] - ;; | 'ENTITY' [VC: Entity Name] - ;; | 'ENTITIES' [VC: Entity Name] - ;; | 'NMTOKEN' [VC: Name Token] - ;; | 'NMTOKENS' [VC: Name Token] - (defconst xml-tokenized-type-re (concat "\\(?:ID\\|IDREF\\|IDREFS\\|ENTITY\\|" - "ENTITIES\\|NMTOKEN\\|NMTOKENS\\)")) - ;; [58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')' - (defconst xml-notation-type-re - (concat "\\(?:NOTATION" whitespace "(" whitespace "*" xml-name-re - "\\(?:" whitespace "*|" whitespace "*" xml-name-re "\\)*" - whitespace "*)\\)")) - ;; [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')' - ;; [VC: Enumeration] [VC: No Duplicate Tokens] - (defconst xml-enumeration-re (concat "\\(?:(" whitespace "*" xml-nmtoken-re - "\\(?:" whitespace "*|" whitespace "*" - xml-nmtoken-re "\\)*" - whitespace ")\\)")) - ;; [57] EnumeratedType ::= NotationType | Enumeration - (defconst xml-enumerated-type-re (concat "\\(?:" xml-notation-type-re - "\\|" xml-enumeration-re "\\)")) - ;; [54] AttType ::= StringType | TokenizedType | EnumeratedType - ;; [55] StringType ::= 'CDATA' - (defconst xml-att-type-re (concat "\\(?:CDATA\\|" xml-tokenized-type-re - "\\|" xml-notation-type-re - "\\|" xml-enumerated-type-re "\\)")) - ;; [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue) - (defconst xml-default-decl-re (concat "\\(?:#REQUIRED\\|#IMPLIED\\|\\(?:#FIXED" - whitespace "\\)*" xml-att-value-re "\\)")) - ;; [53] AttDef ::= S Name S AttType S DefaultDecl - (defconst xml-att-def-re (concat "\\(?:" whitespace "*" xml-name-re - whitespace "*" xml-att-type-re - whitespace "*" xml-default-decl-re "\\)")) - ;; [9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' - ;; | "'" ([^%&'] | PEReference | Reference)* "'" - (defconst xml-entity-value-re (concat "\\(?:\"\\(?:[^%&\"]\\|" xml-pe-reference-re - "\\|" xml-reference-re - "\\)*\"\\|'\\(?:[^%&']\\|" - xml-pe-reference-re "\\|" - xml-reference-re "\\)*'\\)")))) + +;; [4] NameStartChar +;; See the definition of word syntax in `xml-syntax-table'. +(defconst xml-name-start-char-re (concat "[[:word:]:_]")) + +;; [4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 +;; | [#x0300-#x036F] | [#x203F-#x2040] +(defconst xml-name-char-re (concat "[-0-9.[:word:]:_·̀-ͯ‿-⁀]")) + +;; [5] Name ::= NameStartChar (NameChar)* +(defconst xml-name-re (concat xml-name-start-char-re xml-name-char-re "*")) + +;; [6] Names ::= Name (#x20 Name)* +(defconst xml-names-re (concat xml-name-re "\\(?: " xml-name-re "\\)*")) + +;; [7] Nmtoken ::= (NameChar)+ +(defconst xml-nmtoken-re (concat xml-name-char-re "+")) + +;; [8] Nmtokens ::= Nmtoken (#x20 Nmtoken)* +(defconst xml-nmtokens-re (concat xml-nmtoken-re "\\(?: " xml-name-re "\\)*")) + +;; [66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';' +(defconst xml-char-ref-re "\\(?:&#[0-9]+;\\|&#x[0-9a-fA-F]+;\\)") + +;; [68] EntityRef ::= '&' Name ';' +(defconst xml-entity-ref (concat "&" xml-name-re ";")) + +(defconst xml-entity-or-char-ref-re (concat "&\\(?:#\\(x\\)?\\([0-9]+\\)\\|\\(" + xml-name-re "\\)\\);")) + +;; [69] PEReference ::= '%' Name ';' +(defconst xml-pe-reference-re (concat "%\\(" xml-name-re "\\);")) + +;; [67] Reference ::= EntityRef | CharRef +(defconst xml-reference-re (concat "\\(?:" xml-entity-ref "\\|" xml-char-ref-re "\\)")) + +;; [10] AttValue ::= '"' ([^<&"] | Reference)* '"' +;; | "'" ([^<&'] | Reference)* "'" +(defconst xml-att-value-re (concat "\\(?:\"\\(?:[^&\"]\\|" + xml-reference-re "\\)*\"\\|" + "'\\(?:[^&']\\|" xml-reference-re + "\\)*'\\)")) + +;; [56] TokenizedType ::= 'ID' +;; [VC: ID] [VC: One ID / Element Type] [VC: ID Attribute Default] +;; | 'IDREF' [VC: IDREF] +;; | 'IDREFS' [VC: IDREF] +;; | 'ENTITY' [VC: Entity Name] +;; | 'ENTITIES' [VC: Entity Name] +;; | 'NMTOKEN' [VC: Name Token] +;; | 'NMTOKENS' [VC: Name Token] +(defconst xml-tokenized-type-re (concat "\\(?:ID\\|IDREF\\|IDREFS\\|ENTITY\\|" + "ENTITIES\\|NMTOKEN\\|NMTOKENS\\)")) + +;; [58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')' +(defconst xml-notation-type-re + (concat "\\(?:NOTATION\\s-+(\\s-*" xml-name-re + "\\(?:\\s-*|\\s-*" xml-name-re "\\)*\\s-*)\\)")) + +;; [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')' +;; [VC: Enumeration] [VC: No Duplicate Tokens] +(defconst xml-enumeration-re (concat "\\(?:(\\s-*" xml-nmtoken-re + "\\(?:\\s-*|\\s-*" xml-nmtoken-re + "\\)*\\s-+)\\)")) + +;; [57] EnumeratedType ::= NotationType | Enumeration +(defconst xml-enumerated-type-re (concat "\\(?:" xml-notation-type-re + "\\|" xml-enumeration-re "\\)")) + +;; [54] AttType ::= StringType | TokenizedType | EnumeratedType +;; [55] StringType ::= 'CDATA' +(defconst xml-att-type-re (concat "\\(?:CDATA\\|" xml-tokenized-type-re + "\\|" xml-notation-type-re + "\\|" xml-enumerated-type-re "\\)")) + +;; [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue) +(defconst xml-default-decl-re (concat "\\(?:#REQUIRED\\|#IMPLIED\\|" + "\\(?:#FIXED\\s-+\\)*" + xml-att-value-re "\\)")) + +;; [53] AttDef ::= S Name S AttType S DefaultDecl +(defconst xml-att-def-re (concat "\\(?:\\s-*" xml-name-re + "\\s-*" xml-att-type-re + "\\s-*" xml-default-decl-re "\\)")) + +;; [9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' +;; | "'" ([^%&'] | PEReference | Reference)* "'" +(defconst xml-entity-value-re (concat "\\(?:\"\\(?:[^%&\"]\\|" + xml-pe-reference-re + "\\|" xml-reference-re + "\\)*\"\\|'\\(?:[^%&']\\|" + xml-pe-reference-re "\\|" + xml-reference-re "\\)*'\\)")) +) ; End of `eval-when-compile' + ;; [75] ExternalID ::= 'SYSTEM' S SystemLiteral ;; | 'PUBLIC' S PubidLiteral S SystemLiteral @@ -263,53 +277,59 @@ ;; Note that this is setup so that we can do whitespace-skipping with ;; `(skip-syntax-forward " ")', inter alia. Previously this was slow -;; compared with `re-search-forward', but that has been fixed. Also -;; note that the standard syntax table contains other characters with -;; whitespace syntax, like NBSP, but they are invalid in contexts in -;; which we might skip whitespace -- specifically, they're not -;; NameChars [XML 4]. +;; compared with `re-search-forward', but that has been fixed. (defvar xml-syntax-table - (let ((table (make-syntax-table))) - ;; Get space syntax correct per XML [3]. - (dotimes (c 31) - (modify-syntax-entry c "." table)) ; all are space in standard table - (dolist (c '(?\t ?\n ?\r)) ; these should be space + ;; By default, characters have symbol syntax. + (let ((table (make-char-table 'syntax-table '(3)))) + ;; The XML space chars [3], and nothing else, have space syntax. + (dolist (c '(?\s ?\t ?\r ?\n)) (modify-syntax-entry c " " table)) - ;; For skipping attributes. - (modify-syntax-entry ?\" "\"" table) - (modify-syntax-entry ?' "\"" table) - ;; Non-alnum name chars should be symbol constituents (`-' and `_' - ;; are OK by default). - (modify-syntax-entry ?. "_" table) - (modify-syntax-entry ?: "_" table) - ;; XML [89] - (unless (featurep 'xemacs) - (dolist (c '(#x00B7 #x02D0 #x02D1 #x0387 #x0640 #x0E46 #x0EC6 #x3005 - #x3031 #x3032 #x3033 #x3034 #x3035 #x309D #x309E #x30FC - #x30FD #x30FE)) - (modify-syntax-entry (decode-char 'ucs c) "w" table))) - ;; Fixme: rest of [4] + ;; The characters in NameStartChar [4], aside from ':' and '_', + ;; have word syntax. This is used by `xml-name-start-char-re'. + (modify-syntax-entry '(?A . ?Z) "w" table) + (modify-syntax-entry '(?a . ?z) "w" table) + (modify-syntax-entry '(#xC0 . #xD6) "w" table) + (modify-syntax-entry '(#xD8 . #XF6) "w" table) + (modify-syntax-entry '(#xF8 . #X2FF) "w" table) + (modify-syntax-entry '(#x370 . #X37D) "w" table) + (modify-syntax-entry '(#x37F . #x1FFF) "w" table) + (modify-syntax-entry '(#x200C . #x200D) "w" table) + (modify-syntax-entry '(#x2070 . #x218F) "w" table) + (modify-syntax-entry '(#x2C00 . #x2FEF) "w" table) + (modify-syntax-entry '(#x3001 . #xD7FF) "w" table) + (modify-syntax-entry '(#xF900 . #xFDCF) "w" table) + (modify-syntax-entry '(#xFDF0 . #xFFFD) "w" table) + (modify-syntax-entry '(#x10000 . #xEFFFF) "w" table) table) - "Syntax table used by `xml-parse-region'.") - -;; XML [5] - -;; Fixme: This needs re-writing to deal with the XML grammar properly, i.e. -;; document ::= prolog element Misc* -;; prolog ::= XMLDecl? Misc* (doctypedecl Misc*)? + "Syntax table used by the XML parser. +In this syntax table, the XML space characters [ \\t\\r\\n], and +only those characters, have whitespace syntax.") + +;;; Entry points: + +;;;###autoload +(defun xml-parse-file (file &optional parse-dtd parse-ns) + "Parse the well-formed XML file FILE. +Return the top node with all its children. +If PARSE-DTD is non-nil, the DTD is parsed rather than skipped. +If PARSE-NS is non-nil, then QNAMES are expanded." + (with-temp-buffer + (insert-file-contents file) + (xml--parse-buffer parse-dtd parse-ns))) ;;;###autoload (defun xml-parse-region (&optional beg end buffer parse-dtd parse-ns) "Parse the region from BEG to END in BUFFER. +Return the XML parse tree, or raise an error if the region does +not contain well-formed XML. + If BEG is nil, it defaults to `point-min'. If END is nil, it defaults to `point-max'. If BUFFER is nil, it defaults to the current buffer. -Returns the XML list for the region, or raises an error if the region -is not well-formed XML. -If PARSE-DTD is non-nil, the DTD is parsed rather than skipped, -and returned as the first element of the list. -If PARSE-NS is non-nil, then QNAMES are expanded." +If PARSE-DTD is non-nil, parse the DTD and return it as the first +element of the list. +If PARSE-NS is non-nil, expand QNAMES." ;; Use fixed syntax table to ensure regexp char classes and syntax ;; specs DTRT. (unless buffer @@ -318,8 +338,14 @@ (insert-buffer-substring-no-properties buffer beg end) (xml--parse-buffer parse-dtd parse-ns))) +;; XML [5] + +;; Fixme: This needs re-writing to deal with the XML grammar properly, i.e. +;; document ::= prolog element Misc* +;; prolog ::= XMLDecl? Misc* (doctypedecl Misc*)? + (defun xml--parse-buffer (parse-dtd parse-ns) - (with-syntax-table (standard-syntax-table) + (with-syntax-table xml-syntax-table (let ((case-fold-search nil) ; XML is case-sensitive. ;; Prevent entity definitions from changing the defaults (xml-entity-alist xml-entity-alist) @@ -374,22 +400,6 @@ (cons ns (if special "" lname))) (intern name))) -(defun xml-parse-fragment (&optional parse-dtd parse-ns) - "Parse xml-like fragments." - (let ((xml-sub-parser t) - ;; Prevent entity definitions from changing the defaults - (xml-entity-alist xml-entity-alist) - (xml-parameter-entity-alist xml-parameter-entity-alist) - children) - (while (not (eobp)) - (let ((bit (xml-parse-tag-1 parse-dtd parse-ns))) - (if children - (setq children (append (list bit) children)) - (if (stringp bit) - (setq children (list bit)) - (setq children bit))))) - (reverse children))) - (defun xml-parse-tag (&optional parse-dtd parse-ns) "Parse the tag at point. If PARSE-DTD is non-nil, the DTD of the document, if any, is parsed and @@ -401,12 +411,17 @@ - a list : the matching node - nil : the point is not looking at a tag. - a pair : the first element is the DTD, the second is the node." - (let ((buf (current-buffer)) - (pos (point))) + (let* ((case-fold-search nil) + ;; Prevent entity definitions from changing the defaults + (xml-entity-alist xml-entity-alist) + (xml-parameter-entity-alist xml-parameter-entity-alist) + (buf (current-buffer)) + (pos (point))) (with-temp-buffer - (insert-buffer-substring-no-properties buf pos) - (goto-char (point-min)) - (xml-parse-tag-1 parse-dtd parse-ns)))) + (with-syntax-table xml-syntax-table + (insert-buffer-substring-no-properties buf pos) + (goto-char (point-min)) + (xml-parse-tag-1 parse-dtd parse-ns))))) (defun xml-parse-tag-1 (&optional parse-dtd parse-ns) "Like `xml-parse-tag', but possibly modify the buffer while working." @@ -530,40 +545,32 @@ (skip-chars-forward "^<&") (when (eq (char-after) ?&) ;; If we find an entity or character reference, expand it. - (unless (looking-at (eval-when-compile - (concat "&\\(?:#\\([0-9]+\\)\\|#x\\([0-9a-fA-F]+\\)\\|\\(" - xml-name-re "\\)\\);"))) + (unless (looking-at xml-entity-or-char-ref-re) (error "XML: (Not Well-Formed) Invalid entity reference")) ;; For a character reference, the next entity or character ;; reference must be after the replacement. [4.6] "Numerical ;; character references are expanded immediately when ;; recognized and MUST be treated as character data." - (cond ((setq ref (match-string 1)) - ;; Decimal character reference - (setq val (save-match-data - (decode-char 'ucs (string-to-number ref)))) - (and (null val) - xml-validating-parser - (error "XML: (Validity) Invalid character `%s'" ref)) - (replace-match (or (string val) xml-undefined-entity) t t)) - ;; Hexadecimal character reference - ((setq ref (match-string 2)) - (setq val (save-match-data - (decode-char 'ucs (string-to-number ref 16)))) - (and (null val) - xml-validating-parser - (error "XML: (Validity) Invalid character `x%s'" ref)) - (replace-match (or (string val) xml-undefined-entity) t t)) - ;; For an entity reference, search again from the start - ;; of the replaced text, since the replacement can - ;; contain entity or character references, or markup. - ((setq ref (match-string 3)) - (setq val (assoc ref xml-entity-alist)) - (and (null val) - xml-validating-parser - (error "XML: (Validity) Undefined entity `%s'" ref)) - (replace-match (cdr val) t t) - (goto-char (match-beginning 0)))) + (if (setq ref (match-string 2)) + (progn ; Numeric char reference + (setq val (save-match-data + (decode-char 'ucs (string-to-number + ref (if (match-string 1) 16))))) + (and (null val) + xml-validating-parser + (error "XML: (Validity) Invalid character reference `%s'" + (match-string 0))) + (replace-match (or (string val) xml-undefined-entity) t t)) + ;; For an entity reference, search again from the start of + ;; the replaced text, since the replacement can contain + ;; entity or character references, or markup. + (setq ref (match-string 3) + val (assoc ref xml-entity-alist)) + (and (null val) + xml-validating-parser + (error "XML: (Validity) Undefined entity `%s'" ref)) + (replace-match (cdr val) t t) + (goto-char (match-beginning 0))) ;; Check for XML bombs. (and xml-entity-expansion-limit (> (- (buffer-size) (point)) @@ -610,8 +617,9 @@ (replace-regexp-in-string "\\s-\\{2,\\}" " " string) (let ((expansion (xml-substitute-special string))) (unless (stringp expansion) - ; We say this is the constraint. It is actually that neither - ; external entities nor "<" can be in an attribute value. + ;; We say this is the constraint. It is actually that + ;; neither external entities nor "<" can be in an + ;; attribute value. (error "XML: (Not Well-Formed) Entities in attributes cannot expand into elements")) (push (cons name expansion) attlist))) @@ -643,8 +651,6 @@ (looking-at xml-name-re) (let ((dtd (list (match-string-no-properties 0) 'dtd)) (xml-parameter-entity-alist xml-parameter-entity-alist) - (parameter-entity-re (eval-when-compile - (concat "%\\(" xml-name-re "\\);"))) next-parameter-entity) (goto-char (match-end 0)) (skip-syntax-forward " ") @@ -693,7 +699,7 @@ ;; and try again. (setq next-parameter-entity (save-excursion - (if (re-search-forward parameter-entity-re nil t) + (if (re-search-forward xml-pe-reference-re nil t) (match-beginning 0)))) ;; Parse the rest of the DTD @@ -752,7 +758,7 @@ (> (point) next-parameter-entity) (setq next-parameter-entity (save-excursion - (if (re-search-forward parameter-entity-re nil t) + (if (re-search-forward xml-pe-reference-re nil t) (match-beginning 0)))))) ;; Internal entity declarations: @@ -796,7 +802,7 @@ (next-parameter-entity (save-excursion (goto-char next-parameter-entity) - (unless (looking-at parameter-entity-re) + (unless (looking-at xml-pe-reference-re) (error "XML: Internal error")) (let* ((entity (match-string 1)) (beg (point-marker)) @@ -808,7 +814,7 @@ (goto-char next-parameter-entity)) (goto-char (match-end 0)))) (setq next-parameter-entity - (if (re-search-forward parameter-entity-re nil t) + (if (re-search-forward xml-pe-reference-re nil t) (match-beginning 0))))) ;; Anything else is garbage (ignored if not validating). @@ -889,20 +895,17 @@ (defun xml-substitute-special (string) "Return STRING, after substituting entity and character references. STRING is assumed to occur in an XML attribute value." - (let ((ref-re (eval-when-compile - (concat "&\\(?:#\\(x\\)?\\([0-9]+\\)\\|\\(" - xml-name-re "\\)\\);"))) - (strlen (length string)) + (let ((strlen (length string)) children) - (while (string-match ref-re string) + (while (string-match xml-entity-or-char-ref-re string) (push (substring string 0 (match-beginning 0)) children) (let* ((remainder (substring string (match-end 0))) - (ref (match-string 2 string))) + (is-hex (match-string 1 string)) ; Is it a hex numeric reference? + (ref (match-string 2 string))) ; Numeric part of reference (if ref ;; [4.6] Character references are included as ;; character data. - (let ((val (decode-char 'ucs (string-to-number - ref (if (match-string 1 string) 16))))) + (let ((val (decode-char 'ucs (string-to-number ref (if is-hex 16))))) (push (cond (val (string val)) (xml-validating-parser (error "XML: (Validity) Undefined character `x%s'" ref)) @@ -913,7 +916,7 @@ ;; [4.4.5] Entity references are "included in literal". ;; Note that we don't need do anything special to treat ;; quotes as normal data characters. - (setq ref (match-string 3 string)) + (setq ref (match-string 3 string)) ; entity name (let ((val (or (cdr (assoc ref xml-entity-alist)) (if xml-validating-parser (error "XML: (Validity) Undefined entity `%s'" ref) === modified file 'test/automated/xml-parse-tests.el' --- test/automated/xml-parse-tests.el 2012-07-03 05:28:42 +0000 +++ test/automated/xml-parse-tests.el 2012-07-04 16:14:05 +0000 @@ -30,10 +30,10 @@ (require 'xml) (defvar xml-parse-tests--data - '(;; General entity substitution + `(;; General entity substitution ("]>&ent;;" . ((foo ((a . "b")) (bar nil "AbC;")))) - ("&amp;&apos;'<>"" . + ("&amp;&apos;'<>"" . ((foo () "&''<>\""))) ;; Parameter entity substitution ("]>&ent;;" . @@ -52,7 +52,11 @@ ((foo ((a . "-aBc-")) "1"))) ;; Character references must be treated as character data ("AT&T;" . ((foo () "AT&T;"))) - ("&amp;" . ((foo () "&")))) + ("&amp;" . ((foo () "&"))) + ("&amp;" . ((foo () "&"))) + ;; Unusual but valid XML names [5] + ("<ÀÖØö.3·-‿⁀󯿿>abc" . ((,(intern "ÀÖØö.3·-‿⁀󯿿") () "abc"))) + ("<:>abc" . ((,(intern ":") () "abc")))) "Alist of XML strings and their expected parse trees.") (defvar xml-parse-tests--bad-data @@ -63,7 +67,11 @@ ;; Non-terminating DTD "" "asdf" - "asdf&abc;") + "asdf&abc;" + ;; Invalid XML names + "<0foo>abc" + "<‿foo>abc" + "abc") "List of XML strings that should signal an error in the parser") (ert-deftest xml-parse-tests () ------------------------------------------------------------ revno: 108864 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2012-07-04 11:59:12 -0400 message: * lisp/files.el (locate-dominating-file): Allow `name' to be a predicate. (find-file--read-only): New function. (find-file-read-only, find-file-read-only-other-window) (find-file-read-only-other-frame): Use it. (insert-file-contents-literally): Don't `fset'. (get-free-disk-space): Use locate-dominating-file. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-07-04 14:42:59 +0000 +++ lisp/ChangeLog 2012-07-04 15:59:12 +0000 @@ -1,5 +1,12 @@ 2012-07-04 Stefan Monnier + * files.el (locate-dominating-file): Allow `name' to be a predicate. + (find-file--read-only): New function. + (find-file-read-only, find-file-read-only-other-window) + (find-file-read-only-other-frame): Use it. + (insert-file-contents-literally): Don't `fset'. + (get-free-disk-space): Use locate-dominating-file. + * emacs-lisp/bytecomp.el (byte-compile): Don't signal an error if the function is already compiled. === modified file 'lisp/files.el' --- lisp/files.el 2012-06-26 16:23:01 +0000 +++ lisp/files.el 2012-07-04 15:59:12 +0000 @@ -876,12 +876,12 @@ ;; nil))) (defun locate-dominating-file (file name) - "Look up the directory hierarchy from FILE for a file named NAME. + "Look up the directory hierarchy from FILE for a directory containing NAME. Stop at the first parent directory containing a file NAME, and return the directory. Return nil if not found. - -This function only tests if FILE exists. If you care about whether -it is readable, regular, etc., you should test the result." +Instead of a string, NAME can also be a predicate taking one argument +\(a directory) and returning a non-nil value if that directory is the one for +which we're looking." ;; We used to use the above locate-dominating-files code, but the ;; directory-files call is very costly, so we're much better off doing ;; multiple calls using the code in here. @@ -908,16 +908,14 @@ ;; (setq user (nth 2 (file-attributes file))) ;; (and prev-user (not (equal user prev-user)))) (string-match locate-dominating-stop-dir-regexp file))) - ;; FIXME? maybe this function should (optionally?) - ;; use file-readable-p instead. In many cases, an unreadable - ;; FILE is no better than a non-existent one. - ;; See eg dir-locals-find-file. - (setq try (file-exists-p (expand-file-name name file))) + (setq try (if (stringp name) + (file-exists-p (expand-file-name name file)) + (funcall name file))) (cond (try (setq root file)) ((equal file (setq file (file-name-directory (directory-file-name file)))) (setq file nil)))) - root)) + (if root (file-name-as-directory root)))) (defun executable-find (command) @@ -1467,6 +1465,17 @@ (find-file filename) (current-buffer))) +(defun find-file--read-only (fun filename wildcards) + (unless (or (and wildcards find-file-wildcards + (not (string-match "\\`/:" filename)) + (string-match "[[*?]" filename)) + (file-exists-p filename)) + (error "%s does not exist" filename)) + (let ((value (funcall fun filename wildcards))) + (mapc (lambda (b) (with-current-buffer b (toggle-read-only 1))) + (if (listp value) value (list value))) + value)) + (defun find-file-read-only (filename &optional wildcards) "Edit file FILENAME but don't allow changes. Like \\[find-file], but marks buffer as read-only. @@ -1474,15 +1483,7 @@ (interactive (find-file-read-args "Find file read-only: " (confirm-nonexistent-file-or-buffer))) - (unless (or (and wildcards find-file-wildcards - (not (string-match "\\`/:" filename)) - (string-match "[[*?]" filename)) - (file-exists-p filename)) - (error "%s does not exist" filename)) - (let ((value (find-file filename wildcards))) - (mapc (lambda (b) (with-current-buffer b (toggle-read-only 1))) - (if (listp value) value (list value))) - value)) + (find-file--read-only #'find-file filename wildcards)) (defun find-file-read-only-other-window (filename &optional wildcards) "Edit file FILENAME in another window but don't allow changes. @@ -1491,15 +1492,7 @@ (interactive (find-file-read-args "Find file read-only other window: " (confirm-nonexistent-file-or-buffer))) - (unless (or (and wildcards find-file-wildcards - (not (string-match "\\`/:" filename)) - (string-match "[[*?]" filename)) - (file-exists-p filename)) - (error "%s does not exist" filename)) - (let ((value (find-file-other-window filename wildcards))) - (mapc (lambda (b) (with-current-buffer b (toggle-read-only 1))) - (if (listp value) value (list value))) - value)) + (find-file--read-only #'find-file-other-window filename wildcards)) (defun find-file-read-only-other-frame (filename &optional wildcards) "Edit file FILENAME in another frame but don't allow changes. @@ -1508,15 +1501,7 @@ (interactive (find-file-read-args "Find file read-only other frame: " (confirm-nonexistent-file-or-buffer))) - (unless (or (and wildcards find-file-wildcards - (not (string-match "\\`/:" filename)) - (string-match "[[*?]" filename)) - (file-exists-p filename)) - (error "%s does not exist" filename)) - (let ((value (find-file-other-frame filename wildcards))) - (mapc (lambda (b) (with-current-buffer b (toggle-read-only 1))) - (if (listp value) value (list value))) - value)) + (find-file--read-only #'find-file-other-frame filename wildcards)) (defun find-alternate-file-other-window (filename &optional wildcards) "Find file FILENAME as a replacement for the file in the next window. @@ -2020,6 +2005,8 @@ (after-find-file error (not nowarn))) (current-buffer)))) +(defvar file-name-buffer-file-type-alist) ;From dos-w32.el. + (defun insert-file-contents-literally (filename &optional visit beg end replace) "Like `insert-file-contents', but only reads in the file literally. A buffer may be modified in several ways after reading into the buffer, @@ -2031,21 +2018,14 @@ (after-insert-file-functions nil) (coding-system-for-read 'no-conversion) (coding-system-for-write 'no-conversion) - (find-buffer-file-type-function - (if (fboundp 'find-buffer-file-type) - (symbol-function 'find-buffer-file-type) - nil)) + (file-name-buffer-file-type-alist '(("" . t))) (inhibit-file-name-handlers + ;; FIXME: Yuck!! We should turn insert-file-contents-literally + ;; into a file operation instead! (append '(jka-compr-handler image-file-handler epa-file-handler) inhibit-file-name-handlers)) (inhibit-file-name-operation 'insert-file-contents)) - (unwind-protect - (progn - (fset 'find-buffer-file-type (lambda (_filename) t)) - (insert-file-contents filename visit beg end replace)) - (if find-buffer-file-type-function - (fset 'find-buffer-file-type find-buffer-file-type-function) - (fmakunbound 'find-buffer-file-type))))) + (insert-file-contents filename visit beg end replace))) (defun insert-file-1 (filename insert-func) (if (file-directory-p filename) @@ -5958,11 +5938,12 @@ (when (and directory-free-space-program ;; Avoid failure if the default directory does ;; not exist (Bug#2631, Bug#3911). - (let ((default-directory "/")) - (eq (call-process directory-free-space-program + (let ((default-directory + (locate-dominating-file dir 'file-directory-p))) + (eq (process-file directory-free-space-program nil t nil directory-free-space-args - dir) + (file-relative-name dir)) 0))) ;; Assume that the "available" column is before the ;; "capacity" column. Find the "%" and scan backward. ------------------------------------------------------------ revno: 108863 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2012-07-04 19:49:46 +0400 message: * buffer.c (init_buffer_once): Fix initialization of headers for buffer_defaults and buffer_local_symbols. Reported by Juanma Barranquero . diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-04 14:38:02 +0000 +++ src/ChangeLog 2012-07-04 15:49:46 +0000 @@ -1,3 +1,9 @@ +2012-07-04 Dmitry Antipov + + * buffer.c (init_buffer_once): Fix initialization of + headers for buffer_defaults and buffer_local_symbols. + Reported by Juanma Barranquero . + 2012-07-04 Stefan Monnier Turn VECTOR_FREE_LIST_FLAG into PVEC_FREE. === modified file 'src/buffer.c' --- src/buffer.c 2012-07-04 05:39:36 +0000 +++ src/buffer.c 2012-07-04 15:49:46 +0000 @@ -4870,6 +4870,12 @@ init_buffer_once (void) { int idx; + /* 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 + = (offsetof (struct buffer, own_text) - sizeof (struct vectorlike_header)) + / sizeof (Lisp_Object); memset (buffer_permanent_local_flags, 0, sizeof buffer_permanent_local_flags); @@ -4886,9 +4892,9 @@ buffer_local_symbols.text = &buffer_local_symbols.own_text; BUF_INTERVALS (&buffer_defaults) = 0; BUF_INTERVALS (&buffer_local_symbols) = 0; - XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, 0); + XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize); XSETBUFFER (Vbuffer_defaults, &buffer_defaults); - XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, 0); + XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize); XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols); /* Set up the default values of various buffer slots. */ ------------------------------------------------------------ revno: 108862 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2012-07-04 10:42:59 -0400 message: * lisp/emacs-lisp/bytecomp.el (byte-compile): Don't signal an error if the function is already compiled. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-07-04 03:31:34 +0000 +++ lisp/ChangeLog 2012-07-04 14:42:59 +0000 @@ -1,5 +1,8 @@ 2012-07-04 Stefan Monnier + * emacs-lisp/bytecomp.el (byte-compile): Don't signal an error if the + function is already compiled. + * xml.el (xml-name-regexp): Remove, redundant. Use xml-name-re. 2012-07-03 Michael Albinus === modified file 'lisp/emacs-lisp/bytecomp.el' --- lisp/emacs-lisp/bytecomp.el 2012-07-02 08:00:05 +0000 +++ lisp/emacs-lisp/bytecomp.el 2012-07-04 14:42:59 +0000 @@ -2485,22 +2485,32 @@ (macro (eq (car-safe fun) 'macro))) (if macro (setq fun (cdr fun))) - (when (symbolp form) - (unless (memq (car-safe fun) '(closure lambda)) + (cond + ;; Up until Emacs-24.1, byte-compile silently did nothing when asked to + ;; compile something invalid. So let's tune down the complaint from an + ;; error to a simple message for the known case where signaling an error + ;; causes problems. + ((byte-code-function-p fun) + (message "Function %s is already compiled" + (if (symbolp form) form "provided")) + fun) + (t + (when (symbolp form) + (unless (memq (car-safe fun) '(closure lambda)) + (error "Don't know how to compile %S" fun)) + (setq fun (byte-compile--reify-function fun)) + (setq lexical-binding (eq (car fun) 'closure))) + (unless (eq (car-safe fun) 'lambda) (error "Don't know how to compile %S" fun)) - (setq fun (byte-compile--reify-function fun)) - (setq lexical-binding (eq (car fun) 'closure))) - (unless (eq (car-safe fun) 'lambda) - (error "Don't know how to compile %S" fun)) - ;; Expand macros. - (setq fun (byte-compile-preprocess fun)) - ;; Get rid of the `function' quote added by the `lambda' macro. - (if (eq (car-safe fun) 'function) (setq fun (cadr fun))) - (setq fun (byte-compile-lambda fun)) - (if macro (push 'macro fun)) - (if (symbolp form) - (fset form fun) - fun))))) + ;; Expand macros. + (setq fun (byte-compile-preprocess fun)) + ;; Get rid of the `function' quote added by the `lambda' macro. + (if (eq (car-safe fun) 'function) (setq fun (cadr fun))) + (setq fun (byte-compile-lambda fun)) + (if macro (push 'macro fun)) + (if (symbolp form) + (fset form fun) + fun))))))) (defun byte-compile-sexp (sexp) "Compile and return SEXP." ------------------------------------------------------------ revno: 108861 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2012-07-04 10:38:02 -0400 message: Turn VECTOR_FREE_LIST_FLAG into PVEC_FREE. * src/lisp.h (enum pvec_type): Use fewer bits. (PSEUDOVECTOR_SIZE_BITS): New constant. (PSEUDOVECTOR_SIZE_MASK, PVEC_TYPE_MASK): Use it. (XSETPVECTYPESIZE, XSETTYPED_PSEUDOVECTOR, DEFUN): Adapt code to change in pvec_type. (PSEUDOVECTOR_TYPEP): New macro. (TYPED_PSEUDOVECTORP): Use it. * src/fns.c (internal_equal): Adapt code to extract pvectype. * src/emacs.c (gdb_pvec_type): Update type. * src/alloc.c (PSEUDOVECTOR_NBYTES): New macro. (VECTOR_FREE_LIST_SIZE_MASK): Remove (=> PSEUDOVECTOR_SIZE_MASK). (VECTOR_FREE_LIST_FLAG): Remove (=> PVEC_FREE). (SETUP_ON_FREE_LIST): Use XSETPVECTYPESIZE. (sweep_vectors): Use it. Use local var `total_bytes' instead of abusing vector->header.next.nbytes. (live_vector_p): Use PVEC_TYPE. (mark_object): Adapt code to extract pvectype. Use switch. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-04 08:26:20 +0000 +++ src/ChangeLog 2012-07-04 14:38:02 +0000 @@ -1,3 +1,24 @@ +2012-07-04 Stefan Monnier + + Turn VECTOR_FREE_LIST_FLAG into PVEC_FREE. + * lisp.h (enum pvec_type): Use fewer bits. + (PSEUDOVECTOR_SIZE_BITS): New constant. + (PSEUDOVECTOR_SIZE_MASK, PVEC_TYPE_MASK): Use it. + (XSETPVECTYPESIZE, XSETTYPED_PSEUDOVECTOR, DEFUN): Adapt code to + change in pvec_type. + (PSEUDOVECTOR_TYPEP): New macro. + (TYPED_PSEUDOVECTORP): Use it. + * fns.c (internal_equal): Adapt code to extract pvectype. + * emacs.c (gdb_pvec_type): Update type. + * alloc.c (PSEUDOVECTOR_NBYTES): New macro. + (VECTOR_FREE_LIST_SIZE_MASK): Remove (=> PSEUDOVECTOR_SIZE_MASK). + (VECTOR_FREE_LIST_FLAG): Remove (=> PVEC_FREE). + (SETUP_ON_FREE_LIST): Use XSETPVECTYPESIZE. + (sweep_vectors): Use it. Use local var `total_bytes' instead of + abusing vector->header.next.nbytes. + (live_vector_p): Use PVEC_TYPE. + (mark_object): Adapt code to extract pvectype. Use switch. + 2012-07-04 Paul Eggert * doprnt.c (doprnt): Don't assume string length fits in 'int'. === modified file 'src/alloc.c' --- src/alloc.c 2012-07-03 16:35:53 +0000 +++ src/alloc.c 2012-07-04 14:38:02 +0000 @@ -1529,7 +1529,7 @@ } -/* Mark Lisp objects in interval I. */ +/* Mark Lisp objects in interval I. */ static void mark_interval (register INTERVAL i, Lisp_Object dummy) @@ -1836,7 +1836,7 @@ ptrdiff_t nbytes; /* Check that the string size recorded in the string is the - same as the one recorded in the sdata structure. */ + same as the one recorded in the sdata structure. */ if (from->string) CHECK_STRING_BYTES (from->string); @@ -2869,12 +2869,6 @@ #define VECTOR_BLOCK_SIZE 4096 -/* This special value is used to calculate vector size when the vector is - on a free list. It should be VECTOR_BLOCK_SIZE rounded up to nearest - power of two, minus one. */ - -#define VECTOR_FREE_LIST_SIZE_MASK 4095 - /* Handy constants for vectorlike objects. */ enum { @@ -2889,8 +2883,7 @@ /* Verify assumptions described above. */ verify ((VECTOR_BLOCK_SIZE % roundup_size) == 0); -verify ((VECTOR_FREE_LIST_SIZE_MASK + 1) >= VECTOR_BLOCK_SIZE); -verify ((VECTOR_FREE_LIST_SIZE_MASK & (VECTOR_FREE_LIST_SIZE_MASK + 1)) == 0); +verify (VECTOR_BLOCK_SIZE <= (1 << PSEUDOVECTOR_SIZE_BITS)); /* Round up X to nearest mult-of-ROUNDUP_SIZE. */ @@ -2915,12 +2908,6 @@ #define VECTOR_MAX_FREE_LIST_INDEX \ ((VECTOR_BLOCK_BYTES - VBLOCK_BYTES_MIN) / roundup_size + 1) -/* When the vector is on a free list, vectorlike_header.SIZE is set to - this special value ORed with vector's memory footprint size. */ - -#define VECTOR_FREE_LIST_FLAG (~(ARRAY_MARK_FLAG | PSEUDOVECTOR_FLAG \ - | VECTOR_FREE_LIST_SIZE_MASK)) - /* Common shortcut to advance vector pointer over a block data. */ #define ADVANCE(v, nbytes) ((struct Lisp_Vector *) ((char *) (v) + (nbytes))) @@ -2933,7 +2920,7 @@ #define SETUP_ON_FREE_LIST(v, nbytes, index) \ do { \ - (v)->header.size = VECTOR_FREE_LIST_FLAG | (nbytes); \ + XSETPVECTYPESIZE (v, PVEC_FREE, nbytes); \ eassert ((nbytes) % roundup_size == 0); \ (index) = VINDEX (nbytes); \ eassert ((index) < VECTOR_MAX_FREE_LIST_INDEX); \ @@ -3065,6 +3052,16 @@ ((char *) (vector) <= (block)->data \ + VECTOR_BLOCK_BYTES - VBLOCK_BYTES_MIN) +/* Number of bytes used by vector-block-allocated object. This is the only + place where we actually use the `nbytes' field of the vector-header. + I.e. we could get rid of the `nbytes' field by computing it based on the + vector-type. */ + +#define PSEUDOVECTOR_NBYTES(vector) \ + (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_FREE) \ + ? vector->header.size & PSEUDOVECTOR_SIZE_MASK \ + : vector->header.next.nbytes); + /* Reclaim space used by unmarked vectors. */ static void @@ -3093,14 +3090,10 @@ } else { - ptrdiff_t nbytes; - - if ((vector->header.size & VECTOR_FREE_LIST_FLAG) - == VECTOR_FREE_LIST_FLAG) - vector->header.next.nbytes = - vector->header.size & VECTOR_FREE_LIST_SIZE_MASK; - - next = ADVANCE (vector, vector->header.next.nbytes); + ptrdiff_t nbytes = PSEUDOVECTOR_NBYTES (vector); + ptrdiff_t total_bytes = nbytes; + + next = ADVANCE (vector, nbytes); /* While NEXT is not marked, try to coalesce with VECTOR, thus making VECTOR of the largest possible size. */ @@ -3109,16 +3102,12 @@ { if (VECTOR_MARKED_P (next)) break; - if ((next->header.size & VECTOR_FREE_LIST_FLAG) - == VECTOR_FREE_LIST_FLAG) - nbytes = next->header.size & VECTOR_FREE_LIST_SIZE_MASK; - else - nbytes = next->header.next.nbytes; - vector->header.next.nbytes += nbytes; + nbytes = PSEUDOVECTOR_NBYTES (next); + total_bytes += nbytes; next = ADVANCE (next, nbytes); } - eassert (vector->header.next.nbytes % roundup_size == 0); + eassert (total_bytes % roundup_size == 0); if (vector == (struct Lisp_Vector *) block->data && !VECTOR_IN_BLOCK (next, block)) @@ -3126,7 +3115,10 @@ space was coalesced into the only free vector. */ free_this_block = 1; else - SETUP_ON_FREE_LIST (vector, vector->header.next.nbytes, nbytes); + { + int tmp; + SETUP_ON_FREE_LIST (vector, total_bytes, tmp); + } } } @@ -4342,10 +4334,9 @@ while (VECTOR_IN_BLOCK (vector, block) && vector <= (struct Lisp_Vector *) p) { - if ((vector->header.size & VECTOR_FREE_LIST_FLAG) - == VECTOR_FREE_LIST_FLAG) + if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_FREE)) vector = ADVANCE (vector, (vector->header.size - & VECTOR_FREE_LIST_SIZE_MASK)); + & PSEUDOVECTOR_SIZE_MASK)); else if (vector == p) return 1; else @@ -5913,15 +5904,17 @@ #endif /* GC_CHECK_MARKED_OBJECTS */ if (ptr->header.size & PSEUDOVECTOR_FLAG) - pvectype = ptr->header.size & PVEC_TYPE_MASK; + pvectype = ((ptr->header.size & PVEC_TYPE_MASK) + >> PSEUDOVECTOR_SIZE_BITS); else pvectype = 0; if (pvectype != PVEC_SUBR && pvectype != PVEC_BUFFER) CHECK_LIVE (live_vector_p); - if (pvectype == PVEC_BUFFER) + switch (pvectype) { + case PVEC_BUFFER: #ifdef GC_CHECK_MARKED_OBJECTS if (po != &buffer_defaults && po != &buffer_local_symbols) { @@ -5933,67 +5926,82 @@ } #endif /* GC_CHECK_MARKED_OBJECTS */ mark_buffer ((struct buffer *) ptr); - } - - else if (pvectype == PVEC_COMPILED) - /* We could treat this just like a vector, but it is better - to save the COMPILED_CONSTANTS element for last and avoid - recursion there. */ - { - int size = ptr->header.size & PSEUDOVECTOR_SIZE_MASK; - int i; - + break; + + case PVEC_COMPILED: + { /* We could treat this just like a vector, but it is better + to save the COMPILED_CONSTANTS element for last and avoid + recursion there. */ + int size = ptr->header.size & PSEUDOVECTOR_SIZE_MASK; + int i; + + VECTOR_MARK (ptr); + for (i = 0; i < size; i++) + if (i != COMPILED_CONSTANTS) + mark_object (ptr->contents[i]); + if (size > COMPILED_CONSTANTS) + { + obj = ptr->contents[COMPILED_CONSTANTS]; + goto loop; + } + } + break; + + case PVEC_FRAME: + { + mark_vectorlike (ptr); + mark_face_cache (((struct frame *) ptr)->face_cache); + } + break; + + case PVEC_WINDOW: + { + struct window *w = (struct window *) ptr; + + mark_vectorlike (ptr); + /* Mark glyphs for leaf windows. Marking window + matrices is sufficient because frame matrices + use the same glyph memory. */ + if (NILP (w->hchild) && NILP (w->vchild) && w->current_matrix) + { + mark_glyph_matrix (w->current_matrix); + mark_glyph_matrix (w->desired_matrix); + } + } + break; + + case PVEC_HASH_TABLE: + { + struct Lisp_Hash_Table *h = (struct Lisp_Hash_Table *) ptr; + + mark_vectorlike (ptr); + /* If hash table is not weak, mark all keys and values. + For weak tables, mark only the vector. */ + if (NILP (h->weak)) + mark_object (h->key_and_value); + else + VECTOR_MARK (XVECTOR (h->key_and_value)); + } + break; + + case PVEC_CHAR_TABLE: + mark_char_table (ptr); + break; + + case PVEC_BOOL_VECTOR: + /* No Lisp_Objects to mark in a bool vector. */ VECTOR_MARK (ptr); - for (i = 0; i < size; i++) - if (i != COMPILED_CONSTANTS) - mark_object (ptr->contents[i]); - obj = ptr->contents[COMPILED_CONSTANTS]; - goto loop; - } - - else if (pvectype == PVEC_FRAME) - { - mark_vectorlike (ptr); - mark_face_cache (((struct frame *) ptr)->face_cache); - } - - else if (pvectype == PVEC_WINDOW) - { - struct window *w = (struct window *) ptr; - - mark_vectorlike (ptr); - /* Mark glyphs for leaf windows. Marking window - matrices is sufficient because frame matrices - use the same glyph memory. */ - if (NILP (w->hchild) && NILP (w->vchild) && w->current_matrix) - { - mark_glyph_matrix (w->current_matrix); - mark_glyph_matrix (w->desired_matrix); - } - } - - else if (pvectype == PVEC_HASH_TABLE) - { - struct Lisp_Hash_Table *h = (struct Lisp_Hash_Table *) ptr; - - mark_vectorlike (ptr); - /* If hash table is not weak, mark all keys and values. - For weak tables, mark only the vector. */ - if (NILP (h->weak)) - mark_object (h->key_and_value); - else - VECTOR_MARK (XVECTOR (h->key_and_value)); - } - - else if (pvectype == PVEC_CHAR_TABLE) - mark_char_table (ptr); - - else if (pvectype == PVEC_BOOL_VECTOR) - /* No Lisp_Objects to mark in a bool vector. */ - VECTOR_MARK (ptr); - - else if (pvectype != PVEC_SUBR) - mark_vectorlike (ptr); + break; + + case PVEC_SUBR: + break; + + case PVEC_FREE: + abort (); + + default: + mark_vectorlike (ptr); + } } break; === modified file 'src/emacs.c' --- src/emacs.c 2012-06-24 20:22:22 +0000 +++ src/emacs.c 2012-07-04 14:38:02 +0000 @@ -119,7 +119,7 @@ ptrdiff_t gdb_array_mark_flag EXTERNALLY_VISIBLE = ARRAY_MARK_FLAG; /* GDB might say "No enum type named pvec_type" if we don't have at least one symbol with that type, and then xbacktrace could fail. */ -enum pvec_type gdb_pvec_type EXTERNALLY_VISIBLE = PVEC_TYPE_MASK; +ptrdiff_t gdb_pvec_type EXTERNALLY_VISIBLE = PVEC_TYPE_MASK; /* Empty lisp strings. To avoid having to build any others. */ Lisp_Object empty_unibyte_string, empty_multibyte_string; === modified file 'src/fns.c' --- src/fns.c 2012-06-28 07:50:27 +0000 +++ src/fns.c 2012-07-04 14:38:02 +0000 @@ -2095,8 +2095,9 @@ are sensible to compare, so eliminate the others now. */ if (size & PSEUDOVECTOR_FLAG) { - if (!(size & (PVEC_COMPILED - | PVEC_CHAR_TABLE | PVEC_SUB_CHAR_TABLE | PVEC_FONT))) + if (!(size & ((PVEC_COMPILED | PVEC_CHAR_TABLE + | PVEC_SUB_CHAR_TABLE | PVEC_FONT) + << PSEUDOVECTOR_SIZE_BITS))) return 0; size &= PSEUDOVECTOR_SIZE_MASK; } === modified file 'src/lisp.h' --- src/lisp.h 2012-07-03 20:34:47 +0000 +++ src/lisp.h 2012-07-04 14:38:02 +0000 @@ -341,28 +341,26 @@ It is not crucial, but there are plenty of bits here, so why not do it? */ enum pvec_type { - PVEC_NORMAL_VECTOR = 0, - PVEC_PROCESS = 0x200, - PVEC_FRAME = 0x400, - PVEC_COMPILED = 0x800, - PVEC_WINDOW = 0x1000, - PVEC_WINDOW_CONFIGURATION = 0x2000, - PVEC_SUBR = 0x4000, - PVEC_CHAR_TABLE = 0x8000, - PVEC_BOOL_VECTOR = 0x10000, - PVEC_BUFFER = 0x20000, - PVEC_HASH_TABLE = 0x40000, - PVEC_TERMINAL = 0x80000, - PVEC_SUB_CHAR_TABLE = 0x100000, - PVEC_FONT = 0x200000, - PVEC_OTHER = 0x400000, - PVEC_TYPE_MASK = 0x7ffe00 - -#if 0 /* This is used to make the value of PSEUDOVECTOR_FLAG available to - GDB. It doesn't work on OS Alpha. Moved to a variable in - emacs.c. */ - PVEC_FLAG = PSEUDOVECTOR_FLAG -#endif + PVEC_NORMAL_VECTOR = 0, /* Unused! */ + PVEC_FREE, + PVEC_PROCESS, + PVEC_FRAME, + PVEC_WINDOW, + PVEC_BOOL_VECTOR, + PVEC_BUFFER, + PVEC_HASH_TABLE, + PVEC_TERMINAL, + PVEC_WINDOW_CONFIGURATION, + PVEC_SUBR, + PVEC_OTHER, + /* These last 4 are special because we OR them in fns.c:internal_equal, + so they have to use a disjoint bit pattern: + if (!(size & (PVEC_COMPILED | PVEC_CHAR_TABLE + | PVEC_SUB_CHAR_TABLE | PVEC_FONT))) */ + PVEC_COMPILED = 0x10, + PVEC_CHAR_TABLE = 0x20, + PVEC_SUB_CHAR_TABLE = 0x30, + PVEC_FONT = 0x40 }; /* For convenience, we also store the number of elements in these bits. @@ -370,7 +368,9 @@ only the number of Lisp_Object fields (that need to be traced by the GC). The distinction is used e.g. by Lisp_Process which places extra non-Lisp_Object fields at the end of the structure. */ -#define PSEUDOVECTOR_SIZE_MASK 0x1ff +#define PSEUDOVECTOR_SIZE_BITS 16 +#define PSEUDOVECTOR_SIZE_MASK ((1 << PSEUDOVECTOR_SIZE_BITS) - 1) +#define PVEC_TYPE_MASK (0x0fff << PSEUDOVECTOR_SIZE_BITS) /* Number of bits to put in each character in the internal representation of bool vectors. This should not vary across implementations. */ @@ -536,9 +536,11 @@ #define XSETPVECTYPE(v, code) XSETTYPED_PVECTYPE (v, header.size, code) #define XSETTYPED_PVECTYPE(v, size_member, code) \ - ((v)->size_member |= PSEUDOVECTOR_FLAG | (code)) + ((v)->size_member |= PSEUDOVECTOR_FLAG | ((code) << PSEUDOVECTOR_SIZE_BITS)) #define XSETPVECTYPESIZE(v, code, sizeval) \ - ((v)->header.size = PSEUDOVECTOR_FLAG | (code) | (sizeval)) + ((v)->header.size = (PSEUDOVECTOR_FLAG \ + | ((code) << PSEUDOVECTOR_SIZE_BITS) \ + | (sizeval))) /* The cast to struct vectorlike_header * avoids aliasing issues. */ #define XSETPSEUDOVECTOR(a, b, code) \ @@ -550,7 +552,7 @@ #define XSETTYPED_PSEUDOVECTOR(a, b, size, code) \ (XSETVECTOR (a, b), \ eassert ((size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK)) \ - == (PSEUDOVECTOR_FLAG | (code)))) + == (PSEUDOVECTOR_FLAG | (code << PSEUDOVECTOR_SIZE_BITS)))) #define XSETWINDOW_CONFIGURATION(a, b) \ (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION)) @@ -730,13 +732,13 @@ /* Set text properties. */ #define STRING_SET_INTERVALS(STR, INT) (XSTRING (STR)->intervals = (INT)) -/* In a string or vector, the sign bit of the `size' is the gc mark bit */ +/* In a string or vector, the sign bit of the `size' is the gc mark bit. */ struct Lisp_String { ptrdiff_t size; ptrdiff_t size_byte; - INTERVAL intervals; /* text properties in this string */ + INTERVAL intervals; /* Text properties in this string. */ unsigned char *data; }; @@ -749,6 +751,20 @@ . */ struct vectorlike_header { + /* This field contains various pieces of information: + - The MSB (ARRAY_MARK_FLAG) holds the gcmarkbit. + - The next bit (PSEUDOVECTOR_FLAG) indicates whether this is a plain + vector (0) or a pseudovector (1). + - If PSEUDOVECTOR_FLAG is 0, the rest holds the size (number + of slots) of the vector. + - If PSEUDOVECTOR_FLAG is 1, the rest is subdivided into + a "pvec type" tag held in PVEC_TYPE_MASK and a size held in the lowest + PSEUDOVECTOR_SIZE_BITS. That size normally indicates the number of + Lisp_Object slots at the beginning of the object that need to be + traced by the GC, tho some types use it slightly differently. + - E.g. if the pvec type is PVEC_FREE it means this is an unallocated + vector on a free-list and PSEUDOVECTOR_SIZE_BITS indicates its size + in bytes. */ ptrdiff_t size; /* When the vector is allocated from a vector block, NBYTES is used @@ -759,8 +775,17 @@ pointer: this way, one can write P->next.vector instead of ((struct Lisp_Vector *) P->next). */ union { + /* This is only needed for small vectors that are not free because the + `size' field only gives us the number of Lisp_Object slots, whereas we + need to know the total size, including non-Lisp_Object data. + FIXME: figure out a way to store this info elsewhere so we can + finally get rid of this extra word of overhead. */ ptrdiff_t nbytes; struct buffer *buffer; + /* FIXME: This can be removed: For large vectors, this field could be + placed *before* the vector itself. And for small vectors on a free + list, this field could be stored in the vector's bytes, since the + empty vector is handled specially anyway. */ struct Lisp_Vector *vector; } next; }; @@ -775,7 +800,7 @@ of the shortest vector that would hold that struct. */ #define VECSIZE(type) ((sizeof (type) \ - offsetof (struct Lisp_Vector, contents[0]) \ - + sizeof (Lisp_Object) - 1) /* round up */ \ + + sizeof (Lisp_Object) - 1) /* Round up. */ \ / sizeof (Lisp_Object)) /* Like VECSIZE, but used when the pseudo-vector has non-Lisp_Object fields @@ -1617,15 +1642,17 @@ /* True if object X is a pseudovector whose code is CODE. The cast to struct vectorlike_header * avoids aliasing issues. */ #define PSEUDOVECTORP(x, code) \ - TYPED_PSEUDOVECTORP(x, vectorlike_header, code) + TYPED_PSEUDOVECTORP (x, vectorlike_header, code) + +#define PSEUDOVECTOR_TYPEP(v, code) \ + (((v)->size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK)) \ + == (PSEUDOVECTOR_FLAG | ((code) << PSEUDOVECTOR_SIZE_BITS))) /* True if object X, with internal type struct T *, is a pseudovector whose code is CODE. */ #define TYPED_PSEUDOVECTORP(x, t, code) \ (VECTORLIKEP (x) \ - && (((((struct t *) XUNTAG (x, Lisp_Vectorlike))->size \ - & (PSEUDOVECTOR_FLAG | (code)))) \ - == (PSEUDOVECTOR_FLAG | (code)))) + && PSEUDOVECTOR_TYPEP ((struct t *) XUNTAG (x, Lisp_Vectorlike), code)) /* Test for specific pseudovector types. */ #define WINDOW_CONFIGURATIONP(x) PSEUDOVECTORP (x, PVEC_WINDOW_CONFIGURATION) @@ -1818,7 +1845,8 @@ #define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ static DECL_ALIGN (struct Lisp_Subr, sname) = \ - { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \ + { (PVEC_SUBR << PSEUDOVECTOR_SIZE_BITS) \ + | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \ { (Lisp_Object (__cdecl *)(void))fnname }, \ minargs, maxargs, lname, intspec, 0}; \ Lisp_Object fnname @@ -1826,7 +1854,7 @@ #define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ static DECL_ALIGN (struct Lisp_Subr, sname) = \ - { PVEC_SUBR, \ + { PVEC_SUBR << PSEUDOVECTOR_SIZE_BITS, \ { .a ## maxargs = fnname }, \ minargs, maxargs, lname, intspec, 0}; \ Lisp_Object fnname ------------------------------------------------------------ revno: 108860 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-07-04 06:17:38 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/configure' --- autogen/configure 2012-07-01 10:18:49 +0000 +++ autogen/configure 2012-07-04 10:17:38 +0000 @@ -7157,6 +7157,12 @@ nw="$nw -Wsuggest-attribute=const" nw="$nw -Wsuggest-attribute=pure" + # Some loops can't be optimized with -O1, + # so remove -Wunsafe-loop-optimizations. + if echo "$CFLAGS" | $EGREP 'O1' 1>/dev/null; then + nw="$nw -Wunsafe-loop-optimizations" + fi + if test -n "$GCC"; then ------------------------------------------------------------ revno: 108859 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-07-04 01:35:34 -0700 message: Merge from gnulib. * lib/alloca.in.h: New version from gnulib, incorporating: 2012-07-03 alloca: add support for HP NonStop TNS/E native diff: === modified file 'ChangeLog' --- ChangeLog 2012-07-04 08:07:26 +0000 +++ ChangeLog 2012-07-04 08:35:34 +0000 @@ -1,3 +1,9 @@ +2012-07-04 Paul Eggert + + Merge from gnulib. + * lib/alloca.in.h: New version from gnulib, incorporating: + 2012-07-03 alloca: add support for HP NonStop TNS/E native + 2012-07-04 Dmitry Antipov * configure.in: If --enable-gcc-warnings, disable === modified file 'lib/alloca.in.h' --- lib/alloca.in.h 2012-05-26 23:14:36 +0000 +++ lib/alloca.in.h 2012-07-04 08:35:34 +0000 @@ -44,6 +44,13 @@ # define alloca _alloca # elif defined __DECC && defined __VMS # define alloca __ALLOCA +# elif defined __TANDEM && defined _TNS_E_TARGET +# ifdef __cplusplus +extern "C" +# endif +void *_alloca (unsigned short); +# pragma intrinsic (_alloca) +# define alloca _alloca # else # include # ifdef __cplusplus ------------------------------------------------------------ revno: 108858 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-07-04 01:26:20 -0700 message: * doprnt.c (doprnt): Don't assume string length fits in 'int'. Tighten new eassert a bit. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-04 08:07:26 +0000 +++ src/ChangeLog 2012-07-04 08:26:20 +0000 @@ -1,3 +1,8 @@ +2012-07-04 Paul Eggert + + * doprnt.c (doprnt): Don't assume string length fits in 'int'. + Tighten new eassert a bit. + 2012-07-04 Dmitry Antipov Fix compilation with --enable-gcc-warnings and -O1 === modified file 'src/doprnt.c' --- src/doprnt.c 2012-07-04 08:07:26 +0000 +++ src/doprnt.c 2012-07-04 08:26:20 +0000 @@ -135,8 +135,8 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format, const char *format_end, va_list ap) { - const char *fmt = format; /* Pointer into format string */ - register char *bufptr = buffer; /* Pointer into output buffer.. */ + const char *fmt = format; /* Pointer into format string. */ + char *bufptr = buffer; /* Pointer into output buffer. */ /* Use this for sprintf unless we need something really big. */ char tembuf[DBL_MAX_10_EXP + 100]; @@ -150,7 +150,7 @@ /* Buffer we have got with malloc. */ char *big_buffer = NULL; - register int tem = -1; + ptrdiff_t tem = -1; char *string; char fixed_buffer[20]; /* Default buffer for small formatting. */ char *fmtcpy; @@ -368,7 +368,7 @@ /* Copy string into final output, truncating if no room. */ doit: - eassert (tem != -1); + eassert (0 <= tem); /* Coming here means STRING contains ASCII only. */ if (STRING_BYTES_BOUND < tem) error ("Format width or precision too large"); ------------------------------------------------------------ revno: 108857 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2012-07-04 12:07:26 +0400 message: Fix compilation with --enable-gcc-warnings and -O1 optimization level. * configure.in: If --enable-gcc-warnings, disable -Wunsafe-loop-optimizations for -O1 optimization level. * src/doprnt.c (doprnt): Change type of tem to int, initialize to avoid compiler warning. Add eassert. * src/search.c (simple_search): Initialize match_byte to avoid compiler warning. Add eassert. diff: === modified file 'ChangeLog' --- ChangeLog 2012-06-30 21:10:50 +0000 +++ ChangeLog 2012-07-04 08:07:26 +0000 @@ -1,3 +1,8 @@ +2012-07-04 Dmitry Antipov + + * configure.in: If --enable-gcc-warnings, disable + -Wunsafe-loop-optimizations for -O1 optimization level. + 2012-06-30 Glenn Morris * configure.in (standardlisppath): New output variable. === modified file 'configure.in' --- configure.in 2012-06-30 21:10:50 +0000 +++ configure.in 2012-07-04 08:07:26 +0000 @@ -681,6 +681,12 @@ nw="$nw -Wsuggest-attribute=const" nw="$nw -Wsuggest-attribute=pure" + # Some loops can't be optimized with -O1, + # so remove -Wunsafe-loop-optimizations. + if echo "$CFLAGS" | $EGREP 'O1' 1>/dev/null; then + nw="$nw -Wunsafe-loop-optimizations" + fi + gl_MANYWARN_ALL_GCC([ws]) gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw]) for w in $ws; do === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-04 06:15:31 +0000 +++ src/ChangeLog 2012-07-04 08:07:26 +0000 @@ -1,3 +1,12 @@ +2012-07-04 Dmitry Antipov + + Fix compilation with --enable-gcc-warnings and -O1 + optimization level. + * doprnt.c (doprnt): Change type of tem to int, initialize + to avoid compiler warning. Add eassert. + * search.c (simple_search): Initialize match_byte to avoid + compiler warning. Add eassert. + 2012-07-04 Paul Eggert Avoid weird behavior with large horizontal scrolls. === modified file 'src/doprnt.c' --- src/doprnt.c 2012-06-26 02:33:51 +0000 +++ src/doprnt.c 2012-07-04 08:07:26 +0000 @@ -150,7 +150,7 @@ /* Buffer we have got with malloc. */ char *big_buffer = NULL; - register size_t tem; + register int tem = -1; char *string; char fixed_buffer[20]; /* Default buffer for small formatting. */ char *fmtcpy; @@ -368,6 +368,7 @@ /* Copy string into final output, truncating if no room. */ doit: + eassert (tem != -1); /* Coming here means STRING contains ASCII only. */ if (STRING_BYTES_BOUND < tem) error ("Format width or precision too large"); === modified file 'src/search.c' --- src/search.c 2012-06-24 17:39:14 +0000 +++ src/search.c 2012-07-04 08:07:26 +0000 @@ -1451,7 +1451,7 @@ int forward = n > 0; /* Number of buffer bytes matched. Note that this may be different from len_byte in a multibyte buffer. */ - ptrdiff_t match_byte; + ptrdiff_t match_byte = PTRDIFF_MIN; if (lim > pos && multibyte) while (n > 0) @@ -1622,6 +1622,7 @@ stop: if (n == 0) { + eassert (match_byte != PTRDIFF_MIN); if (forward) set_search_regs ((multibyte ? pos_byte : pos) - match_byte, match_byte); else ------------------------------------------------------------ revno: 108856 committer: Paul Eggert branch nick: trunk timestamp: Tue 2012-07-03 23:15:31 -0700 message: Avoid weird behavior with large horizontal scrolls. Without this change, for example, large hscroll values would mess up Emacs's display on Fedora 15 x86, presumably due to overflows in int calculations in the display code. Also, if buffers had long lines, Emacs would freeze. * window.c (HSCROLL_MAX): Reduce to 100000, and make it visible to GDB. (set_window_hscroll): New function, containing the old guts of Fset_window_hscroll. Return the clipped value. (Fset_window_hscroll, Fscroll_left, Fscroll_right): Use it. This avoids the need to check against PTRDIFF_MAX. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-04 05:39:36 +0000 +++ src/ChangeLog 2012-07-04 06:15:31 +0000 @@ -1,5 +1,16 @@ 2012-07-04 Paul Eggert + Avoid weird behavior with large horizontal scrolls. + Without this change, for example, large hscroll values would + mess up Emacs's display on Fedora 15 x86, presumably due to + overflows in int calculations in the display code. + Also, if buffers had long lines, Emacs would freeze. + * window.c (HSCROLL_MAX): Reduce to 100000, and make it visible to GDB. + (set_window_hscroll): New function, containing the old guts of + Fset_window_hscroll. Return the clipped value. + (Fset_window_hscroll, Fscroll_left, Fscroll_right): Use it. + This avoids the need to check against PTRDIFF_MAX. + * buffer.c (Fgenerate_new_buffer_name): Fix sprintf format mismatch. 2012-07-04 Dmitry Antipov === modified file 'src/window.c' --- src/window.c 2012-07-03 18:24:42 +0000 +++ src/window.c 2012-07-04 06:15:31 +0000 @@ -51,6 +51,11 @@ #include "nsterm.h" #endif +/* Horizontal scrolling has problems with large scroll amounts. + It's too slow with long lines, and even with small lines the + display can be messed up. Impose a reasonable maximum. */ +enum { HSCROLL_MAX = 100000 }; + Lisp_Object Qwindowp, Qwindow_live_p; static Lisp_Object Qwindow_configuration_p, Qrecord_window_buffer; static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer; @@ -670,27 +675,35 @@ return make_number (decode_window (window)->hscroll); } +/* Set W's horizontal scroll amount to HSCROLL clipped to a reasonable + range, returning the new amount as a fixnum. */ +static Lisp_Object +set_window_hscroll (struct window *w, EMACS_INT hscroll) +{ + int new_hscroll = clip_to_bounds (0, hscroll, HSCROLL_MAX); + + /* Prevent redisplay shortcuts when changing the hscroll. */ + if (w->hscroll != new_hscroll) + XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; + + w->hscroll = new_hscroll; + return make_number (new_hscroll); +} + DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, doc: /* Set number of columns WINDOW is scrolled from left margin to NCOL. If WINDOW is nil, the selected window is used. -Return NCOL. NCOL should be zero or positive. +Clip the number to a reasonable value if out of range. +Return the new number. NCOL should be zero or positive. Note that if `automatic-hscrolling' is non-nil, you cannot scroll the window so that the location of point moves off-window. */) (Lisp_Object window, Lisp_Object ncol) { struct window *w = decode_window (window); - ptrdiff_t hscroll; CHECK_NUMBER (ncol); - hscroll = clip_to_bounds (0, XINT (ncol), PTRDIFF_MAX); - - /* Prevent redisplay shortcuts when changing the hscroll. */ - if (w->hscroll != hscroll) - XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; - - w->hscroll = hscroll; - return ncol; + return set_window_hscroll (w, XINT (ncol)); } DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, @@ -4850,9 +4863,6 @@ return Qnil; } -/* Scrolling amount must fit in both ptrdiff_t and Emacs fixnum. */ -#define HSCROLL_MAX min (PTRDIFF_MAX, MOST_POSITIVE_FIXNUM) - DEFUN ("scroll-left", Fscroll_left, Sscroll_left, 0, 2, "^P\np", doc: /* Scroll selected window display ARG columns left. Default for ARG is window width minus 2. @@ -4864,16 +4874,11 @@ by this function. This happens in an interactive call. */) (register Lisp_Object arg, Lisp_Object set_minimum) { - Lisp_Object result; - ptrdiff_t hscroll; struct window *w = XWINDOW (selected_window); EMACS_INT requested_arg = (NILP (arg) ? window_body_cols (w) - 2 : XINT (Fprefix_numeric_value (arg))); - ptrdiff_t clipped_arg = - clip_to_bounds (- w->hscroll, requested_arg, HSCROLL_MAX - w->hscroll); - hscroll = w->hscroll + clipped_arg; - result = Fset_window_hscroll (selected_window, make_number (hscroll)); + Lisp_Object result = set_window_hscroll (w, w->hscroll + requested_arg); if (!NILP (set_minimum)) w->min_hscroll = w->hscroll; @@ -4892,16 +4897,11 @@ by this function. This happens in an interactive call. */) (register Lisp_Object arg, Lisp_Object set_minimum) { - Lisp_Object result; - ptrdiff_t hscroll; struct window *w = XWINDOW (selected_window); EMACS_INT requested_arg = (NILP (arg) ? window_body_cols (w) - 2 : XINT (Fprefix_numeric_value (arg))); - ptrdiff_t clipped_arg = - clip_to_bounds (w->hscroll - HSCROLL_MAX, requested_arg, w->hscroll); - hscroll = w->hscroll - clipped_arg; - result = Fset_window_hscroll (selected_window, make_number (hscroll)); + Lisp_Object result = set_window_hscroll (w, w->hscroll - requested_arg); if (!NILP (set_minimum)) w->min_hscroll = w->hscroll;