aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu2010-09-26 18:11:48 +0300
committerDan Nicolaescu2010-09-26 18:11:48 +0300
commitd6dcbe70e2d715ce484f7061e8fa5b86785cbec0 (patch)
tree15170cf96f70116c3446e9ce8f2d2161790c3569
parentdce4c2ac896da32ead5d8a2fcadb428310c104ea (diff)
downloademacs-d6dcbe70e2d715ce484f7061e8fa5b86785cbec0.tar.gz
emacs-d6dcbe70e2d715ce484f7061e8fa5b86785cbec0.zip
Use const for some pointer arguments.
* lwlib/lwlib.h (my_strcasecmp, safe_strcmp, name_to_widget) (find_in_table, dialog_spec_p, lw_separator_p): * lwlib/lwlib.c (my_strcasecmp, safe_strcmp, name_to_widget) (find_in_table, dialog_spec_p, lw_separator_p): Use const.
-rw-r--r--lwlib/ChangeLog8
-rw-r--r--lwlib/lwlib.c24
-rw-r--r--lwlib/lwlib.h2
3 files changed, 21 insertions, 13 deletions
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog
index 783e3626aee..5172d61eb5a 100644
--- a/lwlib/ChangeLog
+++ b/lwlib/ChangeLog
@@ -1,3 +1,11 @@
12010-09-26 Dan Nicolaescu <dann@ics.uci.edu>
2
3 Use const for some pointer arguments.
4 * lwlib.h (my_strcasecmp, safe_strcmp, name_to_widget)
5 (find_in_table, dialog_spec_p, lw_separator_p):
6 * lwlib.c (my_strcasecmp, safe_strcmp, name_to_widget)
7 (find_in_table, dialog_spec_p, lw_separator_p): Use const.
8
12010-09-20 Dan Nicolaescu <dann@ics.uci.edu> 92010-09-20 Dan Nicolaescu <dann@ics.uci.edu>
2 10
3 * lwlib.h (lw_register_widget, lw_create_widget): 11 * lwlib.h (lw_register_widget, lw_create_widget):
diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c
index 44bdd81411c..1f434e5b611 100644
--- a/lwlib/lwlib.c
+++ b/lwlib/lwlib.c
@@ -75,7 +75,7 @@ static widget_value *merge_widget_value (widget_value *,
75 widget_value *, 75 widget_value *,
76 int, int *); 76 int, int *);
77static void instantiate_widget_instance (widget_instance *); 77static void instantiate_widget_instance (widget_instance *);
78static int my_strcasecmp (char *, char *); 78static int my_strcasecmp (const char *, const char *);
79static void safe_free_str (char *); 79static void safe_free_str (char *);
80static void free_widget_value_tree (widget_value *); 80static void free_widget_value_tree (widget_value *);
81static widget_value *copy_widget_value_tree (widget_value *, 81static widget_value *copy_widget_value_tree (widget_value *,
@@ -92,14 +92,14 @@ static void free_widget_instance (widget_instance *);
92static widget_info *get_widget_info (LWLIB_ID, Boolean); 92static widget_info *get_widget_info (LWLIB_ID, Boolean);
93static widget_instance *get_widget_instance (Widget, Boolean); 93static widget_instance *get_widget_instance (Widget, Boolean);
94static widget_instance *find_instance (LWLIB_ID, Widget, Boolean); 94static widget_instance *find_instance (LWLIB_ID, Widget, Boolean);
95static Boolean safe_strcmp (char *, char *); 95static Boolean safe_strcmp (const char *, const char *);
96static Widget name_to_widget (widget_instance *, char *); 96static Widget name_to_widget (widget_instance *, const char *);
97static void set_one_value (widget_instance *, widget_value *, Boolean); 97static void set_one_value (widget_instance *, widget_value *, Boolean);
98static void update_one_widget_instance (widget_instance *, Boolean); 98static void update_one_widget_instance (widget_instance *, Boolean);
99static void update_all_widget_values (widget_info *, Boolean); 99static void update_all_widget_values (widget_info *, Boolean);
100static void initialize_widget_instance (widget_instance *); 100static void initialize_widget_instance (widget_instance *);
101static widget_creation_function find_in_table (char *, widget_creation_entry *); 101static widget_creation_function find_in_table (const char *, const widget_creation_entry *);
102static Boolean dialog_spec_p (char *); 102static Boolean dialog_spec_p (const char *);
103static void destroy_one_instance (widget_instance *); 103static void destroy_one_instance (widget_instance *);
104static void lw_pop_all_widgets (LWLIB_ID, Boolean); 104static void lw_pop_all_widgets (LWLIB_ID, Boolean);
105static Boolean get_one_value (widget_instance *, widget_value *); 105static Boolean get_one_value (widget_instance *, widget_value *);
@@ -120,7 +120,7 @@ safe_strdup (const char *s)
120/* Like strcmp but ignore differences in case. */ 120/* Like strcmp but ignore differences in case. */
121 121
122static int 122static int
123my_strcasecmp (char *s1, char *s2) 123my_strcasecmp (const char *s1, const char *s2)
124{ 124{
125 while (1) 125 while (1)
126 { 126 {
@@ -402,7 +402,7 @@ find_instance (LWLIB_ID id, Widget parent, Boolean pop_up_p)
402 402
403/* utility function for widget_value */ 403/* utility function for widget_value */
404static Boolean 404static Boolean
405safe_strcmp (char *s1, char *s2) 405safe_strcmp (const char *s1, const char *s2)
406{ 406{
407 if (!!s1 ^ !!s2) return True; 407 if (!!s1 ^ !!s2) return True;
408 return (s1 && s2) ? strcmp (s1, s2) : s1 ? False : !!s2; 408 return (s1 && s2) ? strcmp (s1, s2) : s1 ? False : !!s2;
@@ -586,7 +586,7 @@ merge_widget_value (widget_value *val1,
586 586
587/* modifying the widgets */ 587/* modifying the widgets */
588static Widget 588static Widget
589name_to_widget (widget_instance *instance, char *name) 589name_to_widget (widget_instance *instance, const char *name)
590{ 590{
591 Widget widget = NULL; 591 Widget widget = NULL;
592 592
@@ -729,9 +729,9 @@ initialize_widget_instance (widget_instance *instance)
729 729
730 730
731static widget_creation_function 731static widget_creation_function
732find_in_table (char *type, widget_creation_entry *table) 732find_in_table (const char *type, const widget_creation_entry *table)
733{ 733{
734 widget_creation_entry* cur; 734 const widget_creation_entry* cur;
735 for (cur = table; cur->type; cur++) 735 for (cur = table; cur->type; cur++)
736 if (!my_strcasecmp (type, cur->type)) 736 if (!my_strcasecmp (type, cur->type))
737 return cur->function; 737 return cur->function;
@@ -739,7 +739,7 @@ find_in_table (char *type, widget_creation_entry *table)
739} 739}
740 740
741static Boolean 741static Boolean
742dialog_spec_p (char *name) 742dialog_spec_p (const char *name)
743{ 743{
744 /* return True if name matches [EILPQeilpq][1-9][Bb] or 744 /* return True if name matches [EILPQeilpq][1-9][Bb] or
745 [EILPQeilpq][1-9][Bb][Rr][1-9] */ 745 [EILPQeilpq][1-9][Bb][Rr][1-9] */
@@ -1317,7 +1317,7 @@ lw_allow_resizing (Widget w, Boolean flag)
1317 to similar ones that are supported. */ 1317 to similar ones that are supported. */
1318 1318
1319int 1319int
1320lw_separator_p (char *label, enum menu_separator *type, int motif_p) 1320lw_separator_p (const char *label, enum menu_separator *type, int motif_p)
1321{ 1321{
1322 int separator_p = 0; 1322 int separator_p = 0;
1323 1323
diff --git a/lwlib/lwlib.h b/lwlib/lwlib.h
index 36f880d6d13..a531429f899 100644
--- a/lwlib/lwlib.h
+++ b/lwlib/lwlib.h
@@ -186,7 +186,7 @@ void lw_set_main_areas (Widget parent,
186 MOTIF_P non-zero means map separator types not supported by Motif 186 MOTIF_P non-zero means map separator types not supported by Motif
187 to similar ones that are supported. */ 187 to similar ones that are supported. */
188 188
189int lw_separator_p (char *label, enum menu_separator *type, 189int lw_separator_p (const char *label, enum menu_separator *type,
190 int motif_p); 190 int motif_p);
191 191
192#endif /* LWLIB_H */ 192#endif /* LWLIB_H */