From patchwork Fri Aug 25 02:40:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13364943 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 42BB6C6FA8F for ; Fri, 25 Aug 2023 02:41:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=12ZAH5slcpzsUUr+S4w3Jx7t5EnR6//gHhj1mwDwixY=; b=Gsf1fjoU//atql ET591hYLbE+O2ekXBJdsgmRZ7Cqx3tzkh2TAbEt74H5KzHWEUp1FlWDcLRthBDvk7F7WM0gjz00Go 3kv+k+S0DpFPi9Gc77HfHDXK3XF7y/7DcR57bzC8h6UIpGYYOvuw41W4piCaqYY3eKlJSRwDid87Y FjSpBYfmB/uB719hK3G58jrLV4j3uVDUaM7KHZQdT79BMo0W0fZPZsjSNxKF4dGgw+jgFTsp7osjV 3JXIwJ2CiacWaLFprTOXqb8HUDODoOkLn2uIHrKdej3+GQMIqKft9HB0R8ZkcqZp3hIi3W3NNYg/j XzG4+eXZSgYijiXlYdRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qZMl6-0048UV-2n; Fri, 25 Aug 2023 02:41:12 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qZMke-0048NV-28 for linux-arm-kernel@lists.infradead.org; Fri, 25 Aug 2023 02:40:46 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d748b6f1077so556268276.1 for ; Thu, 24 Aug 2023 19:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1692931242; x=1693536042; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=NcUqJfD2vtZBJtRGaKPEtBOFxtzHCYdgja7TOmPH0eI=; b=CjxI+TYHnmhAYRxwVdz5aS2g96q8COr2M6h1zy3NUfYwcihYrPYYCdvJnDnUg3DHSX UeQeKLw+tyDRqQAtQBA2xCKe8vkrQ3zIJhnly8Qs661aa1M6x0+fFWxkV9DeySTUm7Oe CgM7ih1p8azQOaAe6VGeT+vbraXYGRJgKXMwBzDwzhTMTCMnawFW71Ycz1ccqtl1ewQP hr7zYtvI6lzLwmgTyO9P6dKlTCUGw6YRAerJ0NYO+i3EU99Po9+yYPIe6MBLun8Mj9XV XZmmNMjkxkV5Jx4gGBPQsrtB/kaWmHM6ibdL4mRvuGWl5yd18Vphb+gBAdefjpfeyta6 jhVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692931242; x=1693536042; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NcUqJfD2vtZBJtRGaKPEtBOFxtzHCYdgja7TOmPH0eI=; b=PbmhBGu9Ga1LgSo8WZztD605ZjRfPaTKG8M9aKFH0Gkf/rfHVz2T/KD6aKKt3QP2kv wmvYbc3RbHpAsWgrr/PE9Wc4hprrTYcBifmYxqLDyYhbuOqjNxHTppa1LirqDuJ6Mdks pKDdsgJsgSpZugJHULKOEknNoeEpj/nMjaqgfVrhpDOqVmiAo8mpULAf8V/dbvj3RquV oAwx/H7yQHxIuovy2awdpB/32hxCxUG6uC5zDBCoEc3fZSN+1kxxJ9vvqQgFkbFTLiwQ IxHm8OMcBNNCyHPeF0AAF22b3o8ifFIyxtSnul7NY/M8ScEqxmYfdYoDLdGiqx9UNfRg JbvA== X-Gm-Message-State: AOJu0YwHoIj5K8CCfDT4Y26FxY53Pb6UiMFNeIIQyxixy9ff96nCbIvU /0xNJTbTZTXlpjNgldPHOaPKeaGo5jU2 X-Google-Smtp-Source: AGHT+IEOo3g5mLbnRiubfq5FYzAABS3D4p8ybai45wdimtAsrJ2oNUARHrolM3wRcoYP/3jUwHZ2GyLtspc3 X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:449e:d47b:bc6b:cb6b]) (user=irogers job=sendgmr) by 2002:a25:fc0d:0:b0:d07:e80c:412e with SMTP id v13-20020a25fc0d000000b00d07e80c412emr300379ybd.12.1692931242503; Thu, 24 Aug 2023 19:40:42 -0700 (PDT) Date: Thu, 24 Aug 2023 19:40:02 -0700 In-Reply-To: <20230825024002.801955-1-irogers@google.com> Message-Id: <20230825024002.801955-7-irogers@google.com> Mime-Version: 1.0 References: <20230825024002.801955-1-irogers@google.com> X-Mailer: git-send-email 2.42.0.rc2.253.gd59a3bf2b4-goog Subject: [PATCH v2 6/6] perf tui slang: Tidy casts From: Ian Rogers To: John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Kan Liang , Ravi Bangoria , Suzuki Poulouse , Kajol Jain , Athira Rajeev , Ming Wang , Huacai Chen , Sean Christopherson , K Prateek Nayak , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Wei Li X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230824_194044_698900_A4361C23 X-CRM114-Status: GOOD ( 15.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Casts were necessary for older versions of libslang, however, these are now 15 years old and so we no longer need to care about supporting them. Tidy the casts and remove unnecessary logic. Move the ENABLE_SLFUTURE_CONST to the libslang.h common include file, and also enable ENABLE_SLFUTURE_VOID. Signed-off-by: Ian Rogers --- tools/perf/ui/Build | 2 -- tools/perf/ui/browser.c | 6 +++--- tools/perf/ui/browsers/Build | 5 ----- tools/perf/ui/libslang.h | 20 ++++---------------- tools/perf/ui/tui/helpline.c | 2 +- tools/perf/ui/tui/setup.c | 2 +- tools/perf/ui/tui/util.c | 12 ++++++------ 7 files changed, 15 insertions(+), 34 deletions(-) diff --git a/tools/perf/ui/Build b/tools/perf/ui/Build index 3aff83c3275f..6b6d7143a37b 100644 --- a/tools/perf/ui/Build +++ b/tools/perf/ui/Build @@ -10,5 +10,3 @@ CFLAGS_setup.o += -DLIBDIR="BUILD_STR($(LIBDIR))" perf-$(CONFIG_SLANG) += browser.o perf-$(CONFIG_SLANG) += browsers/ perf-$(CONFIG_SLANG) += tui/ - -CFLAGS_browser.o += -DENABLE_SLFUTURE_CONST diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c index 78fb01d6ad63..603d11283cbd 100644 --- a/tools/perf/ui/browser.c +++ b/tools/perf/ui/browser.c @@ -57,12 +57,12 @@ void ui_browser__gotorc(struct ui_browser *browser, int y, int x) void ui_browser__write_nstring(struct ui_browser *browser __maybe_unused, const char *msg, unsigned int width) { - slsmg_write_nstring(msg, width); + SLsmg_write_nstring(msg, width); } void ui_browser__vprintf(struct ui_browser *browser __maybe_unused, const char *fmt, va_list args) { - slsmg_vprintf(fmt, args); + SLsmg_vprintf(fmt, args); } void ui_browser__printf(struct ui_browser *browser __maybe_unused, const char *fmt, ...) @@ -808,6 +808,6 @@ void ui_browser__init(void) while (ui_browser__colorsets[i].name) { struct ui_browser_colorset *c = &ui_browser__colorsets[i++]; - sltt_set_color(c->colorset, c->name, c->fg, c->bg); + SLtt_set_color(c->colorset, c->name, c->fg, c->bg); } } diff --git a/tools/perf/ui/browsers/Build b/tools/perf/ui/browsers/Build index fdf86f7981ca..7a1d5ddaf688 100644 --- a/tools/perf/ui/browsers/Build +++ b/tools/perf/ui/browsers/Build @@ -4,8 +4,3 @@ perf-y += map.o perf-y += scripts.o perf-y += header.o perf-y += res_sample.o - -CFLAGS_annotate.o += -DENABLE_SLFUTURE_CONST -CFLAGS_hists.o += -DENABLE_SLFUTURE_CONST -CFLAGS_map.o += -DENABLE_SLFUTURE_CONST -CFLAGS_scripts.o += -DENABLE_SLFUTURE_CONST diff --git a/tools/perf/ui/libslang.h b/tools/perf/ui/libslang.h index 991e692b9b46..1dff3020e9d5 100644 --- a/tools/perf/ui/libslang.h +++ b/tools/perf/ui/libslang.h @@ -11,28 +11,16 @@ #define HAVE_LONG_LONG __GLIBC_HAVE_LONG_LONG #endif +/* Enable future slang's corrected function prototypes. */ +#define ENABLE_SLFUTURE_CONST 1 +#define ENABLE_SLFUTURE_VOID 1 + #ifdef HAVE_SLANG_INCLUDE_SUBDIR #include #else #include #endif -#if SLANG_VERSION < 20104 -#define slsmg_printf(msg, args...) \ - SLsmg_printf((char *)(msg), ##args) -#define slsmg_vprintf(msg, vargs) \ - SLsmg_vprintf((char *)(msg), vargs) -#define slsmg_write_nstring(msg, len) \ - SLsmg_write_nstring((char *)(msg), len) -#define sltt_set_color(obj, name, fg, bg) \ - SLtt_set_color(obj,(char *)(name), (char *)(fg), (char *)(bg)) -#else -#define slsmg_printf SLsmg_printf -#define slsmg_vprintf SLsmg_vprintf -#define slsmg_write_nstring SLsmg_write_nstring -#define sltt_set_color SLtt_set_color -#endif - #define SL_KEY_UNTAB 0x1000 #endif /* _PERF_UI_SLANG_H_ */ diff --git a/tools/perf/ui/tui/helpline.c b/tools/perf/ui/tui/helpline.c index db4952f5990b..b39451314f43 100644 --- a/tools/perf/ui/tui/helpline.c +++ b/tools/perf/ui/tui/helpline.c @@ -22,7 +22,7 @@ static void tui_helpline__push(const char *msg) SLsmg_gotorc(SLtt_Screen_Rows - 1, 0); SLsmg_set_color(0); - SLsmg_write_nstring((char *)msg, SLtt_Screen_Cols); + SLsmg_write_nstring(msg, SLtt_Screen_Cols); SLsmg_refresh(); strlcpy(ui_helpline__current, msg, sz); } diff --git a/tools/perf/ui/tui/setup.c b/tools/perf/ui/tui/setup.c index c1886aa184b3..605d9e175ea7 100644 --- a/tools/perf/ui/tui/setup.c +++ b/tools/perf/ui/tui/setup.c @@ -142,7 +142,7 @@ int ui__init(void) goto out; } - SLkp_define_keysym((char *)"^(kB)", SL_KEY_UNTAB); + SLkp_define_keysym("^(kB)", SL_KEY_UNTAB); signal(SIGSEGV, ui__signal_backtrace); signal(SIGFPE, ui__signal_backtrace); diff --git a/tools/perf/ui/tui/util.c b/tools/perf/ui/tui/util.c index 3c5174854ac8..e4d322ce0b54 100644 --- a/tools/perf/ui/tui/util.c +++ b/tools/perf/ui/tui/util.c @@ -106,7 +106,7 @@ int ui_browser__input_window(const char *title, const char *text, char *input, SLsmg_draw_box(y, x++, nr_lines, max_len); if (title) { SLsmg_gotorc(y, x + 1); - SLsmg_write_string((char *)title); + SLsmg_write_string(title); } SLsmg_gotorc(++y, x); nr_lines -= 7; @@ -117,12 +117,12 @@ int ui_browser__input_window(const char *title, const char *text, char *input, len = 5; while (len--) { SLsmg_gotorc(y + len - 1, x); - SLsmg_write_nstring((char *)" ", max_len); + SLsmg_write_nstring(" ", max_len); } SLsmg_draw_box(y++, x + 1, 3, max_len - 2); SLsmg_gotorc(y + 3, x); - SLsmg_write_nstring((char *)exit_msg, max_len); + SLsmg_write_nstring(exit_msg, max_len); SLsmg_refresh(); mutex_unlock(&ui__lock); @@ -197,7 +197,7 @@ void __ui__info_window(const char *title, const char *text, const char *exit_msg SLsmg_draw_box(y, x++, nr_lines, max_len); if (title) { SLsmg_gotorc(y, x + 1); - SLsmg_write_string((char *)title); + SLsmg_write_string(title); } SLsmg_gotorc(++y, x); if (exit_msg) @@ -207,9 +207,9 @@ void __ui__info_window(const char *title, const char *text, const char *exit_msg nr_lines, max_len, 1); if (exit_msg) { SLsmg_gotorc(y + nr_lines - 2, x); - SLsmg_write_nstring((char *)" ", max_len); + SLsmg_write_nstring(" ", max_len); SLsmg_gotorc(y + nr_lines - 1, x); - SLsmg_write_nstring((char *)exit_msg, max_len); + SLsmg_write_nstring(exit_msg, max_len); } }