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: gconf: refactor text_insert_help()

text_insert_help() and text_insert_msg() share similar code.
Refactor text_insert_help() to eliminate the code duplication.

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

+9 -26
+9 -26
scripts/kconfig/gconf.c
··· 64 64 65 65 /* Utility Functions */ 66 66 67 - 68 - static void text_insert_help(struct menu *menu) 69 - { 70 - GtkTextBuffer *buffer; 71 - GtkTextIter start, end; 72 - const char *prompt = menu_get_prompt(menu); 73 - struct gstr help = str_new(); 74 - 75 - menu_get_ext_help(menu, &help); 76 - 77 - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); 78 - gtk_text_buffer_get_bounds(buffer, &start, &end); 79 - gtk_text_buffer_delete(buffer, &start, &end); 80 - gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_w), 15); 81 - 82 - gtk_text_buffer_get_end_iter(buffer, &end); 83 - gtk_text_buffer_insert_with_tags(buffer, &end, prompt, -1, tag1, 84 - NULL); 85 - gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2); 86 - gtk_text_buffer_get_end_iter(buffer, &end); 87 - gtk_text_buffer_insert_with_tags(buffer, &end, str_get(&help), -1, tag2, 88 - NULL); 89 - str_free(&help); 90 - } 91 - 92 - 93 67 static void text_insert_msg(const char *title, const char *msg) 94 68 { 95 69 GtkTextBuffer *buffer; ··· 81 107 gtk_text_buffer_get_end_iter(buffer, &end); 82 108 gtk_text_buffer_insert_with_tags(buffer, &end, msg, -1, tag2, 83 109 NULL); 110 + } 111 + 112 + static void text_insert_help(struct menu *menu) 113 + { 114 + struct gstr help = str_new(); 115 + 116 + menu_get_ext_help(menu, &help); 117 + text_insert_msg(menu_get_prompt(menu), str_get(&help)); 118 + str_free(&help); 84 119 } 85 120 86 121 static void _select_menu(GtkTreeView *view, GtkTreeModel *model,