Mercurial > emacs
comparison lwlib/lwlib.c @ 110589:0e7fadbf6ef4
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.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Sun, 26 Sep 2010 18:11:48 +0300 |
parents | 5e90a4ff527d |
children | 417b1e4d63cd |
comparison
equal
deleted
inserted
replaced
110588:0995e4af573f | 110589:0e7fadbf6ef4 |
---|---|
73 | 73 |
74 static widget_value *merge_widget_value (widget_value *, | 74 static widget_value *merge_widget_value (widget_value *, |
75 widget_value *, | 75 widget_value *, |
76 int, int *); | 76 int, int *); |
77 static void instantiate_widget_instance (widget_instance *); | 77 static void instantiate_widget_instance (widget_instance *); |
78 static int my_strcasecmp (char *, char *); | 78 static int my_strcasecmp (const char *, const char *); |
79 static void safe_free_str (char *); | 79 static void safe_free_str (char *); |
80 static void free_widget_value_tree (widget_value *); | 80 static void free_widget_value_tree (widget_value *); |
81 static widget_value *copy_widget_value_tree (widget_value *, | 81 static widget_value *copy_widget_value_tree (widget_value *, |
82 change_type); | 82 change_type); |
83 static widget_info *allocate_widget_info (const char *, const char *, LWLIB_ID, | 83 static widget_info *allocate_widget_info (const char *, const char *, LWLIB_ID, |
90 Widget, Boolean); | 90 Widget, Boolean); |
91 static void free_widget_instance (widget_instance *); | 91 static void free_widget_instance (widget_instance *); |
92 static widget_info *get_widget_info (LWLIB_ID, Boolean); | 92 static widget_info *get_widget_info (LWLIB_ID, Boolean); |
93 static widget_instance *get_widget_instance (Widget, Boolean); | 93 static widget_instance *get_widget_instance (Widget, Boolean); |
94 static widget_instance *find_instance (LWLIB_ID, Widget, Boolean); | 94 static widget_instance *find_instance (LWLIB_ID, Widget, Boolean); |
95 static Boolean safe_strcmp (char *, char *); | 95 static Boolean safe_strcmp (const char *, const char *); |
96 static Widget name_to_widget (widget_instance *, char *); | 96 static Widget name_to_widget (widget_instance *, const char *); |
97 static void set_one_value (widget_instance *, widget_value *, Boolean); | 97 static void set_one_value (widget_instance *, widget_value *, Boolean); |
98 static void update_one_widget_instance (widget_instance *, Boolean); | 98 static void update_one_widget_instance (widget_instance *, Boolean); |
99 static void update_all_widget_values (widget_info *, Boolean); | 99 static void update_all_widget_values (widget_info *, Boolean); |
100 static void initialize_widget_instance (widget_instance *); | 100 static void initialize_widget_instance (widget_instance *); |
101 static widget_creation_function find_in_table (char *, widget_creation_entry *); | 101 static widget_creation_function find_in_table (const char *, const widget_creation_entry *); |
102 static Boolean dialog_spec_p (char *); | 102 static Boolean dialog_spec_p (const char *); |
103 static void destroy_one_instance (widget_instance *); | 103 static void destroy_one_instance (widget_instance *); |
104 static void lw_pop_all_widgets (LWLIB_ID, Boolean); | 104 static void lw_pop_all_widgets (LWLIB_ID, Boolean); |
105 static Boolean get_one_value (widget_instance *, widget_value *); | 105 static Boolean get_one_value (widget_instance *, widget_value *); |
106 static void show_one_widget_busy (Widget, Boolean); | 106 static void show_one_widget_busy (Widget, Boolean); |
107 /* utility functions for widget_instance and widget_info */ | 107 /* utility functions for widget_instance and widget_info */ |
118 } | 118 } |
119 | 119 |
120 /* Like strcmp but ignore differences in case. */ | 120 /* Like strcmp but ignore differences in case. */ |
121 | 121 |
122 static int | 122 static int |
123 my_strcasecmp (char *s1, char *s2) | 123 my_strcasecmp (const char *s1, const char *s2) |
124 { | 124 { |
125 while (1) | 125 while (1) |
126 { | 126 { |
127 int c1 = *s1++; | 127 int c1 = *s1++; |
128 int c2 = *s2++; | 128 int c2 = *s2++; |
400 } | 400 } |
401 | 401 |
402 | 402 |
403 /* utility function for widget_value */ | 403 /* utility function for widget_value */ |
404 static Boolean | 404 static Boolean |
405 safe_strcmp (char *s1, char *s2) | 405 safe_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; |
409 } | 409 } |
410 | 410 |
584 } | 584 } |
585 | 585 |
586 | 586 |
587 /* modifying the widgets */ | 587 /* modifying the widgets */ |
588 static Widget | 588 static Widget |
589 name_to_widget (widget_instance *instance, char *name) | 589 name_to_widget (widget_instance *instance, const char *name) |
590 { | 590 { |
591 Widget widget = NULL; | 591 Widget widget = NULL; |
592 | 592 |
593 if (!instance->widget) | 593 if (!instance->widget) |
594 return NULL; | 594 return NULL; |
727 val->change = NO_CHANGE; | 727 val->change = NO_CHANGE; |
728 } | 728 } |
729 | 729 |
730 | 730 |
731 static widget_creation_function | 731 static widget_creation_function |
732 find_in_table (char *type, widget_creation_entry *table) | 732 find_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; |
738 return NULL; | 738 return NULL; |
739 } | 739 } |
740 | 740 |
741 static Boolean | 741 static Boolean |
742 dialog_spec_p (char *name) | 742 dialog_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] */ |
746 if (!name) | 746 if (!name) |
747 return False; | 747 return False; |
1315 set to an appropriate enumerator of type enum menu_separator. | 1315 set to an appropriate enumerator of type enum menu_separator. |
1316 MOTIF_P non-zero means map separator types not supported by Motif | 1316 MOTIF_P non-zero means map separator types not supported by Motif |
1317 to similar ones that are supported. */ | 1317 to similar ones that are supported. */ |
1318 | 1318 |
1319 int | 1319 int |
1320 lw_separator_p (char *label, enum menu_separator *type, int motif_p) | 1320 lw_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 |
1324 if (strlen (label) >= 3 | 1324 if (strlen (label) >= 3 |
1325 && memcmp (label, "--:", 3) == 0) | 1325 && memcmp (label, "--:", 3) == 0) |