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

perf ui: Move ui_helpline routines to separate file in util/ui/

LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+55 -37
+2
tools/perf/Makefile
··· 569 569 EXTLIBS += -lnewt -lslang 570 570 LIB_OBJS += $(OUTPUT)util/newt.o 571 571 LIB_OBJS += $(OUTPUT)util/ui/browser.o 572 + LIB_OBJS += $(OUTPUT)util/ui/helpline.o 572 573 LIB_H += util/ui/browser.h 574 + LIB_H += util/ui/helpline.h 573 575 endif 574 576 endif 575 577
+1 -37
tools/perf/util/newt.c
··· 24 24 #include "sort.h" 25 25 #include "symbol.h" 26 26 #include "ui/browser.h" 27 + #include "ui/helpline.h" 27 28 28 29 #if SLANG_VERSION < 20104 29 30 #define slsmg_printf(msg, args...) SLsmg_printf((char *)msg, ##args) ··· 93 92 newtPopWindow(); 94 93 } 95 94 free(self); 96 - } 97 - 98 - static void ui_helpline__pop(void) 99 - { 100 - newtPopHelpLine(); 101 - } 102 - 103 - static void ui_helpline__push(const char *msg) 104 - { 105 - newtPushHelpLine(msg); 106 - } 107 - 108 - static void ui_helpline__vpush(const char *fmt, va_list ap) 109 - { 110 - char *s; 111 - 112 - if (vasprintf(&s, fmt, ap) < 0) 113 - vfprintf(stderr, fmt, ap); 114 - else { 115 - ui_helpline__push(s); 116 - free(s); 117 - } 118 - } 119 - 120 - static void ui_helpline__fpush(const char *fmt, ...) 121 - { 122 - va_list ap; 123 - 124 - va_start(ap, fmt); 125 - ui_helpline__vpush(fmt, ap); 126 - va_end(ap); 127 - } 128 - 129 - static void ui_helpline__puts(const char *msg) 130 - { 131 - ui_helpline__pop(); 132 - ui_helpline__push(msg); 133 95 } 134 96 135 97 static int ui_entry__read(const char *title, char *bf, size_t size, int width)
+43
tools/perf/util/ui/helpline.c
··· 1 + #define _GNU_SOURCE 2 + #include <stdio.h> 3 + #include <stdlib.h> 4 + #include <newt.h> 5 + 6 + #include "helpline.h" 7 + 8 + void ui_helpline__pop(void) 9 + { 10 + newtPopHelpLine(); 11 + } 12 + 13 + void ui_helpline__push(const char *msg) 14 + { 15 + newtPushHelpLine(msg); 16 + } 17 + 18 + static void ui_helpline__vpush(const char *fmt, va_list ap) 19 + { 20 + char *s; 21 + 22 + if (vasprintf(&s, fmt, ap) < 0) 23 + vfprintf(stderr, fmt, ap); 24 + else { 25 + ui_helpline__push(s); 26 + free(s); 27 + } 28 + } 29 + 30 + void ui_helpline__fpush(const char *fmt, ...) 31 + { 32 + va_list ap; 33 + 34 + va_start(ap, fmt); 35 + ui_helpline__vpush(fmt, ap); 36 + va_end(ap); 37 + } 38 + 39 + void ui_helpline__puts(const char *msg) 40 + { 41 + ui_helpline__pop(); 42 + ui_helpline__push(msg); 43 + }
+9
tools/perf/util/ui/helpline.h
··· 1 + #ifndef _PERF_UI_HELPLINE_H_ 2 + #define _PERF_UI_HELPLINE_H_ 1 3 + 4 + void ui_helpline__pop(void); 5 + void ui_helpline__push(const char *msg); 6 + void ui_helpline__fpush(const char *fmt, ...); 7 + void ui_helpline__puts(const char *msg); 8 + 9 + #endif /* _PERF_UI_HELPLINE_H_ */