aboutsummaryrefslogtreecommitdiffstats
path: root/oldXMenu/AddSel.c
diff options
context:
space:
mode:
authorPaul Eggert2011-04-16 01:25:42 -0700
committerPaul Eggert2011-04-16 01:25:42 -0700
commit55660072db3bb05d1daba0eb67865913b82d313a (patch)
treebbeda328257b0960f227c5509224077c7cf9c158 /oldXMenu/AddSel.c
parentaefd87e148d11777492fc068f3eddf2945cfbfc5 (diff)
downloademacs-55660072db3bb05d1daba0eb67865913b82d313a.tar.gz
emacs-55660072db3bb05d1daba0eb67865913b82d313a.zip
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 <stdlib.h>. (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 <string.h>. * 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.
Diffstat (limited to 'oldXMenu/AddSel.c')
-rw-r--r--oldXMenu/AddSel.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/oldXMenu/AddSel.c b/oldXMenu/AddSel.c
index 9183aba7e8e..9bbcf71cd3c 100644
--- a/oldXMenu/AddSel.c
+++ b/oldXMenu/AddSel.c
@@ -17,8 +17,8 @@
17#include "XMenuInt.h" 17#include "XMenuInt.h"
18 18
19int 19int
20XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char *help) 20XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char const *help)
21 21
22 /* Menu object to be modified. */ 22 /* Menu object to be modified. */
23 /* Pane number to be modified. */ 23 /* Pane number to be modified. */
24 /* Data value. */ 24 /* Data value. */
@@ -27,7 +27,7 @@ XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, ch
27 /* Help string */ 27 /* Help string */
28{ 28{
29 register XMPane *pane; /* Pane containing the new selection. */ 29 register XMPane *pane; /* Pane containing the new selection. */
30 register XMSelect *select; /* Newly created selection. */ 30 register XMSelect *sel; /* Newly created selection. */
31 31
32 32
33 int label_length; /* Label lenght in characters. */ 33 int label_length; /* Label lenght in characters. */
@@ -49,8 +49,8 @@ XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, ch
49 /* 49 /*
50 * Calloc the XMSelect structure. 50 * Calloc the XMSelect structure.
51 */ 51 */
52 select = (XMSelect *)calloc(1, sizeof(XMSelect)); 52 sel = (XMSelect *)calloc(1, sizeof(XMSelect));
53 if (select == NULL) { 53 if (sel == NULL) {
54 _XMErrorCode = XME_CALLOC; 54 _XMErrorCode = XME_CALLOC;
55 return(XM_FAILURE); 55 return(XM_FAILURE);
56 } 56 }
@@ -65,27 +65,27 @@ XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, ch
65 */ 65 */
66 if (!strcmp (label, "--") || !strcmp (label, "---")) 66 if (!strcmp (label, "--") || !strcmp (label, "---"))
67 { 67 {
68 select->type = SEPARATOR; 68 sel->type = SEPARATOR;
69 select->active = 0; 69 sel->active = 0;
70 } 70 }
71 else 71 else
72 { 72 {
73 select->type = SELECTION; 73 sel->type = SELECTION;
74 select->active = active; 74 sel->active = active;
75 } 75 }
76 76
77 select->serial = -1; 77 sel->serial = -1;
78 select->label = label; 78 sel->label = label;
79 select->label_width = label_width; 79 sel->label_width = label_width;
80 select->label_length = label_length; 80 sel->label_length = label_length;
81 select->data = data; 81 sel->data = data;
82 select->parent_p = pane; 82 sel->parent_p = pane;
83 select->help_string = help; 83 sel->help_string = help;
84 84
85 /* 85 /*
86 * Insert the selection at the end of the selection list. 86 * Insert the selection at the end of the selection list.
87 */ 87 */
88 emacs_insque(select, pane->s_list->prev); 88 emacs_insque(sel, pane->s_list->prev);
89 89
90 /* 90 /*
91 * Update the selection count. 91 * Update the selection count.
@@ -103,4 +103,3 @@ XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, ch
103 _XMErrorCode = XME_NO_ERROR; 103 _XMErrorCode = XME_NO_ERROR;
104 return((pane->s_count - 1)); 104 return((pane->s_count - 1));
105} 105}
106