diff options
| author | Dan Nicolaescu | 2010-09-26 18:11:48 +0300 |
|---|---|---|
| committer | Dan Nicolaescu | 2010-09-26 18:11:48 +0300 |
| commit | d6dcbe70e2d715ce484f7061e8fa5b86785cbec0 (patch) | |
| tree | 15170cf96f70116c3446e9ce8f2d2161790c3569 | |
| parent | dce4c2ac896da32ead5d8a2fcadb428310c104ea (diff) | |
| download | emacs-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/ChangeLog | 8 | ||||
| -rw-r--r-- | lwlib/lwlib.c | 24 | ||||
| -rw-r--r-- | lwlib/lwlib.h | 2 |
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 @@ | |||
| 1 | 2010-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 | |||
| 1 | 2010-09-20 Dan Nicolaescu <dann@ics.uci.edu> | 9 | 2010-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 *); |
| 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 *, |
| @@ -92,14 +92,14 @@ 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 *); |
| @@ -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 | ||
| 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 | { |
| @@ -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 */ |
| 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; |
| @@ -586,7 +586,7 @@ merge_widget_value (widget_value *val1, | |||
| 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 | ||
| @@ -729,9 +729,9 @@ initialize_widget_instance (widget_instance *instance) | |||
| 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; |
| @@ -739,7 +739,7 @@ find_in_table (char *type, widget_creation_entry *table) | |||
| 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] */ |
| @@ -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 | ||
| 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 | ||
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 | ||
| 189 | int lw_separator_p (char *label, enum menu_separator *type, | 189 | int 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 */ |