Using saved parent location: http://bzr.savannah.gnu.org/r/emacs/trunk/ Now on revision 103938. ------------------------------------------------------------ revno: 103938 committer: Glenn Morris branch nick: trunk timestamp: Sat 2011-04-16 19:30:56 -0700 message: * etc/CONTRIBUTE: Recommend bug-gnu-emacs for patches. diff: === modified file 'etc/CONTRIBUTE' --- etc/CONTRIBUTE 2011-01-26 08:36:39 +0000 +++ etc/CONTRIBUTE 2011-04-17 02:30:56 +0000 @@ -73,9 +73,12 @@ can properly evaluate it. When you have all these pieces, bundle them up in a mail message and -send it to bug-gnu-emacs@gnu.org or emacs-devel@gnu.org. - -All subsequent discussion should be sent to the same mailing list. +send it to the developers. Sending it to bug-gnu-emacs@gnu.org +(which is the bug/feature list) is recommended, because that list +is coupled to a tracking system that makes it easier to locate patches. +If your patch is not complete and you think it needs more discussion, +you might want to send it to emacs-devel@gnu.org instead. If you +revise your patch, send it as a followup to the initial topic. ** Description @@ -155,12 +158,12 @@ Discussion about Emacs development takes place on emacs-devel@gnu.org. -Bug reports and feature requests are sent to bug-gnu-emacs@gnu.org. - -You can subscribe to the mailing lists at savannah.gnu.org/projects/emacs. - -You can find the mailing lists archives at lists.gnu.org or gmane.org. - +Bug reports and fixes, feature requests and implementations should be +sent to bug-gnu-emacs@gnu.org, the bug/feature list. This is coupled +to the tracker at http://debbugs.gnu.org . + +You can subscribe to the mailing lists, or see the list archives, +by following links from http://savannah.gnu.org/mail/?group=emacs . ** Document your changes. ------------------------------------------------------------ revno: 103937 committer: Glenn Morris branch nick: trunk timestamp: Sat 2011-04-16 19:11:49 -0700 message: Replace stack-trace-on-error usage in calendar. * lisp/calendar/diary-lib.el (diary-sexp-entry): * lisp/calendar/holidays.el (holiday-sexp): Set debug-on-error rather than the removed stack-trace-on-error. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-04-16 23:30:15 +0000 +++ lisp/ChangeLog 2011-04-17 02:11:49 +0000 @@ -1,3 +1,9 @@ +2011-04-17 Glenn Morris + + * calendar/diary-lib.el (diary-sexp-entry): + * calendar/holidays.el (holiday-sexp): + Set debug-on-error rather than the removed stack-trace-on-error. + 2011-04-16 Glenn Morris * progmodes/f90.el: Use lexical-binding. === modified file 'lisp/calendar/diary-lib.el' --- lisp/calendar/diary-lib.el 2011-02-05 22:30:14 +0000 +++ lisp/calendar/diary-lib.el 2011-04-17 02:11:49 +0000 @@ -1353,7 +1353,7 @@ (defun diary-sexp-entry (sexp entry date) "Process a SEXP diary ENTRY for DATE." (let ((result (if calendar-debug-sexp - (let ((stack-trace-on-error t)) + (let ((debug-on-error t)) (eval (car (read-from-string sexp)))) (condition-case nil (eval (car (read-from-string sexp))) === modified file 'lisp/calendar/holidays.el' --- lisp/calendar/holidays.el 2011-01-25 04:08:28 +0000 +++ lisp/calendar/holidays.el 2011-04-17 02:11:49 +0000 @@ -462,7 +462,7 @@ (sort (dolist (p calendar-holidays res) (if (setq h (if calendar-debug-sexp - (let ((stack-trace-on-error t)) + (let ((debug-on-error t)) (eval p)) (condition-case nil (eval p) ------------------------------------------------------------ revno: 103936 committer: Glenn Morris branch nick: trunk timestamp: Sat 2011-04-16 16:31:57 -0700 message: ChangeLog fix. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-04-16 23:11:35 +0000 +++ src/ChangeLog 2011-04-16 23:31:57 +0000 @@ -534,7 +534,7 @@ (mark_backtrace): Define only if BYTE_MARK_STACK. * xdisp.c (message_enable_multibyte): Now static. - Declare Lisp_Object Q* variables to be 'static' if not exproted. + Declare Lisp_Object Q* variables to be 'static' if not exported. This makes it easier for human readers (and static analyzers) to see whether these variables are used from other modules. * alloc.c, buffer.c, bytecode.c, callint.c, casetab.c, category.c: ------------------------------------------------------------ revno: 103935 committer: Glenn Morris branch nick: trunk timestamp: Sat 2011-04-16 16:30:15 -0700 message: Use lexcical-binding in f90.el. * lisp/progmodes/f90.el: Use lexical-binding. Use utf-8 coding. (f90-get-correct-indent): Remove unnecessary local variable `cont'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-04-16 03:44:06 +0000 +++ lisp/ChangeLog 2011-04-16 23:30:15 +0000 @@ -1,3 +1,8 @@ +2011-04-16 Glenn Morris + + * progmodes/f90.el: Use lexical-binding. + (f90-get-correct-indent): Remove unnecessary local variable `cont'. + 2011-04-15 Stefan Monnier * mail/sendmail.el (mail-mode-map): Use completion-at-point. === modified file 'lisp/progmodes/f90.el' --- lisp/progmodes/f90.el 2011-03-31 07:20:38 +0000 +++ lisp/progmodes/f90.el 2011-04-16 23:30:15 +0000 @@ -2,7 +2,7 @@ ;; Copyright (C) 1995-1997, 2000-2011 Free Software Foundation, Inc. -;; Author: Torbj\"orn Einarsson +;; Author: Torbjörn Einarsson ;; Maintainer: Glenn Morris ;; Keywords: fortran, f90, languages @@ -1355,11 +1355,10 @@ (defun f90-get-correct-indent () "Get correct indent for a line starting with line number. Does not check type and subprogram indentation." - (let ((epnt (line-end-position)) icol cont) + (let ((epnt (line-end-position)) icol) (save-excursion (while (and (f90-previous-statement) - (or (memq (setq cont (f90-present-statement-cont)) - '(middle end)) + (or (memq (f90-present-statement-cont) '(middle end)) (looking-at "[ \t]*[0-9]")))) (setq icol (current-indentation)) (beginning-of-line) @@ -2223,4 +2222,9 @@ (provide 'f90) +;; Local Variables: +;; coding: utf-8 +;; lexical-binding: t +;; End: + ;;; f90.el ends here ------------------------------------------------------------ revno: 103934 [merge] committer: Paul Eggert branch nick: trunk timestamp: Sat 2011-04-16 16:11:35 -0700 message: Static checks with GCC 4.6.0 and non-default toolkits. diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2011-04-06 12:18:10 +0000 +++ lib-src/ChangeLog 2011-04-16 23:11:35 +0000 @@ -1,3 +1,18 @@ +2011-04-16 Paul Eggert + + Static checks with GCC 4.6.0 and non-default toolkits. + + * movemail.c (mail_spool_name): Protoize. + (main): Remove unused var. Mark var as initialized. + Move locals to avoid shadowing, and use time_t for times. + + * fakemail.c (xmalloc, xreallc): Use standard C prototypes + with void *. This avoids warnings about pointer casts. + + * emacsclient.c (main): Don't use uninitialized var. + (IS_ANY_SEP): Remove; unused. + (get_current_dir_name): Add an extern decl. + 2011-04-06 Paul Eggert Fix more problems found by GCC 4.6.0's static checks. === modified file 'lib-src/emacsclient.c' --- lib-src/emacsclient.c 2011-04-05 19:59:58 +0000 +++ lib-src/emacsclient.c 2011-04-16 21:11:28 +0000 @@ -218,10 +218,8 @@ #define IS_DEVICE_SEP(_c_) ((_c_) == DEVICE_SEP) #endif #endif -#ifndef IS_ANY_SEP -#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_)) -#endif +char *get_current_dir_name (void); /* Return the current working directory. Returns NULL on errors. Any other returned value must be freed with free. This is used @@ -1524,7 +1522,7 @@ int main (int argc, char **argv) { - int rl, needlf = 0; + int rl = 0, needlf = 0; char *cwd, *str; char string[BUFSIZ+1]; int null_socket_name IF_LINT ( = 0); === modified file 'lib-src/fakemail.c' --- lib-src/fakemail.c 2011-03-21 05:04:41 +0000 +++ lib-src/fakemail.c 2011-04-16 21:13:07 +0000 @@ -178,20 +178,20 @@ /* Like malloc but get fatal error if memory is exhausted. */ -static long * -xmalloc (int size) +static void * +xmalloc (size_t size) { - long *result = (long *) malloc (((unsigned) size)); - if (result == ((long *) NULL)) + void *result = malloc (size); + if (! result) fatal ("virtual memory exhausted"); return result; } -static long * -xrealloc (long int *ptr, int size) +static void * +xrealloc (void *ptr, size_t size) { - long *result = (long *) realloc (ptr, ((unsigned) size)); - if (result == ((long *) NULL)) + void *result = realloc (ptr, size); + if (! result) fatal ("virtual memory exhausted"); return result; } @@ -221,7 +221,7 @@ if (p == end) { linebuffer->size *= 2; - buffer = ((char *) xrealloc ((long *)buffer, linebuffer->size)); + buffer = (char *) xrealloc (buffer, linebuffer->size); p = buffer + (p - linebuffer->buffer); end = buffer + linebuffer->size; linebuffer->buffer = buffer; === modified file 'lib-src/movemail.c' --- lib-src/movemail.c 2011-02-22 00:11:56 +0000 +++ lib-src/movemail.c 2011-04-16 21:20:25 +0000 @@ -131,7 +131,7 @@ files appear in. */ #ifdef MAILDIR #define MAIL_USE_MAILLOCK -static char *mail_spool_name (); +static char *mail_spool_name (char *); #endif #endif @@ -167,7 +167,6 @@ #ifndef MAIL_USE_SYSTEM_LOCK struct stat st; - long now; int tem; char *lockname, *p; char *tempname; @@ -259,7 +258,13 @@ #ifndef MAIL_USE_SYSTEM_LOCK #ifdef MAIL_USE_MAILLOCK spool_name = mail_spool_name (inname); - if (! spool_name) + if (spool_name) + { +#ifdef lint + lockname = 0; +#endif + } + else #endif { #ifndef DIRECTORY_SEP @@ -336,7 +341,7 @@ by time differences between machines. */ if (stat (lockname, &st) >= 0) { - now = time (0); + time_t now = time (0); if (st.st_ctime < now - 300) unlink (lockname); } @@ -352,7 +357,10 @@ int lockcount = 0; int status = 0; #if defined (MAIL_USE_MAILLOCK) && defined (HAVE_TOUCHLOCK) - time_t touched_lock, now; + time_t touched_lock; +# ifdef lint + touched_lock = 0; +# endif #endif if (setuid (getuid ()) < 0 || setregid (-1, real_gid) < 0) @@ -462,7 +470,7 @@ #if defined (MAIL_USE_MAILLOCK) && defined (HAVE_TOUCHLOCK) if (spool_name) { - now = time (0); + time_t now = time (0); if (now - touched_lock > 60) { touchlock (); === modified file 'lwlib/ChangeLog' --- lwlib/ChangeLog 2011-04-06 12:18:10 +0000 +++ lwlib/ChangeLog 2011-04-16 23:11:35 +0000 @@ -1,3 +1,19 @@ +2011-04-16 Paul Eggert + + Static checks with GCC 4.6.0 and non-default toolkits. + + * lwlib-Xm.c (make_dialog): Rename local to avoid shadowing. + (make_menu_in_widget): Add cast to avoid warning. + * lwlib-utils.c (XtCompositeChildren): Likewise. + + * lwlib.c (EXPLAIN, destroy_one_instance): Avoid "else;". + (first_child) [USE_MOTIF]: Protoize. + + * lwlib-utils.h, lwlib-utils.c (XtSafelyDestroyWidget): Remove; unused. + + * xlwmenu.c (XlwMenuSetValues): Rename/ move locals to avoid shadowing. + (MINL): Define only if not emacs. + 2011-03-07 Chong Yidong * Version 23.3 released. === modified file 'lwlib/lwlib-Xm.c' --- lwlib/lwlib-Xm.c 2011-02-10 05:03:29 +0000 +++ lwlib/lwlib-Xm.c 2011-04-16 21:22:40 +0000 @@ -511,7 +511,7 @@ /* Allocate the children array */ for (num_children = 0, cur = val; cur; num_children++, cur = cur->next) ; - children = (Widget*)XtMalloc (num_children * sizeof (Widget)); + children = (Widget*)(void*)XtMalloc (num_children * sizeof (Widget)); /* WIDGET should be a RowColumn. */ if (!XmIsRowColumn (widget)) @@ -1020,10 +1020,10 @@ { KeySym sym = 0; Modifiers modif_ret; - + XtTranslateKeycode (event->xkey.display, event->xkey.keycode, 0, &modif_ret, &sym); - + if (sym == osfXK_Cancel) { Widget w = *((Widget *) closure); @@ -1055,7 +1055,7 @@ Widget row; Widget icon; Widget icon_separator; - Widget message; + Widget message_label; Widget value = 0; Widget separator; Widget button = 0; @@ -1269,7 +1269,7 @@ XtSetArg(al[ac], XmNleftWidget, icon); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, 13); ac++; - message = XmCreateLabel (form, "message", al, ac); + message_label = XmCreateLabel (form, "message", al, ac); if (list) XtManageChild (value); @@ -1281,7 +1281,7 @@ { children [i] = value; i++; } - children [i] = message; i++; + children [i] = message_label; i++; children [i] = icon; i++; children [i] = icon_separator; i++; XtManageChildren (children, i); === modified file 'lwlib/lwlib-utils.c' --- lwlib/lwlib-utils.c 2011-02-13 02:07:25 +0000 +++ lwlib/lwlib-utils.c 2011-04-16 21:23:30 +0000 @@ -129,7 +129,7 @@ return NULL; } n = cw->composite.num_children; - result = (Widget*)XtMalloc (n * sizeof (Widget)); + result = (Widget*)(void*)XtMalloc (n * sizeof (Widget)); *number = n; for (i = 0; i < n; i++) result [i] = cw->composite.children [i]; @@ -141,29 +141,3 @@ { return widget->core.being_destroyed; } - -void -XtSafelyDestroyWidget (Widget widget) -{ -#if 0 - - /* this requires IntrinsicI.h (actually, InitialI.h) */ - - XtAppContext app = XtWidgetToApplicationContext(widget); - - if (app->dispatch_level == 0) - { - app->dispatch_level = 1; - XtDestroyWidget (widget); - /* generates an event so that the event loop will be called */ - XChangeProperty (XtDisplay (widget), XtWindow (widget), - XA_STRING, XA_STRING, 32, PropModeAppend, NULL, 0); - app->dispatch_level = 0; - } - else - XtDestroyWidget (widget); - -#else - abort (); -#endif -} === modified file 'lwlib/lwlib-utils.h' --- lwlib/lwlib-utils.h 2011-01-15 23:16:57 +0000 +++ lwlib/lwlib-utils.h 2011-04-16 01:41:12 +0000 @@ -15,7 +15,4 @@ Boolean XtWidgetBeingDestroyedP (Widget widget); -void XtSafelyDestroyWidget (Widget); - #endif /* _LWLIB_UTILS_H_ */ - === modified file 'lwlib/lwlib.c' --- lwlib/lwlib.c 2011-02-10 05:03:29 +0000 +++ lwlib/lwlib.c 2011-04-16 16:42:58 +0000 @@ -422,7 +422,7 @@ (nc == STRUCTURAL_CHANGE ? "structural" : "???")))), \ nc, desc, a1, a2) #else -# define EXPLAIN(name, oc, nc, desc, a1, a2) +# define EXPLAIN(name, oc, nc, desc, a1, a2) ((void) 0) #endif @@ -912,8 +912,9 @@ xaw_destroy_instance (instance); else #endif - /* do not remove the empty statement */ - ; + { + /* Empty compound statement to terminate if-then-else chain. */ + } } free_widget_instance (instance); @@ -978,7 +979,7 @@ } #ifdef USE_MOTIF -extern Widget first_child (/* Widget */); /* garbage */ +extern Widget first_child (Widget); /* garbage */ #endif Widget === modified file 'lwlib/xlwmenu.c' --- lwlib/xlwmenu.c 2011-02-14 17:21:10 +0000 +++ lwlib/xlwmenu.c 2011-04-16 01:38:14 +0000 @@ -1220,9 +1220,9 @@ { if (val->enabled) *hit_return = val; - else + else no_return = 1; - if (mw->menu.inside_entry != val) + if (mw->menu.inside_entry != val) { if (mw->menu.inside_entry) XtCallCallbackList ((Widget)mw, mw->menu.leave, @@ -1426,7 +1426,7 @@ static void create_pixmap_for_menu (window_state* ws, XlwMenuWidget mw) { - if (ws->pixmap != None) + if (ws->pixmap != None) { XFreePixmap (XtDisplay (ws->w), ws->pixmap); ws->pixmap = None; @@ -1592,9 +1592,9 @@ } } - if (!inside) + if (!inside) { - if (mw->menu.inside_entry != NULL) + if (mw->menu.inside_entry != NULL) XtCallCallbackList ((Widget)mw, mw->menu.leave, (XtPointer) mw->menu.inside_entry); mw->menu.inside_entry = NULL; @@ -1693,8 +1693,10 @@ mw->menu.background_gc = (GC) -1; } +#ifndef emacs #define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \ ? ((unsigned long) (x)) : ((unsigned long) (y))) +#endif static void make_shadow_gcs (XlwMenuWidget mw) @@ -1881,7 +1883,7 @@ if (!mw->menu.font) { mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen, fname); - if (!mw->menu.xft_font) + if (!mw->menu.xft_font) { fprintf (stderr, "Can't find font '%s'\n", fname); mw->menu.xft_font = getDefaultXftFont (mw); @@ -1930,19 +1932,19 @@ if (!mw->menu.font) { mw->menu.font = XLoadQueryFont (display, "fixed"); - if (!mw->menu.font) + if (!mw->menu.font) { fprintf (stderr, "Menu font fixed not found, can't continue.\n"); abort (); } } } - + #ifdef HAVE_X_I18N if (mw->menu.fontSet) mw->menu.font_extents = XExtentsOfFontSet (mw->menu.fontSet); #endif - + make_drawing_gcs (mw); make_shadow_gcs (mw); @@ -2118,12 +2120,12 @@ XftFontClose (XtDisplay (mw), mw->menu.xft_font); #endif - if (mw->menu.windows [0].pixmap != None) + if (mw->menu.windows [0].pixmap != None) XFreePixmap (XtDisplay (mw), mw->menu.windows [0].pixmap); /* start from 1 because the one in slot 0 is w->core.window */ for (i = 1; i < mw->menu.windows_length; i++) { - if (mw->menu.windows [i].pixmap != None) + if (mw->menu.windows [i].pixmap != None) XFreePixmap (XtDisplay (mw), mw->menu.windows [i].pixmap); #ifdef HAVE_XFT if (mw->menu.windows [i].xft_draw) @@ -2153,18 +2155,17 @@ { XlwMenuWidget oldmw = (XlwMenuWidget)current; XlwMenuWidget newmw = (XlwMenuWidget)new; - Boolean redisplay = False; - int i; + Boolean do_redisplay = False; if (newmw->menu.contents && newmw->menu.contents->contents && newmw->menu.contents->contents->change >= VISIBLE_CHANGE) - redisplay = True; + do_redisplay = True; /* Do redisplay if the contents are entirely eliminated. */ if (newmw->menu.contents && newmw->menu.contents->contents == 0 && newmw->menu.contents->change >= VISIBLE_CHANGE) - redisplay = True; + do_redisplay = True; if (newmw->core.background_pixel != oldmw->core.background_pixel || newmw->menu.foreground != oldmw->menu.foreground @@ -2179,6 +2180,7 @@ #endif ) { + int i; release_drawing_gcs (newmw); make_drawing_gcs (newmw); @@ -2188,7 +2190,7 @@ newmw->menu.bottom_shadow_color = -1; make_shadow_gcs (newmw); - redisplay = True; + do_redisplay = True; if (XtIsRealized (current)) /* If the menu is currently displayed, change the display. */ @@ -2229,12 +2231,12 @@ #ifdef HAVE_X_I18N if (newmw->menu.fontSet != oldmw->menu.fontSet && newmw->menu.fontSet != NULL) { - redisplay = True; + do_redisplay = True; newmw->menu.font_extents = XExtentsOfFontSet (newmw->menu.fontSet); } #endif - return redisplay; + return do_redisplay; } static void === modified file 'oldXMenu/Activate.c' --- oldXMenu/Activate.c 2011-01-25 04:08:28 +0000 +++ oldXMenu/Activate.c 2011-04-16 08:25:42 +0000 @@ -122,7 +122,7 @@ int y_pos, /* Y coordinate of menu position. */ unsigned int event_mask, /* Mouse button event mask. */ char **data, /* Pointer to return data value. */ - void (* help_callback) (char *, int, int)) /* Help callback. */ + void (*help_callback) (char const *, int, int)) /* Help callback. */ { int status; /* X routine call status. */ int orig_x; /* Upper left menu origin X coord. */ === modified file 'oldXMenu/AddPane.c' --- oldXMenu/AddPane.c 2011-01-15 23:16:57 +0000 +++ oldXMenu/AddPane.c 2011-04-16 08:25:42 +0000 @@ -16,14 +16,14 @@ #include "XMenuInt.h" int -XMenuAddPane(Display *display, register XMenu *menu, register char *label, int active) - +XMenuAddPane(Display *display, register XMenu *menu, register char const *label, int active) + /* Menu object to be modified. */ /* Selection label. */ /* Make selection active? */ { register XMPane *pane; /* Newly created pane. */ - register XMSelect *select; /* Initial selection for the new pane. */ + register XMSelect *sel; /* Initial selection for the new pane. */ int label_length; /* Label length in characters. */ int label_width; /* Label width in pixels. */ @@ -44,8 +44,8 @@ _XMErrorCode = XME_CALLOC; return(XM_FAILURE); } - select = (XMSelect *)calloc(1, sizeof(XMSelect)); - if (select == NULL) { + sel = (XMSelect *)calloc(1, sizeof(XMSelect)); + if (sel == NULL) { _XMErrorCode = XME_CALLOC; return(XM_FAILURE); } @@ -62,11 +62,11 @@ * Set up the initial selection. * Values not explicitly set are zeroed by calloc. */ - select->next = select; - select->prev = select; - select->type = SL_HEADER; - select->serial = -1; - select->parent_p = pane; + sel->next = sel; + sel->prev = sel; + sel->type = SL_HEADER; + sel->serial = -1; + sel->parent_p = pane; /* * Fill the XMPane structure. @@ -78,7 +78,7 @@ pane->label = label; pane->label_width = label_width; pane->label_length = label_length; - pane->s_list = select; + pane->s_list = sel; /* * Insert the pane at the end of the pane list. @@ -101,4 +101,3 @@ _XMErrorCode = XME_NO_ERROR; return((menu->p_count - 1)); } - === modified file 'oldXMenu/AddSel.c' --- oldXMenu/AddSel.c 2011-01-15 23:16:57 +0000 +++ oldXMenu/AddSel.c 2011-04-16 08:25:42 +0000 @@ -17,8 +17,8 @@ #include "XMenuInt.h" int -XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char *help) - +XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char const *help) + /* Menu object to be modified. */ /* Pane number to be modified. */ /* Data value. */ @@ -27,7 +27,7 @@ /* Help string */ { register XMPane *pane; /* Pane containing the new selection. */ - register XMSelect *select; /* Newly created selection. */ + register XMSelect *sel; /* Newly created selection. */ int label_length; /* Label lenght in characters. */ @@ -49,8 +49,8 @@ /* * Calloc the XMSelect structure. */ - select = (XMSelect *)calloc(1, sizeof(XMSelect)); - if (select == NULL) { + sel = (XMSelect *)calloc(1, sizeof(XMSelect)); + if (sel == NULL) { _XMErrorCode = XME_CALLOC; return(XM_FAILURE); } @@ -65,27 +65,27 @@ */ if (!strcmp (label, "--") || !strcmp (label, "---")) { - select->type = SEPARATOR; - select->active = 0; + sel->type = SEPARATOR; + sel->active = 0; } else { - select->type = SELECTION; - select->active = active; + sel->type = SELECTION; + sel->active = active; } - select->serial = -1; - select->label = label; - select->label_width = label_width; - select->label_length = label_length; - select->data = data; - select->parent_p = pane; - select->help_string = help; + sel->serial = -1; + sel->label = label; + sel->label_width = label_width; + sel->label_length = label_length; + sel->data = data; + sel->parent_p = pane; + sel->help_string = help; /* * Insert the selection at the end of the selection list. */ - emacs_insque(select, pane->s_list->prev); + emacs_insque(sel, pane->s_list->prev); /* * Update the selection count. @@ -103,4 +103,3 @@ _XMErrorCode = XME_NO_ERROR; return((pane->s_count - 1)); } - === modified file 'oldXMenu/ChangeLog' --- oldXMenu/ChangeLog 2011-04-06 12:18:10 +0000 +++ oldXMenu/ChangeLog 2011-04-16 23:11:35 +0000 @@ -1,3 +1,43 @@ +2011-04-16 Paul Eggert + + Static checks with GCC 4.6.0 and non-default toolkits. + + Modernize to C89, for better static checking. + * Activate.c (XMenuActivate): Callback's first arg is readonly. + * AddPane.c (XMenuAddPane): Label is readonly. Rename local + to avoid shadowing. + * AddSel.c (XMenuAddSelection): Help arg is readonly. Rename local. + * Create.c (atoi, atof): Remove decls; include . + (MAX_INACT_PNUM, TILE_BUF_SIZE): Remove; unused. + (x_get_resource_string): Args are readonly. + (XAllocDisplayColor): colorName is readonly. + (XMenuCreate): def_env is readonly. Remove unused locals. Avoid + "else;". + * Destroy.c (XMenuDestroy): Return void. + * Error.c (XMenuError): Remove const pointer. + * EvHand.c (XMenuEventHandler): Return void. + * FindPane.c, FindSel.c: Include . + * InsPane.c (XMenuInsertPane): Rename local to avoid shadowing. + * InsSel.c (XMenuInsertSelection): Likewise. + * Internal.c (toggle_color, BUFFER_SIZE): Remove; unused. + (_XMErrorList): Now const. + (_XMWinQueInit, _XMRecomputeGlobals, _XMTransToOrigin, _XMRefreshPane): + (_XMRefreshSelection): Return void. + (_XMWinQueFlush, _XMRefreshSelection): Rename locals to avoid + shadowing. + (_XMWinQueFlush): Use stack, not heap. Don't use uninitialized var. + * SetAEQ.c (XMenuSetAEQ): Now returns void. + * SetFrz.c (XMenuSetFreeze): Likewise. + * X10.h (XAssoc): Use void * for generic pointer. + * XDelAssoc.c: Include XMenuInt.h rather than duplicating part of it. + * XDestAssoc.c, XMakeAssoc.c: Likewise. + * XDestAssoc.c (XDestroyAssocTable): Return void. + * XMakeAssoc.c (XMakeAssoc): Use void * for generic pointer. + * XMenu.h, XMenuInt.h: Adjust to signature changes. Use const + for pointers to readonly storage. + * insque.c: Include XMenuInt.h, to check our own signature. + (emacs_insque, emacs_remque): Use void * for generic pointers. + 2011-03-07 Chong Yidong * Version 23.3 released. === modified file 'oldXMenu/Create.c' --- oldXMenu/Create.c 2011-01-25 04:08:28 +0000 +++ oldXMenu/Create.c 2011-04-16 08:25:42 +0000 @@ -31,7 +31,7 @@ #include #include "XMenuInt.h" - +#include #ifdef EMACS_BITMAP_FILES #include "../src/bitmaps/dimple1.xbm" @@ -71,7 +71,6 @@ #define DEF_MENU_STYLE LEFT #define DEF_MENU_MODE BOX #define DEF_INACT_PNUM 3 -#define MAX_INACT_PNUM 4 #define DEF_P_STYLE CENTER @@ -88,16 +87,13 @@ #define XASSOC_TABLE_SIZE 64 -#define TILE_BUF_SIZE 5 - -int atoi(const char *); -double atof(const char *); -char *x_get_resource_string (char *attribute, char *class); +char *x_get_resource_string (char const *, char const *); static Status -XAllocDisplayColor(Display *display, Colormap map, char *colorName, XColor *color, XColor *junk) +XAllocDisplayColor(Display *display, Colormap map, char const *colorName, + XColor *color, XColor *junk) { return (colorName!=0 && XParseColor(display, map, colorName, color) && @@ -106,13 +102,11 @@ XMenu * -XMenuCreate(Display *display, Window parent, register char *def_env) +XMenuCreate(Display *display, Window parent, register char const *def_env) /* ID of previously opened display */ /* Window ID of the menu's parent window. */ /* X Defaults program environment name. */ { - register int i; /* Loop counter. */ - register int j; /* Loop counter. */ register char *def_val; /* X Default value temp variable. */ register XMenu *menu; /* Pointer to the new menu. */ @@ -125,7 +119,7 @@ int reverse; /* Reverse video mode. */ XMStyle p_style; /* Pane display style. */ - char *p_fnt_name; /* Flag font name. */ + char const *p_fnt_name; /* Flag font name. */ XFontStruct *p_fnt_info; /* Flag font structure */ int p_fnt_pad; /* Flag font padding in pixels. */ double p_spread; /* Pane spread in flag height fractions. */ @@ -138,7 +132,7 @@ GC pane_GC; /* Pane graphics context. */ XMStyle s_style; /* Selection display style. */ - char *s_fnt_name; /* Selection font name. */ + char const *s_fnt_name; /* Selection font name. */ XFontStruct *s_fnt_info; /* Selection font structure. */ int s_fnt_pad; /* Selection font padding in pixels. */ int s_fnt_height; /* Selection font character height */ @@ -151,10 +145,8 @@ GC inverse_select_GC; /* GC used for inverse video selection. */ GC inact_GC; /* GC for inactive pane header and */ /* selections. */ - GC inact_GC_noexpose; XColor color_def; /* Temp color definition holder. */ - XColor screen_def; /* Temp screen color definition holder */ XColor p_bdr_color; /* Color of border. */ XColor s_bdr_color; /* Color of highlight. */ XColor p_frg_color; /* Color of pane foreground color. */ @@ -166,17 +158,6 @@ int inact_pnum; /* Inactive background pattern number. */ - Pixel p_bdr_pixel; /* Pane border pixel. */ - Pixel s_bdr_pixel; /* Selection border pixel. */ - Pixel p_frg_pixel; /* Pane foreground pixel. */ - Pixel s_frg_pixel; /* Selection foreground pixel. */ - Pixel bkgnd_pixel; /* Menu background pixel. */ - - int *width, *height; - Pixmap *bitmap; - int *x_hot, *y_hot; - int status; /* Return code from XReadBitmapFile. */ - Pixmap cursor; /* Cursor pixmap holder. */ Pixmap cursor_mask; /* Cursor mask pixmap holder. */ Pixmap stipple_pixmap; /* Stipple mask for half-tone text. */ @@ -282,7 +263,7 @@ &mouse_color, &color_def) ); - else ; + else {} def_val = x_get_resource_string ("menuBackground", "MenuBackground"); if ( @@ -304,7 +285,7 @@ "white", &bkgnd_color, &color_def) ); - else; + else {} def_val = x_get_resource_string ("menuInactivePattern", "MenuInactivePattern"); if (def_val != NULL) { @@ -401,7 +382,7 @@ "black", &s_frg_color, &color_def) ) ; - else ; + else {} def_val = x_get_resource_string ("selectionBorder", "SelectionBorder"); @@ -424,7 +405,7 @@ "black", &s_bdr_color, &color_def) ) ; - else ; + else {} def_val = x_get_resource_string ("selectionBorderWidth", "SelectionBorderWidth"); if (def_val != NULL) s_bdr_width = atoi(def_val); @@ -681,9 +662,6 @@ valuemask |= (GCGraphicsExposures); values->graphics_exposures = False; - inact_GC_noexpose = XCreateGC (display, - root, - valuemask, values); /* @@ -752,4 +730,3 @@ _XMErrorCode = XME_NO_ERROR; return(menu); } - === modified file 'oldXMenu/Destroy.c' --- oldXMenu/Destroy.c 2011-01-15 23:16:57 +0000 +++ oldXMenu/Destroy.c 2011-04-16 08:25:42 +0000 @@ -15,8 +15,9 @@ #include "XMenuInt.h" +void XMenuDestroy(Display *display, register XMenu *menu) - + /* Menu object to destroy. */ { register XMPane *p_ptr; /* Pointer to the current pane. */ @@ -114,4 +115,3 @@ */ free(menu); } - === modified file 'oldXMenu/Error.c' --- oldXMenu/Error.c 2011-01-15 23:16:57 +0000 +++ oldXMenu/Error.c 2011-04-16 08:25:42 +0000 @@ -16,7 +16,7 @@ #include "XMenuInt.h" -char * +char const * XMenuError(void) { static char message[128]; /* Error message buffer. */ @@ -27,4 +27,3 @@ sprintf(message, "Unknown _XMErrorCode: %d", _XMErrorCode); return(message); } - === modified file 'oldXMenu/EvHand.c' --- oldXMenu/EvHand.c 2011-01-15 23:16:57 +0000 +++ oldXMenu/EvHand.c 2011-04-16 08:25:42 +0000 @@ -15,6 +15,7 @@ #include "XMenuInt.h" +void XMenuEventHandler(int (*handler) (XEvent*)) { /* @@ -22,4 +23,3 @@ */ _XMEventHandler = handler; } - === modified file 'oldXMenu/FindPane.c' --- oldXMenu/FindPane.c 2011-01-15 23:16:57 +0000 +++ oldXMenu/FindPane.c 2011-04-16 08:25:42 +0000 @@ -15,6 +15,7 @@ */ #include "XMenuInt.h" +#include int XMenuFindPane(register XMenu *menu, register char *label) @@ -60,4 +61,3 @@ _XMErrorCode = XME_P_NOT_FOUND; return (XM_FAILURE); } - === modified file 'oldXMenu/FindSel.c' --- oldXMenu/FindSel.c 2011-01-25 04:08:28 +0000 +++ oldXMenu/FindSel.c 2011-04-16 08:25:42 +0000 @@ -31,6 +31,7 @@ */ #include "XMenuInt.h" +#include int XMenuFindSelection(register XMenu *menu, int p_num, register char *label) @@ -83,4 +84,3 @@ _XMErrorCode = XME_S_NOT_FOUND; return (XM_FAILURE); } - === modified file 'oldXMenu/InsPane.c' --- oldXMenu/InsPane.c 2011-01-15 23:16:57 +0000 +++ oldXMenu/InsPane.c 2011-04-16 08:25:42 +0000 @@ -26,7 +26,7 @@ { register XMPane *p_ptr; /* XMPane pointer. */ register XMPane *pane; /* Newly created pane. */ - register XMSelect *select; /* Initial selection for the new pane. */ + register XMSelect *sel; /* Initial selection for the new pane. */ int label_length; /* Label length in characters. */ int label_width; /* Label width in pixels. */ @@ -54,8 +54,8 @@ _XMErrorCode = XME_CALLOC; return(XM_FAILURE); } - select = (XMSelect *)calloc(1, sizeof(XMSelect)); - if (select == NULL) { + sel = (XMSelect *)calloc(1, sizeof(XMSelect)); + if (sel == NULL) { _XMErrorCode = XME_CALLOC; return(XM_FAILURE); } @@ -70,11 +70,11 @@ * Set up the initial selection. * Values not explicitly set are zeroed by calloc. */ - select->next = select; - select->prev = select; - select->type = SL_HEADER; - select->serial = -1; - select->parent_p = pane; + sel->next = sel; + sel->prev = sel; + sel->type = SL_HEADER; + sel->serial = -1; + sel->parent_p = pane; /* * Fill the XMPane structure. @@ -85,7 +85,7 @@ pane->label = label; pane->label_width = label_width; pane->label_length = label_length; - pane->s_list = select; + pane->s_list = sel; /* * Insert the pane after the pane with the pane @@ -110,4 +110,3 @@ _XMErrorCode = XME_NO_ERROR; return(p_num); } - === modified file 'oldXMenu/InsSel.c' --- oldXMenu/InsSel.c 2011-01-15 23:16:57 +0000 +++ oldXMenu/InsSel.c 2011-04-16 08:25:42 +0000 @@ -28,7 +28,7 @@ register XMPane *p_ptr; /* XMPane pointer. */ register XMSelect *s_ptr; /* XMSelect pointer. */ - XMSelect *select; /* Newly created selection. */ + XMSelect *sel; /* Newly created selection. */ int label_length; /* Label length in characters. */ int label_width; /* Label width in pixels. */ @@ -57,8 +57,8 @@ /* * Calloc the XMSelect structure. */ - select = (XMSelect *)calloc(1, sizeof(XMSelect)); - if (select == NULL) { + sel = (XMSelect *)calloc(1, sizeof(XMSelect)); + if (sel == NULL) { _XMErrorCode = XME_CALLOC; return(XM_FAILURE); } @@ -75,28 +75,28 @@ */ if (!strcmp (label, "--") || !strcmp (label, "---")) { - select->type = SEPARATOR; - select->active = 0; + sel->type = SEPARATOR; + sel->active = 0; } else { - select->type = SELECTION; - select->active = active; + sel->type = SELECTION; + sel->active = active; } - select->active = active; - select->serial = -1; - select->label = label; - select->label_width = label_width; - select->label_length = label_length; - select->data = data; - select->parent_p = p_ptr; + sel->active = active; + sel->serial = -1; + sel->label = label; + sel->label_width = label_width; + sel->label_length = label_length; + sel->data = data; + sel->parent_p = p_ptr; /* * Insert the selection after the selection with the selection * number one less than the desired number for the new selection. */ - emacs_insque(select, s_ptr); + emacs_insque(sel, s_ptr); /* * Update the selection count. @@ -114,4 +114,3 @@ _XMErrorCode = XME_NO_ERROR; return(s_num); } - === modified file 'oldXMenu/Internal.c' --- oldXMenu/Internal.c 2011-01-25 04:08:28 +0000 +++ oldXMenu/Internal.c 2011-04-16 08:25:42 +0000 @@ -33,17 +33,10 @@ #include "XMenuInt.h" /* - * Toggle color macro. - */ -#define toggle_color(x) \ - ((x) == menu->bkgnd_color ? menu->s_frg_color : menu->bkgnd_color) - -/* * Internal Window creation queue sizes. */ #define S_QUE_SIZE 300 #define P_QUE_SIZE 20 -#define BUFFER_SIZE (S_QUE_SIZE >= P_QUE_SIZE ? S_QUE_SIZE : P_QUE_SIZE) /* @@ -71,7 +64,7 @@ /* * _XMErrorList - Global XMenu error code description strings. */ -char * +char const *const _XMErrorList[XME_CODE_COUNT] = { "No error", /* XME_NO_ERROR */ "Menu not initialized", /* XME_NOT_INIT */ @@ -103,6 +96,7 @@ * _XMWinQueInit - Internal routine to initialize the window * queue. */ +void _XMWinQueInit(void) { /* @@ -138,7 +132,7 @@ */ int _XMWinQueAddPane(register Display *display, register XMenu *menu, register XMPane *p_ptr) - + /* Menu being manipulated. */ /* XMPane being queued. */ { @@ -172,7 +166,7 @@ */ int _XMWinQueAddSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr) - + /* Menu being manipulated. */ /* XMSelection being queued. */ { @@ -205,8 +199,8 @@ * selection window queues. */ int -_XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane *pane, XMSelect *select) - +_XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane *pane, XMSelect *sel) + /* Menu being manipulated. */ /* Current pane. */ { @@ -215,7 +209,8 @@ register XMPane *p_ptr; /* XMPane pointer. */ register XMSelect *s_ptr; /* XMSelect pointer. */ unsigned long valuemask; /* Which attributes to set. */ - XSetWindowAttributes *attributes; /* Attributes to be set. */ + XSetWindowAttributes attributes_buf; /* Attributes to be set. */ + XSetWindowAttributes *attributes = &attributes_buf; /* * If the pane window queue is not empty... @@ -226,7 +221,6 @@ * set up attributes for pane window to be created. */ valuemask = (CWBackPixmap | CWBorderPixel | CWOverrideRedirect); - attributes = (XSetWindowAttributes *)malloc(sizeof(XSetWindowAttributes)); attributes->border_pixel = menu->p_bdr_color; attributes->background_pixmap = menu->inact_pixmap; attributes->override_redirect = True; @@ -415,6 +409,7 @@ * _XMRecomputeGlobals - Internal subroutine to recompute menu wide * global values. */ +void _XMRecomputeGlobals(register Display *display, register XMenu *menu) /*X11 display variable. */ /* Menu object to compute from. */ @@ -681,7 +676,7 @@ */ int _XMRecomputeSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr, register int s_num) - + /* Menu object being recomputed. */ /* Selection pointer. */ /* Selection sequence number. */ @@ -810,6 +805,7 @@ * recomputed before calling this routine or * unpredictable results will follow. */ +void _XMTransToOrigin(Display *display, register XMenu *menu, register XMPane *p_ptr, register XMSelect *s_ptr, int x_pos, int y_pos, int *orig_x, int *orig_y) /* Not used. Included for consistency. */ /* Menu being computed against. */ @@ -870,6 +866,7 @@ * _XMRefreshPane - Internal subroutine to completely refresh * the contents of a pane. */ +void _XMRefreshPane(register Display *display, register XMenu *menu, register XMPane *pane) { register XMSelect *s_list = pane->s_list; @@ -937,34 +934,35 @@ * _XMRefreshSelection - Internal subroutine that refreshes * a single selection window. */ -_XMRefreshSelection(register Display *display, register XMenu *menu, register XMSelect *select) +void +_XMRefreshSelection(register Display *display, register XMenu *menu, register XMSelect *sel) { - register int width = select->window_w; - register int height = select->window_h; + register int width = sel->window_w; + register int height = sel->window_h; register int bdr_width = menu->s_bdr_width; - if (select->type == SEPARATOR) { + if (sel->type == SEPARATOR) { XDrawLine(display, - select->parent_p->window, + sel->parent_p->window, menu->normal_select_GC, - select->window_x, - select->window_y + height / 2, - select->window_x + width, - select->window_y + height / 2); + sel->window_x, + sel->window_y + height / 2, + sel->window_x + width, + sel->window_y + height / 2); } - else if (select->activated) { + else if (sel->activated) { if (menu->menu_mode == INVERT) { XFillRectangle(display, - select->parent_p->window, + sel->parent_p->window, menu->normal_select_GC, - select->window_x, select->window_y, + sel->window_x, sel->window_y, width, height); XDrawString(display, - select->parent_p->window, + sel->parent_p->window, menu->inverse_select_GC, - select->label_x, - select->label_y, - select->label, select->label_length); + sel->label_x, + sel->label_y, + sel->label, sel->label_length); } else { /* @@ -975,42 +973,41 @@ */ XDrawRectangle(display, - select->parent_p->window, + sel->parent_p->window, menu->normal_select_GC, - select->window_x + (bdr_width >> 1), - select->window_y + (bdr_width >> 1 ), + sel->window_x + (bdr_width >> 1), + sel->window_y + (bdr_width >> 1 ), width - bdr_width, height - bdr_width); XDrawString(display, - select->parent_p->window, + sel->parent_p->window, menu->normal_select_GC, - select->label_x, - select->label_y, - select->label, select->label_length); + sel->label_x, + sel->label_y, + sel->label, sel->label_length); } } else { XClearArea(display, - select->parent_p->window, - select->window_x, select->window_y, + sel->parent_p->window, + sel->window_x, sel->window_y, width, height, False); - if (select->active) { + if (sel->active) { XDrawString(display, - select->parent_p->window, + sel->parent_p->window, menu->normal_select_GC, - select->label_x, - select->label_y, - select->label, select->label_length); + sel->label_x, + sel->label_y, + sel->label, sel->label_length); } else { XDrawString(display, - select->parent_p->window, + sel->parent_p->window, menu->inact_GC, - select->label_x, - select->label_y, - select->label, select->label_length); + sel->label_x, + sel->label_y, + sel->label, sel->label_length); } } } - === modified file 'oldXMenu/SetAEQ.c' --- oldXMenu/SetAEQ.c 2011-01-15 23:16:57 +0000 +++ oldXMenu/SetAEQ.c 2011-04-16 08:25:42 +0000 @@ -18,6 +18,7 @@ #include "XMenuInt.h" +void XMenuSetAEQ(register XMenu *menu, register int aeq) /* Menu object to be modified. */ /* AEQ mode? */ @@ -27,4 +28,3 @@ */ menu->aeq = aeq; } - === modified file 'oldXMenu/SetFrz.c' --- oldXMenu/SetFrz.c 2011-01-15 23:16:57 +0000 +++ oldXMenu/SetFrz.c 2011-04-16 08:25:42 +0000 @@ -17,6 +17,7 @@ #include "XMenuInt.h" +void XMenuSetFreeze(register XMenu *menu, register int freeze) /* Menu object to be modified. */ /* Freeze mode? */ @@ -26,4 +27,3 @@ */ menu->freeze = freeze; } - === modified file 'oldXMenu/X10.h' --- oldXMenu/X10.h 2011-01-15 23:16:57 +0000 +++ oldXMenu/X10.h 2011-04-16 08:25:42 +0000 @@ -54,7 +54,7 @@ struct _XAssoc *prev; /* Previous obejct in this bucket. */ Display *display; /* Display which owns the id. */ XID x_id; /* X Window System id. */ - char *data; /* Pointer to untyped memory. */ + void *data; /* Pointer to untyped memory. */ } XAssoc; /* @@ -75,4 +75,3 @@ char *XLookUpAssoc(Display *dpy, XAssocTable *table, XID x_id); #endif /* _X10_H_ */ - === modified file 'oldXMenu/XDelAssoc.c' --- oldXMenu/XDelAssoc.c 2011-01-15 23:16:57 +0000 +++ oldXMenu/XDelAssoc.c 2011-04-16 08:25:42 +0000 @@ -2,15 +2,7 @@ #include "copyright.h" - -#include -#include "X10.h" -struct qelem { - struct qelem *q_forw; - struct qelem *q_back; - char q_data[1]; -}; -void emacs_remque(struct qelem*); +#include "XMenuInt.h" /* * XDeleteAssoc - Delete an association in an XAssocTable keyed on @@ -56,4 +48,3 @@ /* It is apparently not in the table. */ return; } - === modified file 'oldXMenu/XDestAssoc.c' --- oldXMenu/XDestAssoc.c 2011-01-15 23:16:57 +0000 +++ oldXMenu/XDestAssoc.c 2011-04-16 08:25:42 +0000 @@ -2,14 +2,13 @@ #include "copyright.h" - -#include -#include "X10.h" +#include "XMenuInt.h" /* * XDestroyAssocTable - Destroy (free the memory associated with) * an XAssocTable. */ +void XDestroyAssocTable(register XAssocTable *table) { register int i; @@ -35,4 +34,3 @@ /* Free the table. */ free((char *)table); } - === modified file 'oldXMenu/XMakeAssoc.c' --- oldXMenu/XMakeAssoc.c 2011-01-15 23:16:57 +0000 +++ oldXMenu/XMakeAssoc.c 2011-04-16 08:25:42 +0000 @@ -4,22 +4,14 @@ #include -#include +#include "XMenuInt.h" #include -#include "X10.h" #include #ifndef NULL #define NULL 0 #endif -struct qelem { - struct qelem *q_forw; - struct qelem *q_back; - char q_data[1]; -}; -void emacs_insque (struct qelem *elem, struct qelem *prev); - /* * XMakeAssoc - Insert data into an XAssocTable keyed on an XId. * Data is inserted into the table only once. Redundant inserts are @@ -27,7 +19,7 @@ * bucket is sorted (lowest XId to highest XId). */ void -XMakeAssoc(register Display *dpy, register XAssocTable *table, register XID x_id, register caddr_t data) +XMakeAssoc(register Display *dpy, register XAssocTable *table, register XID x_id, register void *data) { int hash; register XAssoc *bucket; @@ -85,4 +77,3 @@ /* Insert the new entry. */ emacs_insque((struct qelem *)new_entry, (struct qelem *)Entry->prev); } - === modified file 'oldXMenu/XMenu.h' --- oldXMenu/XMenu.h 2011-01-15 23:16:57 +0000 +++ oldXMenu/XMenu.h 2011-04-16 08:25:42 +0000 @@ -54,7 +54,7 @@ * XMenu error code and error list definitions. */ extern int _XMErrorCode; -extern char *_XMErrorList[]; +extern char const *const _XMErrorList[]; /* * Define the XMWindow datatypes. @@ -106,7 +106,7 @@ int active; /* Window active? */ int activated; /* Window activated? */ int serial; /* -- Pane serial number. */ - char *label; /* -- Pane label. */ + char const *label; /* -- Pane label. */ int label_width; /* -- Pane label width in pixels. */ int label_length; /* -- Pane label length in chars. */ int label_x; /* -- Pane label X offset. */ @@ -141,7 +141,7 @@ struct _xmwindow *pad_l9; /* ---- */ char *data; /* -- Selection data pointer. */ struct _xmpane *parent_p; /* -- Selection parent pane structure. */ - char *help_string; /* Help string or null. */ + char const *help_string; /* Help string or null. */ } XMSelect; @@ -240,29 +240,29 @@ /* * XMenu library routine declarations. */ -XMenu *XMenuCreate(Display *display, Window parent, register char *def_env); -int XMenuAddPane(Display *display, register XMenu *menu, register char *label, int active); -int XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char *help); -int XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int active); -int XMenuInsertSelection(register XMenu *menu, register int p_num, register int s_num, char *data, char *label, int active); -int XMenuFindPane(register XMenu *menu, register char *label); -int XMenuFindSelection(register XMenu *menu, int p_num, register char *label); -int XMenuChangePane(register XMenu *menu, register int p_num, char *label); -int XMenuChangeSelection(Display *display, register XMenu *menu, register int p_num, register int s_num, char *data, int data_sw, char *label, int label_sw); -int XMenuSetPane(register XMenu *menu, register int p_num, register int active); -int XMenuSetSelection(register XMenu *menu, register int p_num, register int s_num, int active); -int XMenuRecompute(Display *display, register XMenu *menu); -int XMenuEventHandler(int (*handler) (XEvent *)); /* No value actually returned. */ -int XMenuLocate(register Display *display, register XMenu *menu, int p_num, int s_num, int x_pos, int y_pos, int *ul_x, int *ul_y, int *width, int *height); -int XMenuSetFreeze(register XMenu *menu, register int freeze); /* No value actually returned. */ +XMenu *XMenuCreate(Display *display, Window parent, char const *def_env); +int XMenuAddPane(Display *display, XMenu *menu, char const *label, int active); +int XMenuAddSelection(Display *display, XMenu *menu, int p_num, char *data, char *label, int active, char const *help); +int XMenuInsertPane(XMenu *menu, int p_num, char *label, int active); +int XMenuInsertSelection(XMenu *menu, int p_num, int s_num, char *data, char *label, int active); +int XMenuFindPane(XMenu *menu, char *label); +int XMenuFindSelection(XMenu *menu, int p_num, char *label); +int XMenuChangePane(XMenu *menu, int p_num, char *label); +int XMenuChangeSelection(Display *display, XMenu *menu, int p_num, int s_num, char *data, int data_sw, char *label, int label_sw); +int XMenuSetPane(XMenu *menu, int p_num, int active); +int XMenuSetSelection(XMenu *menu, int p_num, int s_num, int active); +int XMenuRecompute(Display *display, XMenu *menu); +void XMenuEventHandler(int (*handler) (XEvent *)); +int XMenuLocate(Display *display, XMenu *menu, int p_num, int s_num, int x_pos, int y_pos, int *ul_x, int *ul_y, int *width, int *height); +void XMenuSetFreeze(XMenu *menu, int freeze); void XMenuActivateSetWaitFunction(Wait_func func, void *data); -int XMenuActivate(Display *display, XMenu *menu, int *p_num, int *s_num, int x_pos, int y_pos, unsigned int event_mask, char **data, void (*help_callback) (char *, int, int)); -char *XMenuPost(register Display *display, register XMenu *menu, register int *p_num, register int *s_num, register int x_pos, register int y_pos, int event_mask); -int XMenuDeletePane(register Display *display, register XMenu *menu, register int p_num); -int XMenuDeleteSelection(register Display *display, register XMenu *menu, register int p_num, register int s_num); -int XMenuDestroy(Display *display, register XMenu *menu); /* No value actually returned. */ -char *XMenuError(void); +int XMenuActivate(Display *display, XMenu *menu, int *p_num, int *s_num, int x_pos, int y_pos, unsigned int event_mask, char **data, void (*help_callback) (char const *, int, int)); +char *XMenuPost(Display *display, XMenu *menu, int *p_num, int *s_num, int x_pos, int y_pos, int event_mask); +int XMenuDeletePane(Display *display, XMenu *menu, int p_num); +int XMenuDeleteSelection(Display *display, XMenu *menu, int p_num, int s_num); +void XMenuDestroy(Display *display, XMenu *menu); +char const *XMenuError(void); +void XMenuSetAEQ(XMenu *menu, int aeq); #endif /* Don't add after this point. */ - === modified file 'oldXMenu/XMenuInt.h' --- oldXMenu/XMenuInt.h 2011-01-15 23:16:57 +0000 +++ oldXMenu/XMenuInt.h 2011-04-16 08:25:42 +0000 @@ -46,18 +46,24 @@ /* * Internal routine declarations. */ -int _XMWinQueInit(void); /* No value actually returned. */ -int _XMWinQueAddPane(register Display *display, register XMenu *menu, register XMPane *p_ptr); -int _XMWinQueAddSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr); -int _XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane *pane, XMSelect *select); -XMPane *_XMGetPanePtr(register XMenu *menu, register int p_num); -XMSelect *_XMGetSelectionPtr(register XMPane *p_ptr, register int s_num); -int _XMRecomputeGlobals(register Display *display, register XMenu *menu); /* No value actually returned. */ -int _XMRecomputePane(register Display *display, register XMenu *menu, register XMPane *p_ptr, register int p_num); -int _XMRecomputeSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr, register int s_num); -int _XMTransToOrigin(Display *display, register XMenu *menu, register XMPane *p_ptr, register XMSelect *s_ptr, int x_pos, int y_pos, int *orig_x, int *orig_y); /* No value actually returned. */ -int _XMRefreshPane(register Display *display, register XMenu *menu, register XMPane *pane); /* No value actually returned. */ +void _XMWinQueInit(void); +int _XMWinQueAddPane(Display *display, XMenu *menu, XMPane *p_ptr); +int _XMWinQueAddSelection(Display *display, XMenu *menu, XMSelect *s_ptr); +int _XMWinQueFlush(Display *display, XMenu *menu, XMPane *pane, XMSelect *select); +XMPane *_XMGetPanePtr(XMenu *menu, int p_num); +XMSelect *_XMGetSelectionPtr(XMPane *p_ptr, int s_num); +void _XMRecomputeGlobals(Display *display, XMenu *menu); +int _XMRecomputePane(Display *display, XMenu *menu, XMPane *p_ptr, int p_num); +int _XMRecomputeSelection(Display *display, XMenu *menu, XMSelect *s_ptr, int s_num); +void _XMTransToOrigin(Display *display, XMenu *menu, XMPane *p_ptr, XMSelect *s_ptr, int x_pos, int y_pos, int *orig_x, int *orig_y); +void _XMRefreshPane(Display *display, XMenu *menu, XMPane *pane); +void _XMRefreshSelection(Display *display, XMenu *menu, XMSelect *select); +void emacs_insque (void *elem, void *prev); +void emacs_remque (void *elem); +void XDeleteAssoc(Display *dpy, XAssocTable *table, XID x_id); +void XDestroyAssocTable(XAssocTable *table); +void XMakeAssoc(Display *dpy, XAssocTable *table, XID x_id, void *data); +void XDeleteAssoc(Display *dpy, XAssocTable *table, XID x_id); #endif /* Don't add stuff after this #endif */ - === modified file 'oldXMenu/insque.c' --- oldXMenu/insque.c 2011-01-25 04:08:28 +0000 +++ oldXMenu/insque.c 2011-04-16 08:25:42 +0000 @@ -19,6 +19,7 @@ their callers have been renamed to emacs_mumble to allow us to include this file in the menu library on all systems. */ +#include "XMenuInt.h" struct qelem { struct qelem *q_forw; @@ -29,8 +30,10 @@ /* Insert ELEM into a doubly-linked list, after PREV. */ void -emacs_insque (struct qelem *elem, struct qelem *prev) +emacs_insque (void *velem, void *vprev) { + struct qelem *elem = velem; + struct qelem *prev = vprev; struct qelem *next = prev->q_forw; prev->q_forw = elem; if (next) @@ -41,8 +44,10 @@ /* Unlink ELEM from the doubly-linked list that it is in. */ -emacs_remque (struct qelem *elem) +void +emacs_remque (void *velem) { + struct qelem *elem = velem; struct qelem *next = elem->q_forw; struct qelem *prev = elem->q_back; if (next) @@ -50,4 +55,3 @@ if (prev) prev->q_forw = next; } - === modified file 'src/ChangeLog' --- src/ChangeLog 2011-04-16 19:16:40 +0000 +++ src/ChangeLog 2011-04-16 23:11:35 +0000 @@ -1,3 +1,107 @@ +2011-04-16 Paul Eggert + + Static checks with GCC 4.6.0 and non-default toolkits. + + * s/sol2-6.h, s/unixware.h (PTY_TTY_NAME_SPRINTF): Protoize decl. + + * process.c (keyboard_bit_set): Define only if SIGIO. + (send_process_trap): Mark it with NO_RETURN if it doesn't return. + (send_process): Repair possible setjmp clobbering. + + * s/usg5-4-common.h (SETUP_SLAVE_PTY): Don't pass extra arg to 'fatal'. + + * eval.c: Include , for vsnprintf on non-GNU/Linux hosts. + + * data.c (arith_error): Mark with NO_RETURN if it doesn't return. + + * alloc.c (bytes_used_when_full, SPARE_MEMORY, BYTES_USED): + Define only if needed. + + * sysdep.c (_FILE_OFFSET_BITS): Make this hack even uglier + by pacifying GCC about it. Maybe it's time to retire it? + * xfaces.c (USG, __TIMEVAL__): Likewise. + + * dispextern.h (struct redisplay_interface): Rename param + to avoid shadowing. + * termhooks.h (struct terminal): Likewise. + * xterm.c (xembed_send_message): Likewise. + + * insdel.c (make_gap_smaller): Define only if + USE_MMAP_FOR_BUFFERS || REL_ALLOC || DOUG_LEA_MALLOC. + + * keyboard.c (read_char): Make a var volatile so longjmp won't clobber + it. + + * emacs.c (MAX_HEAP_BSS_DIFF, my_edata): Move to where they're used, + so that we aren't warned about unused symbols. + + * xfns.c (Fx_file_dialog): Rename local to avoid shadowing. + + * xdisp.c (x_produce_glyphs): Mark var as initialized (Bug#8512). + + * xfns.c (x_real_positions): Mark locals as initialized. + + * xmenu.c (xmenu_show): Don't use uninitialized vars. + + * xterm.c: Fix problems found by static analysis with other toolkits. + (toolkit_scroll_bar_interaction): Define and use only if USE_X_TOOLKIT. + (x_dispatch_event): Declare static if USE_GTK, and + define if USE_GTK || USE_X_TOOLKIT. + (SET_SAVED_BUTTON_EVENT): Define only if USE_X_TOOLKIT || USE_GTK. + * xterm.h (x_dispatch_event): Extern only if USE_X_TOOLKIT. + * xterm.c, xterm.h (x_mouse_leave): Bring this function back, but only if + defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK. + + * xmenu.c (menu_help_callback): Pointer type fixes. + Use const pointers when pointing at readonly data. Avoid pointer + signedness clashes. + (FALSE): Remove unused macro. + (update_frame_menubar): Remove unused decl. + + * xfns.c (Fx_hide_tip): Move locals to avoid shadowing. + + * menu.c (push_submenu_start, push_submenu_end): Do not define unless + USE_X_TOOLKIT || USE_GTK || HAVE_NS || defined HAVE_NTGUI. + (single_menu_item): Rename local to avoid shadowing. + + * keyboard.c (make_lispy_event): Remove unused local var. + + * frame.c, frame.h (x_get_resource_string): Bring this back, but + only if HAVE_X_WINDOWS && !USE_X_TOOLKIT. + + * bitmaps: Change bitmaps from unsigned char back to the X11 + compatible char. Avoid the old compiler warnings about + out-of-range initializers by using, for example, '\xab' rather + than 0xab. + + * xgselect.c (xgselect_initialize): Check vs interface + even if ! (defined (USE_GTK) || defined (HAVE_GCONF)). + + * xmenu.c (xmenu_show): Rename parm to avoid shadowing. + + * xterm.c (x_create_toolkit_scroll_bar): Use const * for pointers + to read-only memory. + + * fns.c (vector): Remove; this old hack is no longer needed. + + * xsmfns.c (create_client_leader_window): Rename shadowing arg. + Remove unused var. + (gdk_x11_set_sm_client_id) [!USE_GTK]: Don't define. + + * xrdb.c (x_load_resources): Omit unused local. + + * xfns.c (free_frame_menubar, atof): Remove duplicate decls. + (x_window): Rename locals to avoid shadowing. + (USG): Use the kludged USG macro, to pacify gcc. + + * xterm.c (x_alloc_nearest_color_for_widget): Remove; unused. + (x_term_init): Remove local to avoid shadowing. + + * xfns.c, xterm.c (_XEditResCheckMessages): Protoize decl. + + * xdisp.c, dispextern.h (set_vertical_scroll_bar): Now extern if + USE_TOOLKIT_SCROLL_BARS && !USE_GTK, as xterm.c needs it then. + 2011-04-16 Eli Zaretskii * gnutls.c (Fgnutls_boot): Don't pass Lisp_Object to `error'. === modified file 'src/alloc.c' --- src/alloc.c 2011-04-14 20:16:48 +0000 +++ src/alloc.c 2011-04-16 21:47:57 +0000 @@ -139,10 +139,6 @@ #endif /* ! defined HAVE_GTK_AND_PTHREAD */ #endif /* ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT */ -/* Value of _bytes_used, when spare_memory was freed. */ - -static __malloc_size_t bytes_used_when_full; - /* Mark, unmark, query mark bit of a Lisp string. S must be a pointer to a struct Lisp_String. */ @@ -198,9 +194,11 @@ static char *spare_memory[7]; +#ifndef SYSTEM_MALLOC /* Amount of spare memory to keep in large reserve block. */ #define SPARE_MEMORY (1 << 14) +#endif /* Number of extra blocks malloc should get when it needs more core. */ @@ -469,13 +467,6 @@ intern ("emergency")); pending_malloc_warning = 0; } - - -#ifdef DOUG_LEA_MALLOC -# define BYTES_USED (mallinfo ().uordblks) -#else -# define BYTES_USED _bytes_used -#endif /* Called if we can't allocate relocatable space for a buffer. */ @@ -1096,8 +1087,18 @@ static void * (*old_realloc_hook) (void *, size_t, const void*); static void (*old_free_hook) (void*, const void*); +#ifdef DOUG_LEA_MALLOC +# define BYTES_USED (mallinfo ().uordblks) +#else +# define BYTES_USED _bytes_used +#endif + static __malloc_size_t bytes_used_when_reconsidered; +/* Value of _bytes_used, when spare_memory was freed. */ + +static __malloc_size_t bytes_used_when_full; + /* This function is used as the hook for free to call. */ static void @@ -3296,7 +3297,7 @@ /* Record the space now used. When it decreases substantially, we can refill the memory reserve. */ -#ifndef SYSTEM_MALLOC +#if !defined SYSTEM_MALLOC && !defined SYNC_INPUT bytes_used_when_full = BYTES_USED; #endif === modified file 'src/bitmaps/cntrpmsk.xbm' --- src/bitmaps/cntrpmsk.xbm 1999-09-29 16:37:29 +0000 +++ src/bitmaps/cntrpmsk.xbm 2011-04-16 08:30:05 +0000 @@ -1,6 +1,6 @@ #define cntr_ptrmsk_width 16 #define cntr_ptrmsk_height 16 -static unsigned char cntr_ptrmsk_bits[] = { - 0xc0, 0x03, 0xc0, 0x03, 0xe0, 0x07, 0xe0, 0x07, 0xf0, 0x0f, 0xf0, 0x0f, - 0xf8, 0x1f, 0xf8, 0x1f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xdc, 0x3b, - 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03}; +static char cntr_ptrmsk_bits[] = { + '\xc0','\x03','\xc0','\x03','\xe0','\x07','\xe0','\x07','\xf0','\x0f','\xf0','\x0f', + '\xf8','\x1f','\xf8','\x1f','\xfc','\x3f','\xfc','\x3f','\xfc','\x3f','\xdc','\x3b', + '\xc0','\x03','\xc0','\x03','\xc0','\x03','\xc0','\x03'}; === modified file 'src/bitmaps/cntrptr.xbm' --- src/bitmaps/cntrptr.xbm 1999-09-29 16:37:29 +0000 +++ src/bitmaps/cntrptr.xbm 2011-04-16 08:30:05 +0000 @@ -2,7 +2,7 @@ #define cntr_ptr_height 16 #define cntr_ptr_x_hot 7 #define cntr_ptr_y_hot 1 -static unsigned char cntr_ptr_bits[] = { - 0x00, 0x00, 0x80, 0x01, 0x80, 0x01, 0xc0, 0x03, 0xc0, 0x03, 0xe0, 0x07, - 0xe0, 0x07, 0xf0, 0x0f, 0xf0, 0x0f, 0x98, 0x19, 0x88, 0x11, 0x80, 0x01, - 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00}; +static char cntr_ptr_bits[] = { + '\x00','\x00','\x80','\x01','\x80','\x01','\xc0','\x03','\xc0','\x03','\xe0','\x07', + '\xe0','\x07','\xf0','\x0f','\xf0','\x0f','\x98','\x19','\x88','\x11','\x80','\x01', + '\x80','\x01','\x80','\x01','\x80','\x01','\x00','\x00'}; === modified file 'src/bitmaps/crosswv.xbm' --- src/bitmaps/crosswv.xbm 1999-09-29 16:37:29 +0000 +++ src/bitmaps/crosswv.xbm 2011-04-16 08:30:05 +0000 @@ -1,6 +1,6 @@ #define cross_weave_width 16 #define cross_weave_height 16 -static unsigned char cross_weave_bits[] = { - 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22, 0x55, 0x55, 0x88, 0x88, - 0x55, 0x55, 0x22, 0x22, 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22, - 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22}; +static char cross_weave_bits[] = { + '\x55','\x55','\x88','\x88','\x55','\x55','\x22','\x22','\x55','\x55','\x88','\x88', + '\x55','\x55','\x22','\x22','\x55','\x55','\x88','\x88','\x55','\x55','\x22','\x22', + '\x55','\x55','\x88','\x88','\x55','\x55','\x22','\x22'}; === modified file 'src/bitmaps/dimple1.xbm' --- src/bitmaps/dimple1.xbm 1999-09-29 16:37:29 +0000 +++ src/bitmaps/dimple1.xbm 2011-04-16 08:30:05 +0000 @@ -1,6 +1,6 @@ #define dimple1_width 16 #define dimple1_height 16 -static unsigned char dimple1_bits[] = { - 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, - 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, - 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00}; +static char dimple1_bits[] = { + '\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00', + '\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00', + '\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00'}; === modified file 'src/bitmaps/dimple3.xbm' --- src/bitmaps/dimple3.xbm 1999-09-29 16:37:29 +0000 +++ src/bitmaps/dimple3.xbm 2011-04-16 08:30:05 +0000 @@ -1,6 +1,6 @@ #define dimple3_width 16 #define dimple3_height 16 -static unsigned char dimple3_bits[] = { - 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static char dimple3_bits[] = { + '\x11','\x11','\x00','\x00','\x00','\x00','\x00','\x00','\x11','\x11','\x00','\x00', + '\x00','\x00','\x00','\x00','\x11','\x11','\x00','\x00','\x00','\x00','\x00','\x00', + '\x11','\x11','\x00','\x00','\x00','\x00','\x00','\x00'}; === modified file 'src/bitmaps/gray.xbm' --- src/bitmaps/gray.xbm 2011-02-06 03:48:28 +0000 +++ src/bitmaps/gray.xbm 2011-04-16 08:30:05 +0000 @@ -1,4 +1,4 @@ #define gray_width 2 #define gray_height 2 static char gray_bits[] = { - 0x01, 0x02}; + '\x01','\x02'}; === modified file 'src/bitmaps/gray1.xbm' --- src/bitmaps/gray1.xbm 1999-09-29 16:37:29 +0000 +++ src/bitmaps/gray1.xbm 2011-04-16 08:30:05 +0000 @@ -1,4 +1,4 @@ #define gray1_width 2 #define gray1_height 2 -static unsigned char gray1_bits[] = { - 0x01, 0x02}; +static char gray1_bits[] = { + '\x01','\x02'}; === modified file 'src/bitmaps/gray3.xbm' --- src/bitmaps/gray3.xbm 1999-09-29 16:37:29 +0000 +++ src/bitmaps/gray3.xbm 2011-04-16 08:30:05 +0000 @@ -1,4 +1,4 @@ #define gray3_width 4 #define gray3_height 4 -static unsigned char gray3_bits[] = { - 0x01, 0x00, 0x04, 0x00}; +static char gray3_bits[] = { + '\x01','\x00','\x04','\x00'}; === modified file 'src/bitmaps/leftpmsk.xbm' --- src/bitmaps/leftpmsk.xbm 1999-09-29 16:37:29 +0000 +++ src/bitmaps/leftpmsk.xbm 2011-04-16 08:30:05 +0000 @@ -1,6 +1,6 @@ #define left_ptrmsk_width 16 #define left_ptrmsk_height 16 -static unsigned char left_ptrmsk_bits[] = { - 0x0c, 0x00, 0x1c, 0x00, 0x3c, 0x00, 0x7c, 0x00, 0xfc, 0x00, 0xfc, 0x01, - 0xfc, 0x03, 0xfc, 0x07, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x01, 0xdc, 0x03, - 0xcc, 0x03, 0x80, 0x07, 0x80, 0x07, 0x00, 0x03}; +static char left_ptrmsk_bits[] = { + '\x0c','\x00','\x1c','\x00','\x3c','\x00','\x7c','\x00','\xfc','\x00','\xfc','\x01', + '\xfc','\x03','\xfc','\x07','\xfc','\x0f','\xfc','\x0f','\xfc','\x01','\xdc','\x03', + '\xcc','\x03','\x80','\x07','\x80','\x07','\x00','\x03'}; === modified file 'src/bitmaps/leftptr.xbm' --- src/bitmaps/leftptr.xbm 1999-09-29 16:37:29 +0000 +++ src/bitmaps/leftptr.xbm 2011-04-16 08:30:05 +0000 @@ -2,7 +2,7 @@ #define left_ptr_height 16 #define left_ptr_x_hot 3 #define left_ptr_y_hot 1 -static unsigned char left_ptr_bits[] = { - 0x00, 0x00, 0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, 0x00, - 0xf8, 0x01, 0xf8, 0x03, 0xf8, 0x07, 0xf8, 0x00, 0xd8, 0x00, 0x88, 0x01, - 0x80, 0x01, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00}; +static char left_ptr_bits[] = { + '\x00','\x00','\x08','\x00','\x18','\x00','\x38','\x00','\x78','\x00','\xf8','\x00', + '\xf8','\x01','\xf8','\x03','\xf8','\x07','\xf8','\x00','\xd8','\x00','\x88','\x01', + '\x80','\x01','\x00','\x03','\x00','\x03','\x00','\x00'}; === modified file 'src/bitmaps/rtpmsk.xbm' --- src/bitmaps/rtpmsk.xbm 1999-09-29 16:37:29 +0000 +++ src/bitmaps/rtpmsk.xbm 2011-04-16 08:30:05 +0000 @@ -1,6 +1,6 @@ #define right_ptrmsk_width 16 #define right_ptrmsk_height 16 -static unsigned char right_ptrmsk_bits[] = { - 0x00, 0x30, 0x00, 0x38, 0x00, 0x3c, 0x00, 0x3e, 0x00, 0x3f, 0x80, 0x3f, - 0xc0, 0x3f, 0xe0, 0x3f, 0xf0, 0x3f, 0xf0, 0x3f, 0x80, 0x3f, 0xc0, 0x3b, - 0xc0, 0x33, 0xe0, 0x01, 0xe0, 0x01, 0xc0, 0x00}; +static char right_ptrmsk_bits[] = { + '\x00','\x30','\x00','\x38','\x00','\x3c','\x00','\x3e','\x00','\x3f','\x80','\x3f', + '\xc0','\x3f','\xe0','\x3f','\xf0','\x3f','\xf0','\x3f','\x80','\x3f','\xc0','\x3b', + '\xc0','\x33','\xe0','\x01','\xe0','\x01','\xc0','\x00'}; === modified file 'src/bitmaps/rtptr.xbm' --- src/bitmaps/rtptr.xbm 1999-09-29 16:37:29 +0000 +++ src/bitmaps/rtptr.xbm 2011-04-16 08:30:05 +0000 @@ -2,7 +2,7 @@ #define right_ptr_height 16 #define right_ptr_x_hot 12 #define right_ptr_y_hot 1 -static unsigned char right_ptr_bits[] = { - 0x00, 0x00, 0x00, 0x10, 0x00, 0x18, 0x00, 0x1c, 0x00, 0x1e, 0x00, 0x1f, - 0x80, 0x1f, 0xc0, 0x1f, 0xe0, 0x1f, 0x00, 0x1f, 0x00, 0x1b, 0x80, 0x11, - 0x80, 0x01, 0xc0, 0x00, 0xc0, 0x00, 0x00, 0x00}; +static char right_ptr_bits[] = { + '\x00','\x00','\x00','\x10','\x00','\x18','\x00','\x1c','\x00','\x1e','\x00','\x1f', + '\x80','\x1f','\xc0','\x1f','\xe0','\x1f','\x00','\x1f','\x00','\x1b','\x80','\x11', + '\x80','\x01','\xc0','\x00','\xc0','\x00','\x00','\x00'}; === modified file 'src/bitmaps/stipple.xbm' --- src/bitmaps/stipple.xbm 1999-09-29 16:37:29 +0000 +++ src/bitmaps/stipple.xbm 2011-04-16 08:30:05 +0000 @@ -1,4 +1,4 @@ #define stipple_width 16 #define stipple_height 4 -static unsigned char stipple_bits[] = { - 0x55, 0x55, 0xee, 0xee, 0x55, 0x55, 0xba, 0xbb}; +static char stipple_bits[] = { + '\x55','\x55','\xee','\xee','\x55','\x55','\xba','\xbb'}; === modified file 'src/data.c' --- src/data.c 2011-04-14 05:04:02 +0000 +++ src/data.c 2011-04-16 21:48:36 +0000 @@ -3305,6 +3305,10 @@ XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1; } +#ifndef FORWARD_SIGNAL_TO_MAIN_THREAD +static void arith_error (int) NO_RETURN; +#endif + static void arith_error (int signo) { === modified file 'src/dispextern.h' --- src/dispextern.h 2011-04-14 03:01:10 +0000 +++ src/dispextern.h 2011-04-16 21:24:54 +0000 @@ -2650,9 +2650,9 @@ int cursor_type, int cursor_width, int on_p, int active_p); -/* Draw vertical border for window W from (X,Y0) to (X,Y1). */ +/* Draw vertical border for window W from (X,Y_0) to (X,Y_1). */ void (*draw_vertical_window_border) (struct window *w, - int x, int y0, int y1); + int x, int y_0, int y_1); /* Shift display of frame F to make room for inserted glyphs. The area at pixel (X,Y) of width WIDTH and height HEIGHT is @@ -2953,6 +2953,9 @@ int display_prop_intangible_p (Lisp_Object); void resize_echo_area_exactly (void); int resize_mini_window (struct window *, int); +#if defined USE_TOOLKIT_SCROLL_BARS && !defined USE_GTK +void set_vertical_scroll_bar (struct window *); +#endif int try_window (Lisp_Object, struct text_pos, int); void window_box (struct window *, int, int *, int *, int *, int *); int window_box_height (struct window *); === modified file 'src/emacs.c' --- src/emacs.c 2011-04-14 05:04:02 +0000 +++ src/emacs.c 2011-04-16 20:21:26 +0000 @@ -164,10 +164,6 @@ /* The gap between BSS end and heap start as far as we can tell. */ static unsigned long heap_bss_diff; -/* If the gap between BSS end and heap start is larger than this - output a warning in dump-emacs. */ -#define MAX_HEAP_BSS_DIFF (1024*1024) - /* Nonzero means running Emacs without interactive terminal. */ int noninteractive; @@ -2100,7 +2096,6 @@ You must run Emacs in batch mode in order to dump it. */) (Lisp_Object filename, Lisp_Object symfile) { - extern char my_edata[]; Lisp_Object tem; Lisp_Object symbol; int count = SPECPDL_INDEX (); @@ -2111,6 +2106,10 @@ error ("Dumping Emacs works only in batch mode"); #ifdef GNU_LINUX + + /* Warn if the gap between BSS end and heap start is larger than this. */ +# define MAX_HEAP_BSS_DIFF (1024*1024) + if (heap_bss_diff > MAX_HEAP_BSS_DIFF) { fprintf (stderr, "**************************************************\n"); @@ -2157,7 +2156,10 @@ #ifndef WINDOWSNT /* On Windows, this was done before dumping, and that once suffices. Meanwhile, my_edata is not valid on Windows. */ - memory_warnings (my_edata, malloc_warning); + { + extern char my_edata[]; + memory_warnings (my_edata, malloc_warning); + } #endif /* not WINDOWSNT */ #if defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT /* Pthread may call malloc before main, and then we will get an endless === modified file 'src/eval.c' --- src/eval.c 2011-04-14 19:34:42 +0000 +++ src/eval.c 2011-04-16 21:50:01 +0000 @@ -20,6 +20,7 @@ #include #include #include +#include #include "lisp.h" #include "blockinput.h" #include "commands.h" === modified file 'src/fns.c' --- src/fns.c 2011-04-14 05:04:02 +0000 +++ src/fns.c 2011-04-16 03:13:28 +0000 @@ -23,11 +23,6 @@ #include #include -/* Note on some machines this defines `vector' as a typedef, - so make sure we don't use that name in this file. */ -#undef vector -#define vector ***** - #include "lisp.h" #include "commands.h" #include "character.h" === modified file 'src/frame.c' --- src/frame.c 2011-04-14 05:04:02 +0000 +++ src/frame.c 2011-04-16 08:36:41 +0000 @@ -3845,6 +3845,31 @@ attribute, class, component, subclass); } +#if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT +/* Used when C code wants a resource value. */ +/* Called from oldXMenu/Create.c. */ +char * +x_get_resource_string (const char *attribute, const char *class) +{ + char *name_key; + char *class_key; + struct frame *sf = SELECTED_FRAME (); + + /* Allocate space for the components, the dots which separate them, + and the final '\0'. */ + name_key = (char *) alloca (SBYTES (Vinvocation_name) + + strlen (attribute) + 2); + class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) + + strlen (class) + 2); + + sprintf (name_key, "%s.%s", SSDATA (Vinvocation_name), attribute); + sprintf (class_key, "%s.%s", EMACS_CLASS, class); + + return x_get_string_resource (FRAME_X_DISPLAY_INFO (sf)->xrdb, + name_key, class_key); +} +#endif + /* Return the value of parameter PARAM. First search ALIST, then Vdefault_frame_alist, then the X defaults === modified file 'src/frame.h' --- src/frame.h 2011-04-13 23:35:33 +0000 +++ src/frame.h 2011-04-16 08:36:41 +0000 @@ -1133,6 +1133,10 @@ Lisp_Object component, Lisp_Object subclass); +#if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT +extern char *x_get_resource_string (const char *, const char *); +#endif + /* In xmenu.c */ extern void set_frame_menubar (FRAME_PTR, int, int); === modified file 'src/insdel.c' --- src/insdel.c 2011-04-14 19:34:42 +0000 +++ src/insdel.c 2011-04-16 20:32:18 +0000 @@ -442,6 +442,7 @@ Vinhibit_quit = tem; } +#if defined USE_MMAP_FOR_BUFFERS || defined REL_ALLOC || defined DOUG_LEA_MALLOC /* Make the gap NBYTES_REMOVED bytes shorter. */ @@ -501,6 +502,8 @@ Vinhibit_quit = tem; } +#endif /* USE_MMAP_FOR_BUFFERS || REL_ALLOC || DOUG_LEA_MALLOC */ + void make_gap (EMACS_INT nbytes_added) { === modified file 'src/keyboard.c' --- src/keyboard.c 2011-04-15 02:03:43 +0000 +++ src/keyboard.c 2011-04-16 20:27:04 +0000 @@ -2259,7 +2259,7 @@ volatile Lisp_Object also_record; volatile int reread; struct gcpro gcpro1, gcpro2; - int polling_stopped_here = 0; + int volatile polling_stopped_here = 0; struct kboard *orig_kboard = current_kboard; also_record = Qnil; @@ -5455,7 +5455,6 @@ && (event->modifiers & down_modifier)) { Lisp_Object items, item; - int i; /* Find the menu bar item under `column'. */ item = Qnil; === modified file 'src/menu.c' --- src/menu.c 2011-04-14 05:04:02 +0000 +++ src/menu.c 2011-04-16 15:11:41 +0000 @@ -180,6 +180,9 @@ menu_items = larger_vector (menu_items, menu_items_allocated, Qnil); } +#if (defined USE_X_TOOLKIT || defined USE_GTK || defined HAVE_NS \ + || defined HAVE_NTGUI) + /* Begin a submenu. */ static void @@ -204,6 +207,8 @@ menu_items_submenu_depth--; } +#endif /* USE_X_TOOLKIT || USE_GTK || HAVE_NS || defined HAVE_NTGUI */ + /* Indicate boundary between left and right. */ static void @@ -368,34 +373,34 @@ if (skp->notbuttons) /* The first button. Line up previous items in this menu. */ { - int index = skp->notbuttons; /* Index for first item this menu. */ + int idx = skp->notbuttons; /* Index for first item this menu. */ int submenu = 0; Lisp_Object tem; - while (index < menu_items_used) + while (idx < menu_items_used) { tem - = XVECTOR (menu_items)->contents[index + MENU_ITEMS_ITEM_NAME]; + = XVECTOR (menu_items)->contents[idx + MENU_ITEMS_ITEM_NAME]; if (NILP (tem)) { - index++; + idx++; submenu++; /* Skip sub menu. */ } else if (EQ (tem, Qlambda)) { - index++; + idx++; submenu--; /* End sub menu. */ } else if (EQ (tem, Qt)) - index += 3; /* Skip new pane marker. */ + idx += 3; /* Skip new pane marker. */ else if (EQ (tem, Qquote)) - index++; /* Skip a left, right divider. */ + idx++; /* Skip a left, right divider. */ else { if (!submenu && SREF (tem, 0) != '\0' && SREF (tem, 0) != '-') - XVECTOR (menu_items)->contents[index + MENU_ITEMS_ITEM_NAME] + XVECTOR (menu_items)->contents[idx + MENU_ITEMS_ITEM_NAME] = concat2 (build_string (" "), tem); - index += MENU_ITEMS_ITEM_LENGTH; + idx += MENU_ITEMS_ITEM_LENGTH; } } skp->notbuttons = 0; === modified file 'src/process.c' --- src/process.c 2011-04-15 08:35:53 +0000 +++ src/process.c 2011-04-16 22:04:41 +0000 @@ -237,7 +237,9 @@ static Lisp_Object Fget_process (Lisp_Object); static void create_process (Lisp_Object, char **, Lisp_Object); +#ifdef SIGIO static int keyboard_bit_set (SELECT_TYPE *); +#endif static void deactivate_process (Lisp_Object); static void status_notify (struct Lisp_Process *); static int read_process_output (Lisp_Object, int); @@ -5220,6 +5222,10 @@ static jmp_buf send_process_frame; static Lisp_Object process_sent_to; +#ifndef FORWARD_SIGNAL_TO_MAIN_THREAD +static void send_process_trap (int) NO_RETURN; +#endif + static void send_process_trap (int ignore) { @@ -5360,6 +5366,8 @@ when returning with longjmp despite being declared volatile. */ if (!setjmp (send_process_frame)) { + p = XPROCESS (proc); /* Repair any setjmp clobbering. */ + process_sent_to = proc; while (len > 0) { @@ -6583,6 +6591,8 @@ delete_keyboard_wait_descriptor (desc); } +# ifdef SIGIO + /* Return nonzero if *MASK has a bit set that corresponds to one of the keyboard input descriptors. */ @@ -6598,6 +6608,7 @@ return 0; } +# endif #else /* not subprocesses */ === modified file 'src/s/sol2-6.h' --- src/s/sol2-6.h 2011-01-25 04:08:28 +0000 +++ src/s/sol2-6.h 2011-04-16 22:06:00 +0000 @@ -44,7 +44,7 @@ #define PTY_TTY_NAME_SPRINTF \ { \ - char *ptsname (), *ptyname; \ + char *ptsname (int), *ptyname; \ \ sigblock (sigmask (SIGCLD)); \ if (grantpt (fd) == -1) \ @@ -60,4 +60,3 @@ #define GC_SETJMP_WORKS 1 #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS - === modified file 'src/s/unixware.h' --- src/s/unixware.h 2011-02-16 01:35:20 +0000 +++ src/s/unixware.h 2011-04-16 22:06:00 +0000 @@ -35,7 +35,7 @@ within, it should be caught after sigrelse(2). */ #define PTY_TTY_NAME_SPRINTF \ { \ - char *ptsname(), *ptyname; \ + char *ptsname (int), *ptyname; \ \ sigblock(sigmask(SIGCLD)); \ if (grantpt(fd) == -1) \ === modified file 'src/s/usg5-4-common.h' --- src/s/usg5-4-common.h 2011-03-27 02:27:11 +0000 +++ src/s/usg5-4-common.h 2011-04-16 21:57:28 +0000 @@ -88,11 +88,11 @@ /* Push various streams modules onto a PTY channel. */ #define SETUP_SLAVE_PTY \ if (ioctl (xforkin, I_PUSH, "ptem") == -1) \ - fatal ("ioctl I_PUSH ptem", errno); \ + fatal ("ioctl I_PUSH ptem"); \ if (ioctl (xforkin, I_PUSH, "ldterm") == -1) \ - fatal ("ioctl I_PUSH ldterm", errno); \ + fatal ("ioctl I_PUSH ldterm"); \ if (ioctl (xforkin, I_PUSH, "ttcompat") == -1) \ - fatal ("ioctl I_PUSH ttcompat", errno); + fatal ("ioctl I_PUSH ttcompat"); /* This definition was suggested for next release. So give it a try. */ #define HAVE_SOCKETS === modified file 'src/sysdep.c' --- src/sysdep.c 2011-04-15 10:23:56 +0000 +++ src/sysdep.c 2011-04-16 21:26:33 +0000 @@ -2966,6 +2966,8 @@ #if PROCFS_FILE_OFFSET_BITS_HACK == 1 #define _FILE_OFFSET_BITS 64 +#ifdef _FILE_OFFSET_BITS /* Avoid unused-macro warnings. */ +#endif #endif /* PROCFS_FILE_OFFSET_BITS_HACK == 1 */ Lisp_Object === modified file 'src/termhooks.h' --- src/termhooks.h 2011-04-14 02:52:33 +0000 +++ src/termhooks.h 2011-04-16 21:27:29 +0000 @@ -465,7 +465,7 @@ enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, - unsigned long *time); + unsigned long *); /* The window system handling code should set this if the mouse has moved since the last call to the mouse_position_hook. Calling that @@ -484,10 +484,10 @@ support overlapping frames, so there's no need to raise or lower anything. - If RAISE is non-zero, F is brought to the front, before all other - windows. If RAISE is zero, F is sent to the back, behind all other + If RAISE_FLAG is non-zero, F is brought to the front, before all other + windows. If RAISE_FLAG is zero, F is sent to the back, behind all other windows. */ - void (*frame_raise_lower_hook) (struct frame *f, int raise); + void (*frame_raise_lower_hook) (struct frame *f, int raise_flag); /* If the value of the frame parameter changed, whis hook is called. For example, if going from fullscreen to not fullscreen this hook === modified file 'src/xdisp.c' --- src/xdisp.c 2011-04-14 20:16:48 +0000 +++ src/xdisp.c 2011-04-16 22:48:31 +0000 @@ -13630,7 +13630,10 @@ return rc; } -static void +#if !defined USE_TOOLKIT_SCROLL_BARS || defined USE_GTK +static +#endif +void set_vertical_scroll_bar (struct window *w) { EMACS_INT start, end, whole; @@ -22709,7 +22712,7 @@ int lbearing, rbearing; int i, width, ascent, descent; int left_padded = 0, right_padded = 0; - int c; + int c IF_LINT (= 0); /* cmp->glyph_len can't be zero; see Bug#8512 */ XChar2b char2b; struct font_metrics *pcm; int font_not_found_p; === modified file 'src/xfaces.c' --- src/xfaces.c 2011-04-15 02:03:43 +0000 +++ src/xfaces.c 2011-04-16 21:28:14 +0000 @@ -273,6 +273,8 @@ #include #define USG #define __TIMEVAL__ +#if defined USG || defined __TIMEVAL__ /* Don't warn about unused macros. */ +#endif #else /* not XOS_NEEDS_TIME_H */ #include #endif /* not XOS_NEEDS_TIME_H */ === modified file 'src/xfns.c' --- src/xfns.c 2011-04-14 20:16:48 +0000 +++ src/xfns.c 2011-04-16 20:07:17 +0000 @@ -83,6 +83,8 @@ #undef USG /* ####KLUDGE for Solaris 2.2 and up */ #include #define USG +#ifdef USG /* Pacify gcc -Wunused-macros. */ +#endif #else #include #endif @@ -105,16 +107,13 @@ #if !defined(NO_EDITRES) #define HACK_EDITRES -extern void _XEditResCheckMessages (); +extern void _XEditResCheckMessages (Widget, XtPointer, XEvent *, Boolean *); #endif /* not defined NO_EDITRES */ /* Unique id counter for widgets created by the Lucid Widget Library. */ extern LWLIB_ID widget_id_tick; -extern void free_frame_menubar (); -extern double atof (); - #ifdef USE_MOTIF #endif /* USE_MOTIF */ @@ -428,7 +427,7 @@ void x_real_positions (FRAME_PTR f, int *xptr, int *yptr) { - int win_x, win_y, outer_x, outer_y; + int win_x, win_y, outer_x IF_LINT (= 0), outer_y IF_LINT (= 0); int real_x = 0, real_y = 0; int had_errors = 0; Window win = f->output_data.x->parent_desc; @@ -2430,8 +2429,8 @@ { int len; char *tem, shell_position[32]; - Arg al[10]; - int ac = 0; + Arg gal[10]; + int gac = 0; int extra_borders = 0; int menubar_size = (f->output_data.x->menubar_widget @@ -2492,8 +2491,8 @@ If Emacs had just one program position, we could set it in fallback resources, but since each make-frame call can specify different program positions, this is easier. */ - XtSetArg (al[ac], XtNx, left); ac++; - XtSetArg (al[ac], XtNy, top); ac++; + XtSetArg (gal[gac], XtNx, left); gac++; + XtSetArg (gal[gac], XtNy, top); gac++; } } @@ -2504,8 +2503,8 @@ when the frame is deleted. */ tem = (char *) xmalloc (len); strncpy (tem, shell_position, len); - XtSetArg (al[ac], XtNgeometry, tem); ac++; - XtSetValues (shell_widget, al, ac); + XtSetArg (gal[gac], XtNgeometry, tem); gac++; + XtSetValues (shell_widget, gal, gac); } XtManageChild (pane_widget); @@ -5206,7 +5205,6 @@ int count; Lisp_Object deleted, frame, timer; struct gcpro gcpro1, gcpro2; - struct frame *f; /* Return quickly if nothing to do. */ if (NILP (tip_timer) && NILP (tip_frame)) @@ -5225,11 +5223,13 @@ call1 (Qcancel_timer, timer); #ifdef USE_GTK - /* When using system tooltip, tip_frame is the Emacs frame on which - the tip is shown. */ - f = XFRAME (frame); - if (FRAME_LIVE_P (f) && xg_hide_tooltip (f)) - frame = Qnil; + { + /* When using system tooltip, tip_frame is the Emacs frame on which + the tip is shown. */ + struct frame *f = XFRAME (frame); + if (FRAME_LIVE_P (f) && xg_hide_tooltip (f)) + frame = Qnil; + } #endif if (FRAMEP (frame)) @@ -5243,7 +5243,7 @@ items is unmapped. Redisplay the menu manually... */ { Widget w; - f = SELECTED_FRAME (); + struct frame *f = SELECTED_FRAME (); w = f->output_data.x->menubar_widget; if (!DoesSaveUnders (FRAME_X_DISPLAY_INFO (f)->screen) @@ -5462,12 +5462,12 @@ /* Get the result. */ if (result == XmCR_OK) { - XmString text; + XmString text_string; String data; - XtVaGetValues (dialog, XmNtextString, &text, NULL); - XmStringGetLtoR (text, XmFONTLIST_DEFAULT_TAG, &data); - XmStringFree (text); + XtVaGetValues (dialog, XmNtextString, &text_string, NULL); + XmStringGetLtoR (text_string, XmFONTLIST_DEFAULT_TAG, &data); + XmStringFree (text_string); file = build_string (data); XtFree (data); } === modified file 'src/xgselect.c' --- src/xgselect.c 2011-03-13 08:05:40 +0000 +++ src/xgselect.c 2011-04-16 07:57:31 +0000 @@ -19,11 +19,14 @@ #include +#include +#include "xgselect.h" + #if defined (USE_GTK) || defined (HAVE_GCONF) + #include #include #include -#include "xgselect.h" static GPollFD *gfds; static int gfds_size; === modified file 'src/xmenu.c' --- src/xmenu.c 2011-04-14 05:04:02 +0000 +++ src/xmenu.c 2011-04-16 15:38:15 +0000 @@ -108,7 +108,6 @@ #ifndef TRUE #define TRUE 1 -#define FALSE 0 #endif /* no TRUE */ static Lisp_Object Qdebug_on_next_call; @@ -117,8 +116,6 @@ static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object, const char **); #endif - -static int update_frame_menubar (struct frame *); /* Flag which when set indicates a dialog or menu has been posted by Xt on behalf of one of the widget sets. */ @@ -2185,7 +2182,7 @@ keyboard events. */ static void -menu_help_callback (char *help_string, int pane, int item) +menu_help_callback (char const *help_string, int pane, int item) { Lisp_Object *first_item; Lisp_Object pane_name; @@ -2245,7 +2242,7 @@ Lisp_Object xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, - Lisp_Object title, const char **error, EMACS_UINT timestamp) + Lisp_Object title, const char **error_name, EMACS_UINT timestamp) { Window root; XMenu *menu; @@ -2263,13 +2260,13 @@ if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f)) abort (); - *error = 0; + *error_name = 0; if (menu_items_n_panes == 0) return Qnil; if (menu_items_used <= MENU_ITEMS_PANE_LENGTH) { - *error = "Empty menu"; + *error_name = "Empty menu"; return Qnil; } @@ -2282,7 +2279,7 @@ menu = XMenuCreate (FRAME_X_DISPLAY (f), root, "emacs"); if (menu == NULL) { - *error = "Can't create menu"; + *error_name = "Can't create menu"; return Qnil; } @@ -2302,7 +2299,8 @@ y += f->top_pos; /* Create all the necessary panes and their items. */ - maxlines = lines = i = 0; + maxwidth = maxlines = lines = i = 0; + lpane = XM_FAILURE; while (i < menu_items_used) { if (EQ (XVECTOR (menu_items)->contents[i], Qt)) @@ -2324,13 +2322,12 @@ if (lpane == XM_FAILURE) { XMenuDestroy (FRAME_X_DISPLAY (f), menu); - *error = "Can't create pane"; + *error_name = "Can't create pane"; return Qnil; } i += MENU_ITEMS_PANE_LENGTH; /* Find the width of the widest item in this pane. */ - maxwidth = 0; j = i; while (j < menu_items_used) { @@ -2358,40 +2355,38 @@ { /* Create a new item within current pane. */ Lisp_Object item_name, enable, descrip, help; - unsigned char *item_data; - char *help_string; + char *item_data; + char const *help_string; item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME]; enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; descrip = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP]; - help_string = STRINGP (help) ? SDATA (help) : NULL; + help_string = STRINGP (help) ? SSDATA (help) : NULL; if (!NILP (descrip)) { - int gap = maxwidth - SBYTES (item_name); /* if alloca is fast, use that to make the space, to reduce gc needs. */ - item_data - = (unsigned char *) alloca (maxwidth - + SBYTES (descrip) + 1); - memcpy (item_data, SDATA (item_name), SBYTES (item_name)); + item_data = (char *) alloca (maxwidth + SBYTES (descrip) + 1); + memcpy (item_data, SSDATA (item_name), SBYTES (item_name)); for (j = SCHARS (item_name); j < maxwidth; j++) item_data[j] = ' '; - memcpy (item_data + j, SDATA (descrip), SBYTES (descrip)); + memcpy (item_data + j, SSDATA (descrip), SBYTES (descrip)); item_data[j + SBYTES (descrip)] = 0; } else - item_data = SDATA (item_name); + item_data = SSDATA (item_name); - if (XMenuAddSelection (FRAME_X_DISPLAY (f), - menu, lpane, 0, item_data, - !NILP (enable), help_string) - == XM_FAILURE) + if (lpane == XM_FAILURE + || (XMenuAddSelection (FRAME_X_DISPLAY (f), + menu, lpane, 0, item_data, + !NILP (enable), help_string) + == XM_FAILURE)) { XMenuDestroy (FRAME_X_DISPLAY (f), menu); - *error = "Can't add selection to menu"; + *error_name = "Can't add selection to menu"; return Qnil; } i += MENU_ITEMS_ITEM_LENGTH; @@ -2468,6 +2463,7 @@ status = XMenuActivate (FRAME_X_DISPLAY (f), menu, &pane, &selidx, x, y, ButtonReleaseMask, &datap, menu_help_callback); + entry = pane_prefix = Qnil; switch (status) { @@ -2512,16 +2508,14 @@ break; case XM_FAILURE: - *error = "Can't activate menu"; + *error_name = "Can't activate menu"; case XM_IA_SELECT: - entry = Qnil; break; case XM_NO_SELECT: /* Make "Cancel" equivalent to C-g unless FOR_CLICK (which means the menu was invoked with a mouse event as POSITION). */ if (! for_click) Fsignal (Qquit, Qnil); - entry = Qnil; break; } === modified file 'src/xrdb.c' --- src/xrdb.c 2011-04-14 03:05:57 +0000 +++ src/xrdb.c 2011-04-16 04:37:14 +0000 @@ -479,7 +479,9 @@ XrmDatabase db; char line[256]; +#if defined USE_MOTIF || !defined HAVE_XFT || !defined USE_LUCID const char *helv = "-*-helvetica-medium-r-*--*-120-*-*-*-*-iso8859-1"; +#endif #ifdef USE_MOTIF const char *courier = "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1"; === modified file 'src/xsmfns.c' --- src/xsmfns.c 2011-03-08 08:34:55 +0000 +++ src/xsmfns.c 2011-04-16 03:06:07 +0000 @@ -41,8 +41,8 @@ #include "process.h" #include "keyboard.h" -#ifndef HAVE_GTK3 -#define gdk_x11_set_sm_client_id(w) gdk_set_sm_client_id (w) +#if defined USE_GTK && !defined HAVE_GTK3 +#define gdk_x11_set_sm_client_id(w) gdk_set_sm_client_id (w) #endif /* This is the event used when SAVE_SESSION_EVENT occurs. */ @@ -250,7 +250,7 @@ props[props_idx]->vals[vp_idx++].value = chdir_opt; } - for (i = 1; i < initial_argc; ++i) + for (i = 1; i < initial_argc; ++i) { props[props_idx]->vals[vp_idx].length = strlen (initial_argv[i]); props[props_idx]->vals[vp_idx++].value = initial_argv[i]; @@ -365,11 +365,10 @@ #ifndef USE_GTK static void -create_client_leader_window (struct x_display_info *dpyinfo, char *client_id) +create_client_leader_window (struct x_display_info *dpyinfo, char *client_ID) { Window w; XClassHint class_hints; - Atom sm_id; w = XCreateSimpleWindow (dpyinfo->display, dpyinfo->root_window, @@ -383,7 +382,7 @@ XChangeProperty (dpyinfo->display, w, dpyinfo->Xatom_SM_CLIENT_ID, XA_STRING, 8, PropModeReplace, - (unsigned char *)client_id, strlen (client_id)); + (unsigned char *) client_ID, strlen (client_ID)); dpyinfo->client_leader_window = w; } === modified file 'src/xterm.c' --- src/xterm.c 2011-04-13 22:19:27 +0000 +++ src/xterm.c 2011-04-16 21:29:00 +0000 @@ -102,7 +102,7 @@ #ifdef USE_X_TOOLKIT #if !defined(NO_EDITRES) #define HACK_EDITRES -extern void _XEditResCheckMessages (); +extern void _XEditResCheckMessages (Widget, XtPointer, XEvent *, Boolean *); #endif /* not NO_EDITRES */ /* Include toolkit specific headers for the scroll bar widget. */ @@ -187,11 +187,11 @@ /* The application context for Xt use. */ XtAppContext Xt_app_con; static String Xt_default_resources[] = {0}; -#endif /* USE_X_TOOLKIT */ /* Non-zero means user is interacting with a toolkit scroll bar. */ static int toolkit_scroll_bar_interaction; +#endif /* USE_X_TOOLKIT */ /* Non-zero timeout value means ignore next mouse click if it arrives before that timeout elapses (i.e. as part of the same sequence of @@ -349,7 +349,7 @@ static void x_sync_with_move (struct frame *, int, int, int); static int handle_one_xevent (struct x_display_info *, XEvent *, int *, struct input_event *); -#if ! (defined USE_MOTIF || defined USE_X_TOOLKIT) +#ifdef USE_GTK static int x_dispatch_event (XEvent *, Display *); #endif /* Don't declare this NO_RETURN because we want no @@ -1451,19 +1451,6 @@ } -/* Allocate the color COLOR->pixel on the screen and display of - widget WIDGET in colormap CMAP. If an exact match cannot be - allocated, try the nearest color available. Value is non-zero - if successful. This is called from lwlib. */ - -int -x_alloc_nearest_color_for_widget (Widget widget, Colormap cmap, XColor *color) -{ - struct frame *f = x_frame_of_widget (widget); - return x_alloc_nearest_color (f, cmap, color); -} - - /* Allocate a color which is lighter or darker than *PIXEL by FACTOR or DELTA. Try a color with RGB values multiplied by FACTOR first. If this produces the same color as PIXEL, try a color where all RGB @@ -3459,6 +3446,16 @@ } +#if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK +/* Handle an event saying the mouse has moved out of an Emacs frame. */ + +void +x_mouse_leave (struct x_display_info *dpyinfo) +{ + x_new_focus_frame (dpyinfo, dpyinfo->x_focus_event_frame); +} +#endif + /* The focus has changed, or we have redirected a frame's focus to another frame (this happens when a frame uses a surrogate mini-buffer frame). Shift the highlight as appropriate. @@ -4221,8 +4218,8 @@ ev->data.l[4] = (long) whole; /* Make Xt timeouts work while the scroll bar is active. */ +#ifdef USE_X_TOOLKIT toolkit_scroll_bar_interaction = 1; -#ifdef USE_X_TOOLKIT x_activate_timeout_atimer (); #endif @@ -4535,7 +4532,7 @@ Widget widget; Arg av[20]; int ac = 0; - char *scroll_bar_name = SCROLL_BAR_NAME; + char const *scroll_bar_name = SCROLL_BAR_NAME; unsigned long pixel; BLOCK_INPUT; @@ -4687,8 +4684,8 @@ f->output_data.x->edit_widget, av, ac); { - char *initial = ""; - char *val = initial; + char const *initial = ""; + char const *val = initial; XtVaGetValues (widget, XtNscrollVCursor, (XtPointer) &val, #ifdef XtNarrowScrollbars XtNarrowScrollbars, (XtPointer) &xaw3d_arrow_scroll, @@ -5668,6 +5665,7 @@ static struct x_display_info *next_noop_dpyinfo; +#if defined USE_X_TOOLKIT || defined USE_GTK #define SET_SAVED_BUTTON_EVENT \ do \ { \ @@ -5679,6 +5677,7 @@ XSETFRAME (inev.ie.frame_or_window, f); \ } \ while (0) +#endif enum { @@ -5764,8 +5763,8 @@ #endif /* USE_GTK */ -static void xembed_send_message (struct frame *f, Time time, - enum xembed_message message, +static void xembed_send_message (struct frame *f, Time, + enum xembed_message, long detail, long data1, long data2); /* Handles the XEvent EVENT on display DPYINFO. @@ -6978,15 +6977,13 @@ return count; } +#if defined USE_GTK || defined USE_X_TOOLKIT /* Handles the XEvent EVENT on display DISPLAY. This is used for event loops outside the normal event handling, i.e. looping while a popup menu or a dialog is posted. Returns the value handle_one_xevent sets in the finish argument. */ -#if ! (defined USE_MOTIF || defined USE_X_TOOLKIT) -static -#endif int x_dispatch_event (XEvent *event, Display *display) { @@ -7000,6 +6997,7 @@ return finish; } +#endif /* Read events coming from the X server. @@ -10273,10 +10271,10 @@ #ifdef USE_LUCID { - Display *dpy = dpyinfo->display; XrmValue d, fr, to; Font font; + dpy = dpyinfo->display; d.addr = (XPointer)&dpy; d.size = sizeof (Display *); fr.addr = XtDefaultFont; === modified file 'src/xterm.h' --- src/xterm.h 2011-04-14 03:04:14 +0000 +++ src/xterm.h 2011-04-16 16:44:58 +0000 @@ -982,11 +982,11 @@ extern void x_query_colors (struct frame *f, XColor *, int); extern void x_query_color (struct frame *f, XColor *); extern void x_clear_area (Display *, Window, int, int, int, int, int); -#ifdef WINDOWSNT +#if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK extern void x_mouse_leave (struct x_display_info *); #endif -#if defined USE_MOTIF || defined USE_X_TOOLKIT +#ifdef USE_X_TOOLKIT extern int x_dispatch_event (XEvent *, Display *); #endif extern unsigned int x_x_to_emacs_modifiers (struct x_display_info *, ------------------------------------------------------------ revno: 103933 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2011-04-16 15:16:40 -0400 message: Fix argument to `error' in `gnutls-boot'. src/gnutls.c (Fgnutls_boot): Don't pass Lisp_Object to `error'. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-04-16 18:26:30 +0000 +++ src/ChangeLog 2011-04-16 19:16:40 +0000 @@ -1,5 +1,7 @@ 2011-04-16 Eli Zaretskii + * gnutls.c (Fgnutls_boot): Don't pass Lisp_Object to `error'. + Fix regex.c, syntax.c and friends for buffers > 2GB. * syntax.h (struct gl_state_s): Declare character position members EMACS_INT. === modified file 'src/gnutls.c' --- src/gnutls.c 2011-04-15 08:22:34 +0000 +++ src/gnutls.c 2011-04-16 19:16:40 +0000 @@ -456,7 +456,7 @@ else { error ("Sorry, GnuTLS can't use non-string trustfile %s", - trustfile); + SDATA (trustfile)); } } @@ -478,7 +478,7 @@ else { error ("Sorry, GnuTLS can't use non-string keyfile %s", - keyfile); + SDATA (keyfile)); } } } ------------------------------------------------------------ revno: 103932 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2011-04-16 21:26:30 +0300 message: Fix regex.c, syntax.c and friends for buffers > 2GB. src/syntax.h (struct gl_state_s): Declare character position members EMACS_INT. src/syntax.c (update_syntax_table): Declare 2nd argument EMACS_INT. src/textprop.c (verify_interval_modification, interval_of): Declare arguments EMACS_INT. src/intervals.c (adjust_intervals_for_insertion): Declare arguments EMACS_INT. src/intervals.h (CHECK_TOTAL_LENGTH): Cast to EMACS_INT, not `int'. src/indent.c (Fvertical_motion): Local variable it_start is now EMACS_INT. src/regex.c (re_match, re_match_2, re_match_2_internal) (bcmp_translate, regcomp, regexec, print_double_string) (group_in_compile_stack, re_search, re_search_2, regex_compile) (re_compile_pattern, re_exec): Declare arguments and local variables `size_t' and `ssize_t' and return values `regoff_t', as appropriate. (POP_FAILURE_REG_OR_COUNT) : Declare `long'. (CHECK_INFINITE_LOOP) : Declare `ssize_t'. : `size' and `avail' are now `size_t'. src/regex.h : Use ssize_t, not int. (re_search, re_search_2, re_match, re_match_2): Arguments that specify buffer/string position and length are now ssize_t and size_t. Return type is regoff_t. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-04-16 03:44:06 +0000 +++ src/ChangeLog 2011-04-16 18:26:30 +0000 @@ -1,3 +1,37 @@ +2011-04-16 Eli Zaretskii + + Fix regex.c, syntax.c and friends for buffers > 2GB. + * syntax.h (struct gl_state_s): Declare character position members + EMACS_INT. + + * syntax.c (update_syntax_table): Declare 2nd argument EMACS_INT. + + * textprop.c (verify_interval_modification, interval_of): Declare + arguments EMACS_INT. + + * intervals.c (adjust_intervals_for_insertion): Declare arguments + EMACS_INT. + + * intervals.h (CHECK_TOTAL_LENGTH): Cast to EMACS_INT, not `int'. + + * indent.c (Fvertical_motion): Local variable it_start is now + EMACS_INT. + + * regex.c (re_match, re_match_2, re_match_2_internal) + (bcmp_translate, regcomp, regexec, print_double_string) + (group_in_compile_stack, re_search, re_search_2, regex_compile) + (re_compile_pattern, re_exec): Declare arguments and local + variables `size_t' and `ssize_t' and return values `regoff_t', as + appropriate. + (POP_FAILURE_REG_OR_COUNT) : Declare `long'. + (CHECK_INFINITE_LOOP) : Declare `ssize_t'. + : `size' and `avail' are now `size_t'. + + * regex.h : Use ssize_t, not int. + (re_search, re_search_2, re_match, re_match_2): Arguments that + specify buffer/string position and length are now ssize_t and + size_t. Return type is regoff_t. + 2011-04-16 Ben Key * nsfont.m: Fixed bugs in ns_get_family and === modified file 'src/indent.c' --- src/indent.c 2011-04-14 05:04:02 +0000 +++ src/indent.c 2011-04-16 18:26:30 +0000 @@ -2026,7 +2026,8 @@ } else { - int it_start, first_x, it_overshoot_expected IF_LINT (= 0); + EMACS_INT it_start; + int first_x, it_overshoot_expected IF_LINT (= 0); SET_TEXT_POS (pt, PT, PT_BYTE); start_display (&it, w, pt); === modified file 'src/intervals.c' --- src/intervals.c 2011-04-14 00:55:09 +0000 +++ src/intervals.c 2011-04-16 18:26:30 +0000 @@ -805,9 +805,9 @@ static INTERVAL adjust_intervals_for_insertion (tree, position, length) INTERVAL tree; - int position, length; + EMACS_INT position, length; { - register int relative_position; + register EMACS_INT relative_position; register INTERVAL this; if (TOTAL_LENGTH (tree) == 0) /* Paranoia */ === modified file 'src/intervals.h' --- src/intervals.h 2011-04-14 00:55:09 +0000 +++ src/intervals.h 2011-04-16 18:26:30 +0000 @@ -161,12 +161,12 @@ (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT (i) : 0) /* Abort if interval I's size is negative. */ -#define CHECK_TOTAL_LENGTH(i) \ - do \ - { \ - if ((int) (i)->total_length < 0) \ - abort (); \ - } \ +#define CHECK_TOTAL_LENGTH(i) \ + do \ + { \ + if ((EMACS_INT) (i)->total_length < 0) \ + abort (); \ + } \ while (0) /* Reset this interval to its vanilla, or no-property state. */ @@ -269,7 +269,8 @@ extern void offset_intervals (struct buffer *, EMACS_INT, EMACS_INT); extern void graft_intervals_into_buffer (INTERVAL, EMACS_INT, EMACS_INT, struct buffer *, int); -extern void verify_interval_modification (struct buffer *, int, int); +extern void verify_interval_modification (struct buffer *, + EMACS_INT, EMACS_INT); extern INTERVAL balance_intervals (INTERVAL); extern void copy_intervals_to_string (Lisp_Object, struct buffer *, EMACS_INT, EMACS_INT); @@ -285,7 +286,7 @@ extern void set_intervals_multibyte (int); extern INTERVAL validate_interval_range (Lisp_Object, Lisp_Object *, Lisp_Object *, int); -extern INTERVAL interval_of (int, Lisp_Object); +extern INTERVAL interval_of (EMACS_INT, Lisp_Object); /* Defined in xdisp.c */ extern int invisible_p (Lisp_Object, Lisp_Object); === modified file 'src/regex.c' --- src/regex.c 2011-03-15 21:33:24 +0000 +++ src/regex.c 2011-04-16 18:26:30 +0000 @@ -569,12 +569,12 @@ #define false 0 #define true 1 -static int re_match_2_internal _RE_ARGS ((struct re_pattern_buffer *bufp, - re_char *string1, int size1, - re_char *string2, int size2, - int pos, - struct re_registers *regs, - int stop)); +static regoff_t re_match_2_internal _RE_ARGS ((struct re_pattern_buffer *bufp, + re_char *string1, size_t size1, + re_char *string2, size_t size2, + ssize_t pos, + struct re_registers *regs, + ssize_t stop)); /* These are the command codes that appear in compiled regular expressions. Some opcodes are followed by argument bytes. A @@ -1230,10 +1230,10 @@ re_char *where; re_char *string1; re_char *string2; - int size1; - int size2; + ssize_t size1; + ssize_t size2; { - int this_char; + ssize_t this_char; if (where == NULL) printf ("(null)"); @@ -1546,7 +1546,7 @@ /* Pop a saved register off the stack. */ #define POP_FAILURE_REG_OR_COUNT() \ do { \ - int pfreg = POP_FAILURE_INT (); \ + long pfreg = POP_FAILURE_INT (); \ if (pfreg == -1) \ { \ /* It's a counter. */ \ @@ -1568,7 +1568,7 @@ /* Check that we are not stuck in an infinite loop. */ #define CHECK_INFINITE_LOOP(pat_cur, string_place) \ do { \ - int failure = TOP_FAILURE_HANDLE (); \ + ssize_t failure = TOP_FAILURE_HANDLE (); \ /* Check for infinite matching loops */ \ while (failure > 0 \ && (FAILURE_STR (failure) == string_place \ @@ -1876,8 +1876,8 @@ typedef struct { compile_stack_elt_t *stack; - unsigned size; - unsigned avail; /* Offset of next open position. */ + size_t size; + size_t avail; /* Offset of next open position. */ } compile_stack_type; @@ -2779,7 +2779,7 @@ if (many_times_ok) { boolean simple = skip_one_char (laststart) == b; - unsigned int startoffset = 0; + size_t startoffset = 0; re_opcode_t ofj = /* Check if the loop can match the empty string. */ (simple || !analyse_first (laststart, b, NULL, 0)) @@ -3361,7 +3361,7 @@ _____ _____ | | | | | v | v - a | b | c + a | b | c If we are at `b', then fixup_alt_jump right now points to a three-byte space after `a'. We'll put in the jump, set @@ -3905,7 +3905,7 @@ static boolean group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum) { - int this_element; + ssize_t this_element; for (this_element = compile_stack.avail - 1; this_element >= 0; @@ -4291,8 +4291,9 @@ /* Like re_search_2, below, but only one string is specified, and doesn't let you say where to stop matching. */ -int -re_search (struct re_pattern_buffer *bufp, const char *string, int size, int startpos, int range, struct re_registers *regs) +regoff_t +re_search (struct re_pattern_buffer *bufp, const char *string, size_t size, + ssize_t startpos, ssize_t range, struct re_registers *regs) { return re_search_2 (bufp, NULL, 0, string, size, startpos, range, regs, size); @@ -4328,16 +4329,18 @@ found, -1 if no match, or -2 if error (such as failure stack overflow). */ -int -re_search_2 (struct re_pattern_buffer *bufp, const char *str1, int size1, const char *str2, int size2, int startpos, int range, struct re_registers *regs, int stop) +regoff_t +re_search_2 (struct re_pattern_buffer *bufp, const char *str1, size_t size1, + const char *str2, size_t size2, ssize_t startpos, ssize_t range, + struct re_registers *regs, ssize_t stop) { - int val; + regoff_t val; re_char *string1 = (re_char*) str1; re_char *string2 = (re_char*) str2; register char *fastmap = bufp->fastmap; register RE_TRANSLATE_TYPE translate = bufp->translate; - int total_size = size1 + size2; - int endpos = startpos + range; + size_t total_size = size1 + size2; + ssize_t endpos = startpos + range; boolean anchored_start; /* Nonzero if we are searching multibyte string. */ const boolean multibyte = RE_TARGET_MULTIBYTE_P (bufp); @@ -4385,7 +4388,7 @@ #ifdef emacs gl_state.object = re_match_object; /* Used by SYNTAX_TABLE_BYTE_TO_CHAR. */ { - int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (POS_AS_IN_BUFFER (startpos)); + ssize_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (POS_AS_IN_BUFFER (startpos)); SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1); } @@ -4420,7 +4423,7 @@ if (range > 0) /* Searching forwards. */ { register int lim = 0; - int irange = range; + ssize_t irange = range; if (startpos < size1 && startpos + range >= size1) lim = range - (size1 - startpos); @@ -4571,7 +4574,7 @@ /* Declarations and macros for re_match_2. */ static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2, - register int len, + register ssize_t len, RE_TRANSLATE_TYPE translate, const int multibyte)); @@ -4873,11 +4876,11 @@ && ((p2[2 + idx] & ~ p1[2 + idx]) == 0)))) break; - if (idx == p2[1]) - { - DEBUG_PRINT1 (" No match => fast loop.\n"); - return 1; - } + if (idx == p2[1]) + { + DEBUG_PRINT1 (" No match => fast loop.\n"); + return 1; + } } } } @@ -4941,12 +4944,12 @@ #ifndef emacs /* Emacs never uses this. */ /* re_match is like re_match_2 except it takes only a single string. */ -int +regoff_t re_match (struct re_pattern_buffer *bufp, const char *string, - int size, int pos, struct re_registers *regs) + size_t size, ssize_t pos, struct re_registers *regs) { - int result = re_match_2_internal (bufp, NULL, 0, (re_char*) string, size, - pos, regs, size); + regoff_t result = re_match_2_internal (bufp, NULL, 0, (re_char*) string, + size, pos, regs, size); return result; } WEAK_ALIAS (__re_match, re_match) @@ -4971,13 +4974,15 @@ failure stack overflowing). Otherwise, we return the length of the matched substring. */ -int -re_match_2 (struct re_pattern_buffer *bufp, const char *string1, int size1, const char *string2, int size2, int pos, struct re_registers *regs, int stop) +regoff_t +re_match_2 (struct re_pattern_buffer *bufp, const char *string1, + size_t size1, const char *string2, size_t size2, ssize_t pos, + struct re_registers *regs, ssize_t stop) { - int result; + regoff_t result; #ifdef emacs - int charpos; + ssize_t charpos; gl_state.object = re_match_object; /* Used by SYNTAX_TABLE_BYTE_TO_CHAR. */ charpos = SYNTAX_TABLE_BYTE_TO_CHAR (POS_AS_IN_BUFFER (pos)); SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1); @@ -4993,11 +4998,13 @@ /* This is a separate function so that we can force an alloca cleanup afterwards. */ -static int -re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int size1, const re_char *string2, int size2, int pos, struct re_registers *regs, int stop) +static regoff_t +re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, + size_t size1, const re_char *string2, size_t size2, + ssize_t pos, struct re_registers *regs, ssize_t stop) { /* General temporaries. */ - int mcnt; + ssize_t mcnt; size_t reg; /* Just past the end of the corresponding string. */ @@ -5996,8 +6003,8 @@ int s1, s2; int dummy; #ifdef emacs - int offset = PTR_TO_OFFSET (d - 1); - int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); + ssize_t offset = PTR_TO_OFFSET (d - 1); + ssize_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); UPDATE_SYNTAX_TABLE (charpos); #endif GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); @@ -6038,8 +6045,8 @@ int s1, s2; int dummy; #ifdef emacs - int offset = PTR_TO_OFFSET (d); - int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); + ssize_t offset = PTR_TO_OFFSET (d); + ssize_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); UPDATE_SYNTAX_TABLE (charpos); #endif PREFETCH (); @@ -6083,8 +6090,8 @@ int s1, s2; int dummy; #ifdef emacs - int offset = PTR_TO_OFFSET (d) - 1; - int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); + ssize_t offset = PTR_TO_OFFSET (d) - 1; + ssize_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); UPDATE_SYNTAX_TABLE (charpos); #endif GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); @@ -6127,8 +6134,8 @@ re_wchar_t c1, c2; int s1, s2; #ifdef emacs - int offset = PTR_TO_OFFSET (d); - int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); + ssize_t offset = PTR_TO_OFFSET (d); + ssize_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); UPDATE_SYNTAX_TABLE (charpos); #endif PREFETCH (); @@ -6170,8 +6177,8 @@ re_wchar_t c1, c2; int s1, s2; #ifdef emacs - int offset = PTR_TO_OFFSET (d) - 1; - int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); + ssize_t offset = PTR_TO_OFFSET (d) - 1; + ssize_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); UPDATE_SYNTAX_TABLE (charpos); #endif GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); @@ -6207,8 +6214,8 @@ PREFETCH (); #ifdef emacs { - int offset = PTR_TO_OFFSET (d); - int pos1 = SYNTAX_TABLE_BYTE_TO_CHAR (offset); + ssize_t offset = PTR_TO_OFFSET (d); + ssize_t pos1 = SYNTAX_TABLE_BYTE_TO_CHAR (offset); UPDATE_SYNTAX_TABLE (pos1); } #endif @@ -6331,7 +6338,7 @@ bytes; nonzero otherwise. */ static int -bcmp_translate (const re_char *s1, const re_char *s2, register int len, +bcmp_translate (const re_char *s1, const re_char *s2, register ssize_t len, RE_TRANSLATE_TYPE translate, const int target_multibyte) { register re_char *p1 = s1, *p2 = s2; @@ -6373,7 +6380,8 @@ We call regex_compile to do the actual compilation. */ const char * -re_compile_pattern (const char *pattern, size_t length, struct re_pattern_buffer *bufp) +re_compile_pattern (const char *pattern, size_t length, + struct re_pattern_buffer *bufp) { reg_errcode_t ret; @@ -6449,14 +6457,13 @@ } -int +regoff_t # ifdef _LIBC weak_function # endif -re_exec (s) - const char *s; +re_exec (const char *s) { - const int len = strlen (s); + const size_t len = strlen (s); return 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0); } @@ -6500,7 +6507,7 @@ It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for the return codes and their meanings.) */ -int +reg_errcode_t regcomp (regex_t *__restrict preg, const char *__restrict pattern, int cflags) { @@ -6564,7 +6571,7 @@ preg->fastmap = NULL; } } - return (int) ret; + return ret; } WEAK_ALIAS (__regcomp, regcomp) @@ -6583,14 +6590,14 @@ We return 0 if we find a match and REG_NOMATCH if not. */ -int +reg_errcode_t regexec (const regex_t *__restrict preg, const char *__restrict string, size_t nmatch, regmatch_t pmatch[__restrict_arr], int eflags) { - int ret; + reg_errcode_t ret; struct re_registers regs; regex_t private_preg; - int len = strlen (string); + size_t len = strlen (string); boolean want_reg_info = !preg->no_sub && nmatch > 0 && pmatch; private_preg = *preg; @@ -6608,7 +6615,7 @@ regs.num_regs = nmatch; regs.start = TALLOC (nmatch * 2, regoff_t); if (regs.start == NULL) - return (int) REG_NOMATCH; + return REG_NOMATCH; regs.end = regs.start + nmatch; } @@ -6645,7 +6652,7 @@ } /* We want zero return to mean success, unlike `re_search'. */ - return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH; + return ret >= 0 ? REG_NOERROR : REG_NOMATCH; } WEAK_ALIAS (__regexec, regexec) === modified file 'src/regex.h' --- src/regex.h 2011-01-25 04:08:28 +0000 +++ src/regex.h 2011-04-16 18:26:30 +0000 @@ -414,8 +414,12 @@ typedef struct re_pattern_buffer regex_t; -/* Type for byte offsets within the string. POSIX mandates this. */ -typedef int regoff_t; +/* Type for byte offsets within the string. POSIX mandates this to be an int, + but the Open Group has signalled its intention to change the requirement to + be that regoff_t be at least as wide as ptrdiff_t and ssize_t. Current + gnulib sources also use ssize_t, and we need this for supporting buffers and + strings > 2GB on 64-bit hosts. */ +typedef ssize_t regoff_t; /* This is the structure we store register match data in. See @@ -486,31 +490,33 @@ characters. Return the starting position of the match, -1 for no match, or -2 for an internal error. Also return register information in REGS (if REGS and BUFFER->no_sub are nonzero). */ -extern int re_search +extern regoff_t re_search _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, - int length, int start, int range, struct re_registers *regs)); + size_t length, ssize_t start, ssize_t range, + struct re_registers *regs)); /* Like `re_search', but search in the concatenation of STRING1 and STRING2. Also, stop searching at index START + STOP. */ -extern int re_search_2 +extern regoff_t re_search_2 _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, - int length1, const char *string2, int length2, - int start, int range, struct re_registers *regs, int stop)); + size_t length1, const char *string2, size_t length2, + ssize_t start, ssize_t range, struct re_registers *regs, + ssize_t stop)); /* Like `re_search', but return how many characters in STRING the regexp in BUFFER matched, starting at position START. */ -extern int re_match +extern regoff_t re_match _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, - int length, int start, struct re_registers *regs)); + size_t length, ssize_t start, struct re_registers *regs)); /* Relates to `re_match' as `re_search_2' relates to `re_search'. */ -extern int re_match_2 +extern regoff_t re_match_2 _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, - int length1, const char *string2, int length2, - int start, struct re_registers *regs, int stop)); + size_t length1, const char *string2, size_t length2, + ssize_t start, struct re_registers *regs, ssize_t stop)); /* Set REGS to hold NUM_REGS registers, storing them in STARTS and @@ -556,14 +562,15 @@ #endif /* POSIX compatibility. */ -extern int regcomp _RE_ARGS ((regex_t *__restrict __preg, - const char *__restrict __pattern, - int __cflags)); +extern reg_errcode_t regcomp _RE_ARGS ((regex_t *__restrict __preg, + const char *__restrict __pattern, + int __cflags)); -extern int regexec _RE_ARGS ((const regex_t *__restrict __preg, - const char *__restrict __string, size_t __nmatch, - regmatch_t __pmatch[__restrict_arr], - int __eflags)); +extern reg_errcode_t regexec _RE_ARGS ((const regex_t *__restrict __preg, + const char *__restrict __string, + size_t __nmatch, + regmatch_t __pmatch[__restrict_arr], + int __eflags)); extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg, char *__errbuf, size_t __errbuf_size)); === modified file 'src/syntax.c' --- src/syntax.c 2011-04-14 19:34:42 +0000 +++ src/syntax.c 2011-04-16 18:26:30 +0000 @@ -175,7 +175,7 @@ start/end of OBJECT. */ void -update_syntax_table (EMACS_INT charpos, int count, int init, +update_syntax_table (EMACS_INT charpos, EMACS_INT count, int init, Lisp_Object object) { Lisp_Object tmp_table; === modified file 'src/syntax.h' --- src/syntax.h 2011-04-11 03:39:45 +0000 +++ src/syntax.h 2011-04-16 18:26:30 +0000 @@ -19,7 +19,7 @@ along with GNU Emacs. If not, see . */ -extern void update_syntax_table (EMACS_INT, int, int, Lisp_Object); +extern void update_syntax_table (EMACS_INT, EMACS_INT, int, Lisp_Object); /* The standard syntax table is stored where it will automatically be used in all new buffers. */ @@ -276,15 +276,15 @@ struct gl_state_s { Lisp_Object object; /* The object we are scanning. */ - int start; /* Where to stop. */ - int stop; /* Where to stop. */ + EMACS_INT start; /* Where to stop. */ + EMACS_INT stop; /* Where to stop. */ int use_global; /* Whether to use global_code or c_s_t. */ Lisp_Object global_code; /* Syntax code of current char. */ Lisp_Object current_syntax_table; /* Syntax table for current pos. */ Lisp_Object old_prop; /* Syntax-table prop at prev pos. */ - int b_property; /* First index where c_s_t is valid. */ - int e_property; /* First index where c_s_t is + EMACS_INT b_property; /* First index where c_s_t is valid. */ + EMACS_INT e_property; /* First index where c_s_t is not valid. */ INTERVAL forward_i; /* Where to start lookup on forward */ INTERVAL backward_i; /* or backward movement. The @@ -294,7 +294,7 @@ intervals too, depending on: */ /* Offset for positions specified to UPDATE_SYNTAX_TABLE. */ - int offset; + EMACS_INT offset; }; extern struct gl_state_s gl_state; === modified file 'src/textprop.c' --- src/textprop.c 2011-04-14 19:34:42 +0000 +++ src/textprop.c 2011-04-16 18:26:30 +0000 @@ -514,7 +514,7 @@ POSITION is BEG-based. */ INTERVAL -interval_of (int position, Lisp_Object object) +interval_of (EMACS_INT position, Lisp_Object object) { register INTERVAL i; EMACS_INT beg, end; @@ -2012,7 +2012,8 @@ those hooks in order, with START and END - 1 as arguments. */ void -verify_interval_modification (struct buffer *buf, int start, int end) +verify_interval_modification (struct buffer *buf, + EMACS_INT start, EMACS_INT end) { register INTERVAL intervals = BUF_INTERVALS (buf); register INTERVAL i; ------------------------------------------------------------ revno: 103931 committer: Lars Magne Ingebrigtsen branch nick: trunk timestamp: Sat 2011-04-16 15:59:54 +0200 message: (url-http-wait-for-headers-change-function): Protect against malformed headerless responses from servers. diff: === modified file 'lisp/url/ChangeLog' --- lisp/url/ChangeLog 2011-04-06 12:18:10 +0000 +++ lisp/url/ChangeLog 2011-04-16 13:59:54 +0000 @@ -1,3 +1,8 @@ +2011-04-16 Lars Magne Ingebrigtsen + + * url-http.el (url-http-wait-for-headers-change-function): Protect + against malformed headerless responses from servers. + 2011-04-02 Chong Yidong * url-gw.el (url-open-stream): Use new open-network-stream === modified file 'lisp/url/url-http.el' --- lisp/url/url-http.el 2011-02-03 06:22:07 +0000 +++ lisp/url/url-http.el 2011-04-16 13:59:54 +0000 @@ -1077,6 +1077,10 @@ (downcase url-http-transfer-encoding))) (cond + ((null url-http-response-status) + ;; We got back a headerless malformed response from the + ;; server. + (url-http-activate-callback)) ((or (= url-http-response-status 204) (= url-http-response-status 205)) (url-http-debug "%d response must have headers only (%s)." ------------------------------------------------------------ revno: 103930 author: Teodor Zlatanov committer: Katsumi Yamaoka branch nick: trunk timestamp: Sat 2011-04-16 06:56:17 +0000 message: registry.el (registry-reindex): New method to recreate the secondary registry indices. gnus-registry.el (gnus-registry-fixup-registry): Use it if the tracked field changes. (gnus-registry-unfollowed-addresses, gnus-registry-track-extra) (gnus-registry-action, gnus-registry-spool-action) (gnus-registry-handle-action) (gnus-registry--split-fancy-with-parent-internal) (gnus-registry-split-fancy-with-parent) (gnus-registry-register-message-ids): Add recipient tracking on spool, move, and delete actions, and for fancy splitting with parent. (gnus-registry-extract-addresses) (gnus-registry-fetch-recipients-fast) (gnus-registry-fetch-header-fast): Convenience functions. (gnus-registry-misc-test): ERT test of `gnus-registry-extract-addresses'. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2011-04-15 14:29:02 +0000 +++ lisp/gnus/ChangeLog 2011-04-16 06:56:17 +0000 @@ -1,3 +1,23 @@ +2011-04-16 Teodor Zlatanov + + * registry.el (registry-reindex): New method to recreate the secondary + registry indices. + + * gnus-registry.el (gnus-registry-fixup-registry): Use it if the + tracked field changes. + (gnus-registry-unfollowed-addresses, gnus-registry-track-extra) + (gnus-registry-action, gnus-registry-spool-action) + (gnus-registry-handle-action) + (gnus-registry--split-fancy-with-parent-internal) + (gnus-registry-split-fancy-with-parent) + (gnus-registry-register-message-ids): Add recipient tracking on spool, + move, and delete actions, and for fancy splitting with parent. + (gnus-registry-extract-addresses) + (gnus-registry-fetch-recipients-fast) + (gnus-registry-fetch-header-fast): Convenience functions. + (gnus-registry-misc-test): ERT test of + `gnus-registry-extract-addresses'. + 2011-04-15 Teodor Zlatanov * gnus-registry.el (gnus-registry--split-fancy-with-parent-internal): === modified file 'lisp/gnus/gnus-registry.el' --- lisp/gnus/gnus-registry.el 2011-04-15 14:29:02 +0000 +++ lisp/gnus/gnus-registry.el 2011-04-16 06:56:17 +0000 @@ -36,7 +36,7 @@ ;; Put this in your startup file (~/.gnus.el for instance) or use Customize: ;; (setq gnus-registry-max-entries 2500 -;; gnus-registry-track-extra '(sender subject)) +;; gnus-registry-track-extra '(sender subject recipient)) ;; (gnus-registry-initialize) @@ -119,7 +119,9 @@ (defcustom gnus-registry-unfollowed-addresses (list (regexp-quote user-mail-address)) "List of addresses that gnus-registry-split-fancy-with-parent won't trace. -The addresses are matched, they don't have to be fully qualified." +The addresses are matched, they don't have to be fully qualified. +In the messages, these addresses can be the sender or the +recipients." :group 'gnus-registry :type '(repeat regexp)) @@ -152,14 +154,15 @@ (make-obsolete-variable 'gnus-registry-entry-caching nil "23.4") (make-obsolete-variable 'gnus-registry-trim-articles-without-groups nil "23.4") -(defcustom gnus-registry-track-extra '(subject sender) +(defcustom gnus-registry-track-extra '(subject sender recipient) "Whether the registry should track extra data about a message. -The Subject and Sender (From:) headers are tracked this way by -default." +The subject, recipients (To: and Cc:), and Sender (From:) headers +are tracked this way by default." :group 'gnus-registry :type '(set :tag "Tracking choices" (const :tag "Track by subject (Subject: header)" subject) + (const :tag "Track by recipient (To: and Cc: headers)" recipient) (const :tag "Track by sender (From: header)" sender))) (defcustom gnus-registry-split-strategy nil @@ -224,18 +227,22 @@ (defun gnus-registry-fixup-registry (db) (when db - (oset db :precious - (append gnus-registry-extra-entries-precious - '())) - (oset db :max-hard - (or gnus-registry-max-entries - most-positive-fixnum)) - (oset db :max-soft - (or gnus-registry-max-pruned-entries - most-positive-fixnum)) - (oset db :tracked - (append gnus-registry-track-extra - '(mark group keyword)))) + (let ((old (oref db :tracked))) + (oset db :precious + (append gnus-registry-extra-entries-precious + '())) + (oset db :max-hard + (or gnus-registry-max-entries + most-positive-fixnum)) + (oset db :max-soft + (or gnus-registry-max-pruned-entries + most-positive-fixnum)) + (oset db :tracked + (append gnus-registry-track-extra + '(mark group keyword))) + (when (not (equal old (oref db :tracked))) + (gnus-message 4 "Reindexing the Gnus registry (tracked change)") + (registry-reindex db)))) db) (defun gnus-registry-make-db (&optional file) @@ -296,7 +303,17 @@ (defun gnus-registry-action (action data-header from &optional to method) (let* ((id (mail-header-id data-header)) (subject (mail-header-subject data-header)) - (sender (mail-header-from data-header)) + (recipients (sort (mapcan 'gnus-registry-extract-addresses + (list + (or (ignore-errors + (mail-header "Cc" data-header)) + "") + (or (ignore-errors + (mail-header "To" data-header)) + ""))) + 'string-lessp)) + (sender (nth 0 (gnus-registry-extract-addresses + (mail-header-from data-header)))) (from (gnus-group-guess-full-name-from-command-method from)) (to (if to (gnus-group-guess-full-name-from-command-method to) nil)) (to-name (if to to "the Bit Bucket"))) @@ -307,10 +324,16 @@ id ;; unless copying, remove the old "from" group (if (not (equal 'copy action)) from nil) - to subject sender))) + to subject sender recipients))) -(defun gnus-registry-spool-action (id group &optional subject sender) +(defun gnus-registry-spool-action (id group &optional subject sender recipients) (let ((to (gnus-group-guess-full-name-from-command-method group)) + (recipients (or recipients + (sort (mapcan 'gnus-registry-extract-addresses + (list + (or (message-fetch-field "cc") "") + (or (message-fetch-field "to") ""))) + 'string-lessp))) (subject (or subject (message-fetch-field "subject"))) (sender (or sender (message-fetch-field "from")))) (when (and (stringp id) (string-match "\r$" id)) @@ -318,12 +341,13 @@ (gnus-message 7 "Gnus registry: article %s spooled to %s" id to) - (gnus-registry-handle-action id nil to subject sender))) + (gnus-registry-handle-action id nil to subject sender recipients))) -(defun gnus-registry-handle-action (id from to subject sender) +(defun gnus-registry-handle-action (id from to subject sender + &optional recipients) (gnus-message 10 - "gnus-registry-handle-action %S" (list id from to subject sender)) + "gnus-registry-handle-action %S" (list id from to subject sender recipients)) (let ((db gnus-registry-db) ;; safe if not found (entry (gnus-registry-get-or-make-entry id)) @@ -340,11 +364,15 @@ (setq entry (cons (delete from (assoc 'group entry)) (assq-delete-all 'group entry)))) - (dolist (kv `((group ,to) (sender ,sender) (subject ,subject))) + (dolist (kv `((group ,to) + (sender ,sender) + (recipient ,@recipients) + (subject ,subject))) (when (second kv) (let ((new (or (assq (first kv) entry) (list (first kv))))) - (add-to-list 'new (second kv) t) + (dolist (toadd (cdr kv)) + (add-to-list 'new toadd t)) (setq entry (cons new (assq-delete-all (first kv) entry)))))) (gnus-message 10 "Gnus registry: new entry for %s is %S" @@ -381,6 +409,11 @@ ;; these may not be used, but the code is cleaner having them up here (sender (gnus-string-remove-all-properties (message-fetch-field "from"))) + (recipients (sort (mapcan 'gnus-registry-extract-addresses + (list + (or (message-fetch-field "cc") "") + (or (message-fetch-field "to") ""))) + 'string-lessp)) (subject (gnus-string-remove-all-properties (gnus-registry-simplify-subject (message-fetch-field "subject")))) @@ -393,12 +426,13 @@ :references references :refstr refstr :sender sender + :recipients recipients :subject subject :log-agent "Gnus registry fancy splitting with parent"))) (defun* gnus-registry--split-fancy-with-parent-internal (&rest spec - &key references refstr sender subject log-agent + &key references refstr sender subject recipients log-agent &allow-other-keys) (gnus-message 10 @@ -478,6 +512,36 @@ (setq found (gnus-registry-post-process-groups "sender" sender found))) + ;; else: there were no matches, try the extra tracking by recipient + (when (and (null found) + (memq 'recipient gnus-registry-track-extra) + recipients) + (dolist (recp recipients) + (when (and (null found) + (not (gnus-grep-in-list + recp + gnus-registry-unfollowed-addresses))) + (let ((groups (apply 'append + (mapcar + (lambda (reference) + (gnus-registry-get-id-key reference 'group)) + (registry-lookup-secondary-value + db 'recipient recp))))) + (setq found + (loop for group in groups + when (gnus-registry-follow-group-p group) + do (gnus-message + ;; warn more if gnus-registry-track-extra + (if gnus-registry-track-extra 7 9) + "%s (extra tracking) traced recipient '%s' to %s" + log-agent recp group) + collect group))))) + + ;; filter the found groups and return them + ;; the found groups are NOT the full groups + (setq found (gnus-registry-post-process-groups + "recipients" (mapconcat 'identity recipients ", ") found))) + ;; after the (cond) we extract the actual value safely (car-safe found))) @@ -629,7 +693,8 @@ article gnus-newsgroup-name) (gnus-registry-handle-action id nil gnus-newsgroup-name (gnus-registry-fetch-simplified-message-subject-fast article) - (gnus-registry-fetch-sender-fast article))))))) + (gnus-registry-fetch-sender-fast article) + (gnus-registry-fetch-recipients-fast article))))))) ;; message field fetchers (defun gnus-registry-fetch-message-id-fast (article) @@ -639,6 +704,21 @@ (mail-header-id (gnus-data-header (assoc article (gnus-data-list nil)))) nil)) +(defun gnus-registry-extract-addresses (text) + "Extract all the addresses in a normalized way from TEXT. +Returns an unsorted list of strings in the name
format. +Addresses without a name will say \"noname\"." + (mapcar (lambda (add) + (gnus-string-remove-all-properties + (let* ((name (or (nth 0 add) "noname")) + (addr (nth 1 add)) + (addr (if (bufferp addr) + (with-current-buffer addr + (buffer-string)) + addr))) + (format "%s <%s>" name addr)))) + (mail-extract-address-components text t))) + (defun gnus-registry-simplify-subject (subject) (if (stringp subject) (gnus-simplify-subject subject) @@ -655,12 +735,26 @@ nil)) (defun gnus-registry-fetch-sender-fast (article) - "Fetch the Sender quickly, using the internal gnus-data-list function" + (gnus-registry-fetch-header-fast "from" article)) + +(defun gnus-registry-fetch-recipients-fast (article) + (sort (mapcan 'gnus-registry-extract-addresses + (list + (or (ignore-errors + (gnus-registry-fetch-header-fast "Cc" article)) + "") + (or (ignore-errors + (gnus-registry-fetch-header-fast "To" article)) + ""))) + 'string-lessp)) + +(defun gnus-registry-fetch-header-fast (article header) + "Fetch the HEADER quickly, using the internal gnus-data-list function" (if (and (numberp article) (assoc article (gnus-data-list nil))) (gnus-string-remove-all-properties - (mail-header-from (gnus-data-header - (assoc article (gnus-data-list nil))))) + (mail-header header (gnus-data-header + (assoc article (gnus-data-list nil))))) nil)) ;; registry marks glue @@ -902,6 +996,19 @@ (gnus-registry-set-id-key id key val)))) (message "Import done, collected %d entries" count)))) +(ert-deftest gnus-registry-misc-test () + (should-error (gnus-registry-extract-addresses '("" ""))) + + (should (equal '("Ted Zlatanov " + "noname " + "noname " + "noname ") + (gnus-registry-extract-addresses + (concat "Ted Zlatanov , " + "ed , " ; "ed" is not a valid name here + "cyd@stupidchicken.com, " + "tzz@lifelogs.com"))))) + (ert-deftest gnus-registry-usage-test () (let* ((n 100) (tempfile (make-temp-file "gnus-registry-persist")) === modified file 'lisp/gnus/registry.el' --- lisp/gnus/registry.el 2011-04-11 01:18:19 +0000 +++ lisp/gnus/registry.el 2011-04-16 06:56:17 +0000 @@ -281,6 +281,25 @@ (registry-lookup-secondary-value db tr val value-keys)))) entry) +(defmethod registry-reindex ((db registry-db)) + "Rebuild the secondary indices of registry-db THIS." + (let ((count 0) + (expected (* (length (oref db :tracked)) (registry-size db)))) + (dolist (tr (oref db :tracked)) + (let (values) + (maphash + (lambda (key v) + (incf count) + (when (and (< 0 expected) + (= 0 (mod count 1000))) + (message "reindexing: %d of %d (%.2f%%)" + count expected (/ (* 1000 count) expected))) + (dolist (val (cdr-safe (assq tr v))) + (let* ((value-keys (registry-lookup-secondary-value db tr val))) + (push key value-keys) + (registry-lookup-secondary-value db tr val value-keys)))) + (oref db :data)))))) + (defmethod registry-size ((db registry-db)) "Returns the size of the registry-db object THIS. This is the key count of the :data slot." @@ -360,10 +379,11 @@ (when (boundp 'lexical-binding) (message "Individual lookup (breaks before lexbind)") (should (= 58 - (caadr (registry-lookup-breaks-before-lexbind db '(1 58 99))))) + (caadr (registry-lookup-breaks-before-lexbind db '(1 58 99))))) (message "Grouped individual lookup (breaks before lexbind)") (should (= 3 - (length (registry-lookup-breaks-before-lexbind db '(1 58 99)))))) + (length (registry-lookup-breaks-before-lexbind db + '(1 58 99)))))) (message "Search") (should (= n (length (registry-search db :all t)))) (should (= n (length (registry-search db :member '((sender "me")))))) ------------------------------------------------------------ Use --include-merges or -n0 to see merged revisions.