Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kconfig: add const qualifiers to several function arguments

Clarify that the given structures are not modified.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

+40 -36
+2 -2
scripts/kconfig/expr.c
··· 1096 1096 return 0; 1097 1097 } 1098 1098 1099 - void expr_print(struct expr *e, 1099 + void expr_print(const struct expr *e, 1100 1100 void (*fn)(void *, struct symbol *, const char *), 1101 1101 void *data, int prevtoken) 1102 1102 { ··· 1221 1221 str_printf(gs, " [=%s]", sym_str); 1222 1222 } 1223 1223 1224 - void expr_gstr_print(struct expr *e, struct gstr *gs) 1224 + void expr_gstr_print(const struct expr *e, struct gstr *gs) 1225 1225 { 1226 1226 expr_print(e, expr_print_gstr_helper, gs, E_NONE); 1227 1227 }
+2 -2
scripts/kconfig/expr.h
··· 291 291 292 292 void expr_fprint(struct expr *e, FILE *out); 293 293 struct gstr; /* forward */ 294 - void expr_gstr_print(struct expr *e, struct gstr *gs); 294 + void expr_gstr_print(const struct expr *e, struct gstr *gs); 295 295 void expr_gstr_print_revdep(struct expr *e, struct gstr *gs, 296 296 tristate pr_type, const char *title); 297 297 298 - static inline int expr_is_yes(struct expr *e) 298 + static inline int expr_is_yes(const struct expr *e) 299 299 { 300 300 return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes); 301 301 }
+11 -10
scripts/kconfig/lkc.h
··· 75 75 void str_free(struct gstr *gs); 76 76 void str_append(struct gstr *gs, const char *s); 77 77 void str_printf(struct gstr *gs, const char *fmt, ...); 78 - char *str_get(struct gstr *gs); 78 + char *str_get(const struct gstr *gs); 79 79 80 80 /* menu.c */ 81 81 struct menu *menu_next(struct menu *menu, struct menu *root); ··· 84 84 #define menu_for_each_entry(menu) \ 85 85 menu_for_each_sub_entry(menu, &rootmenu) 86 86 void _menu_init(void); 87 - void menu_warn(struct menu *menu, const char *fmt, ...); 87 + void menu_warn(const struct menu *menu, const char *fmt, ...); 88 88 struct menu *menu_add_menu(void); 89 89 void menu_end_menu(void); 90 90 void menu_add_entry(struct symbol *sym); 91 91 void menu_add_dep(struct expr *dep); 92 92 void menu_add_visibility(struct expr *dep); 93 - struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); 93 + struct property *menu_add_prompt(enum prop_type type, const char *prompt, 94 + struct expr *dep); 94 95 void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); 95 96 void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); 96 97 void menu_finalize(void); ··· 101 100 102 101 bool menu_is_empty(struct menu *menu); 103 102 bool menu_is_visible(struct menu *menu); 104 - bool menu_has_prompt(struct menu *menu); 105 - const char *menu_get_prompt(struct menu *menu); 103 + bool menu_has_prompt(const struct menu *menu); 104 + const char *menu_get_prompt(const struct menu *menu); 106 105 struct menu *menu_get_parent_menu(struct menu *menu); 107 106 int get_jump_key_char(void); 108 107 struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head); ··· 115 114 struct property *sym_get_range_prop(struct symbol *sym); 116 115 const char *sym_get_string_default(struct symbol *sym); 117 116 struct symbol *sym_check_deps(struct symbol *sym); 118 - struct symbol *prop_get_symbol(struct property *prop); 117 + struct symbol *prop_get_symbol(const struct property *prop); 119 118 120 - static inline tristate sym_get_tristate_value(struct symbol *sym) 119 + static inline tristate sym_get_tristate_value(const struct symbol *sym) 121 120 { 122 121 return sym->curr.tri; 123 122 } 124 123 125 - static inline bool sym_is_choice(struct symbol *sym) 124 + static inline bool sym_is_choice(const struct symbol *sym) 126 125 { 127 126 /* A choice is a symbol with no name */ 128 127 return sym->name == NULL; 129 128 } 130 129 131 - static inline bool sym_is_choice_value(struct symbol *sym) 130 + static inline bool sym_is_choice_value(const struct symbol *sym) 132 131 { 133 132 return sym->flags & SYMBOL_CHOICEVAL ? true : false; 134 133 } 135 134 136 - static inline bool sym_has_value(struct symbol *sym) 135 + static inline bool sym_has_value(const struct symbol *sym) 137 136 { 138 137 return sym->flags & SYMBOL_DEF_USER ? true : false; 139 138 }
+7 -5
scripts/kconfig/lkc_proto.h
··· 25 25 const char * sym_type_name(enum symbol_type type); 26 26 void sym_calc_value(struct symbol *sym); 27 27 bool sym_dep_errors(void); 28 - enum symbol_type sym_get_type(struct symbol *sym); 29 - bool sym_tristate_within_range(struct symbol *sym,tristate tri); 28 + enum symbol_type sym_get_type(const struct symbol *sym); 29 + bool sym_tristate_within_range(const struct symbol *sym, tristate tri); 30 30 bool sym_set_tristate_value(struct symbol *sym,tristate tri); 31 31 void choice_set_value(struct menu *choice, struct symbol *sym); 32 32 tristate sym_toggle_tristate_value(struct symbol *sym); 33 33 bool sym_string_valid(struct symbol *sym, const char *newval); 34 34 bool sym_string_within_range(struct symbol *sym, const char *str); 35 35 bool sym_set_string_value(struct symbol *sym, const char *newval); 36 - bool sym_is_changeable(struct symbol *sym); 37 - struct menu *sym_get_choice_menu(struct symbol *sym); 36 + bool sym_is_changeable(const struct symbol *sym); 37 + struct menu *sym_get_choice_menu(const struct symbol *sym); 38 38 const char * sym_get_string_value(struct symbol *sym); 39 39 40 40 const char * prop_get_type_name(enum prop_type type); 41 41 42 42 /* expr.c */ 43 - void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken); 43 + void expr_print(const struct expr *e, 44 + void (*fn)(void *, struct symbol *, const char *), 45 + void *data, int prevtoken); 44 46 45 47 #endif /* LKC_PROTO_H */
+8 -7
scripts/kconfig/menu.c
··· 38 38 return menu->next; 39 39 } 40 40 41 - void menu_warn(struct menu *menu, const char *fmt, ...) 41 + void menu_warn(const struct menu *menu, const char *fmt, ...) 42 42 { 43 43 va_list ap; 44 44 va_start(ap, fmt); ··· 48 48 va_end(ap); 49 49 } 50 50 51 - static void prop_warn(struct property *prop, const char *fmt, ...) 51 + static void prop_warn(const struct property *prop, const char *fmt, ...) 52 52 { 53 53 va_list ap; 54 54 va_start(ap, fmt); ··· 175 175 return prop; 176 176 } 177 177 178 - struct property *menu_add_prompt(enum prop_type type, char *prompt, 178 + struct property *menu_add_prompt(enum prop_type type, const char *prompt, 179 179 struct expr *dep) 180 180 { 181 181 struct property *prop = menu_add_prop(type, NULL, dep); ··· 527 527 _menu_finalize(&rootmenu, false); 528 528 } 529 529 530 - bool menu_has_prompt(struct menu *menu) 530 + bool menu_has_prompt(const struct menu *menu) 531 531 { 532 532 if (!menu->prompt) 533 533 return false; ··· 573 573 return visible != no; 574 574 } 575 575 576 - const char *menu_get_prompt(struct menu *menu) 576 + const char *menu_get_prompt(const struct menu *menu) 577 577 { 578 578 if (menu->prompt) 579 579 return menu->prompt->text; ··· 594 594 return menu; 595 595 } 596 596 597 - static void get_def_str(struct gstr *r, struct menu *menu) 597 + static void get_def_str(struct gstr *r, const struct menu *menu) 598 598 { 599 599 str_printf(r, "Defined at %s:%d\n", 600 600 menu->filename, menu->lineno); 601 601 } 602 602 603 - static void get_dep_str(struct gstr *r, struct expr *expr, const char *prefix) 603 + static void get_dep_str(struct gstr *r, const struct expr *expr, 604 + const char *prefix) 604 605 { 605 606 if (!expr_is_yes(expr)) { 606 607 str_append(r, prefix);
+2 -2
scripts/kconfig/parser.y
··· 489 489 * 490 490 * Return: -1 if an error is found, 0 otherwise. 491 491 */ 492 - static int choice_check_sanity(struct menu *menu) 492 + static int choice_check_sanity(const struct menu *menu) 493 493 { 494 494 struct property *prop; 495 495 int ret = 0; ··· 644 644 putc('"', out); 645 645 } 646 646 647 - static void print_symbol(FILE *out, struct menu *menu) 647 + static void print_symbol(FILE *out, const struct menu *menu) 648 648 { 649 649 struct symbol *sym = menu->sym; 650 650 struct property *prop;
+7 -7
scripts/kconfig/symbol.c
··· 40 40 static tristate modules_val; 41 41 static int sym_warnings; 42 42 43 - enum symbol_type sym_get_type(struct symbol *sym) 43 + enum symbol_type sym_get_type(const struct symbol *sym) 44 44 { 45 45 enum symbol_type type = sym->type; 46 46 ··· 75 75 * 76 76 * Return: a choice menu if this function is called against a choice member. 77 77 */ 78 - struct menu *sym_get_choice_menu(struct symbol *sym) 78 + struct menu *sym_get_choice_menu(const struct symbol *sym) 79 79 { 80 80 struct menu *menu = NULL; 81 81 struct menu *m; ··· 355 355 return res; 356 356 } 357 357 358 - static void sym_warn_unmet_dep(struct symbol *sym) 358 + static void sym_warn_unmet_dep(const struct symbol *sym) 359 359 { 360 360 struct gstr gs = str_new(); 361 361 ··· 521 521 sym_calc_value(modules_sym); 522 522 } 523 523 524 - bool sym_tristate_within_range(struct symbol *sym, tristate val) 524 + bool sym_tristate_within_range(const struct symbol *sym, tristate val) 525 525 { 526 526 int type = sym_get_type(sym); 527 527 ··· 866 866 return (const char *)sym->curr.val; 867 867 } 868 868 869 - bool sym_is_changeable(struct symbol *sym) 869 + bool sym_is_changeable(const struct symbol *sym) 870 870 { 871 871 return !sym_is_choice(sym) && sym->visible > sym->rev_dep.tri; 872 872 } ··· 1150 1150 dep_stack_remove(); 1151 1151 } 1152 1152 1153 - static struct symbol *sym_check_expr_deps(struct expr *e) 1153 + static struct symbol *sym_check_expr_deps(const struct expr *e) 1154 1154 { 1155 1155 struct symbol *sym; 1156 1156 ··· 1309 1309 return sym2; 1310 1310 } 1311 1311 1312 - struct symbol *prop_get_symbol(struct property *prop) 1312 + struct symbol *prop_get_symbol(const struct property *prop) 1313 1313 { 1314 1314 if (prop->expr && prop->expr->type == E_SYMBOL) 1315 1315 return prop->expr->left.sym;
+1 -1
scripts/kconfig/util.c
··· 98 98 } 99 99 100 100 /* Retrieve value of growable string */ 101 - char *str_get(struct gstr *gs) 101 + char *str_get(const struct gstr *gs) 102 102 { 103 103 return gs->s; 104 104 }