From nobody Mon Feb 9 00:53:29 2026 Received: from mail-dl1-f73.google.com (mail-dl1-f73.google.com [74.125.82.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B77C130BB88 for ; Sat, 7 Feb 2026 08:24:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770452691; cv=none; b=t2J5M6bbCq+CoPko+P0hfAxDwtiCDsPA4AM0eu2nFar89OBysVjScPW3fDD4ABRwG3EXYhS1Dxxn8ukKsf1t/hwtKbbplVzM7fZU30+hpkyF6XkqeFZ9/mpYDiR8mNshKmSR0kdSEFS/X2uJJdY3d17MJut148/9RsYBg3QdO24= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770452691; c=relaxed/simple; bh=N96xkMpy5lP+7H0aWH6pC7j/S+oT22nm8lNiuaa5llA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=OHedgzQRPIyfGyiEHJ06/d3ove6gx00yYBlG3pkiidc1qwNciUlijNx6GaHPiM5rq9eDuZYfIyQ7phXPFw6V2NtsJPYx17tuzbkbl8m+KecesS1AQxZ9Ed8/dgGgsMjPYbVosYwr+ZELu5MqStzCxYhi/o5Na4gOjjExrTvPaOk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=V4DZLGgf; arc=none smtp.client-ip=74.125.82.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="V4DZLGgf" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-12711967e0eso167452c88.0 for ; Sat, 07 Feb 2026 00:24:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770452691; x=1771057491; darn=vger.kernel.org; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=73S70KhFl7MAoO9qRsIjn211Skfv7Zjtw2IW8M3qYRk=; b=V4DZLGgfOnwdYAODUs8NQEZVtzb5x1RYT8WITEPDdYaBNRz5uBcVMTYidITua85lKK L/L6zxBhlTs7QAOL2Yqc++Sjzm9Hg+rz+xOOCbUUhsoMbRlc4o+m7A3u703vn4xQu1s/ zeUH9ICiAQW2nvDj3U60ielvZaAOsm+iXt5OVFyOQAnkntitiRx6k+SOo9X8zdxRsBKi bGpTarDgM6DOXqoVnKnCxZYTJN5eZ4Z0Y9ixL8+RSnVGO41ukOsl3fdLeOlQpl4jwcSE VmyJD+XUtfLl6vupK1p0oCo8vsdYGXGigzpka3NRkq8P9u/2+c6eLuytDpA6QRlXNgx3 Z/9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770452691; x=1771057491; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=73S70KhFl7MAoO9qRsIjn211Skfv7Zjtw2IW8M3qYRk=; b=wWM7rgqmrmoVCa3WWy5WweDdw5+i4DGJdoxpcZ0q9Yous3Bp1GZKLYRfBOEFdBloUZ XEwj3lt4wU6UCVdiRFuyAehmVCk2alLDDUif1RPBdgv3w6wMXRz+ilOKfYqjs+8rNzEs PuV0UXglh16x7EJjshYSgdoM3dOKTFoRBailK54H9x/ZES2uzzGWtL3nxHe/mFQcOCb1 U+Y/6IHjuV+k6KzMEosCPuO4eN8aS2Mz7PvVrQBea5AHGYm8bEJxXk9sR+1JYoyjy7Rb hYm5iWvck/twkEBx65qaq5z+JYGXS8frQA7m06p+zhlhSywvSx9Xy25QJUHCFE3kD+H5 zhwg== X-Forwarded-Encrypted: i=1; AJvYcCV7+bGAWWpMnhNBvI9sw1H0/jrvtA0RS8/GrRJsSe8PGiCHHLr0a4p8xXF29gnzuk/Fnsu5JUF32AlIVDE=@vger.kernel.org X-Gm-Message-State: AOJu0YwDrI8ZDcvXKYr2vTGt5V55lNaYEIO1D6ow+4wDbGNeEs3ikHxk rXQDbR2k7bRD9fxqSu/k6B5lILvTYs+f0aCHD79dI63EaJqMjL4+ND8dM4lnwwa1BtqV5kRmaFm 0xkwylyV27g== X-Received: from dlbcy24.prod.google.com ([2002:a05:7022:b98:b0:126:faf3:bc29]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:4a2:b0:11b:d211:3a64 with SMTP id a92af1059eb24-12703e8f4c7mr2884395c88.0.1770452690831; Sat, 07 Feb 2026 00:24:50 -0800 (PST) Date: Sat, 7 Feb 2026 00:24:26 -0800 In-Reply-To: <20260207082428.1742209-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260207082428.1742209-1-irogers@google.com> X-Mailer: git-send-email 2.53.0.239.g8d8fc8a987-goog Message-ID: <20260207082428.1742209-4-irogers@google.com> Subject: [PATCH v1 3/5] perf tool: Constify the command and option arrays From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Eric Biggers , Palmer Dabbelt , Stephen Brennan , Haibo Xu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Reduce scope and capture immutability. Signed-off-by: Ian Rogers --- tools/perf/perf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/perf/perf.c b/tools/perf/perf.c index f475a8664ffc..1f51e8de6b1b 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c @@ -48,7 +48,7 @@ struct cmd_struct { int option; }; =20 -static struct cmd_struct commands[] =3D { +static const struct cmd_struct commands[] =3D { { "archive", NULL, 0 }, { "buildid-cache", cmd_buildid_cache, 0 }, { "buildid-list", cmd_buildid_list, 0 }, @@ -178,7 +178,7 @@ static int set_debug_file(const char *path) return 0; } =20 -struct option options[] =3D { +static const struct option options[] =3D { OPT_ARGUMENT("help", "help"), OPT_ARGUMENT("version", "version"), OPT_ARGUMENT("exec-path", "exec-path"), @@ -280,7 +280,7 @@ static int handle_options(const char ***argv, int *argc= , int *envchanged) unsigned int i; =20 for (i =3D 0; i < ARRAY_SIZE(commands); i++) { - struct cmd_struct *p =3D commands+i; + const struct cmd_struct *p =3D commands + i; printf("%s ", p->cmd); } putchar('\n'); @@ -289,7 +289,7 @@ static int handle_options(const char ***argv, int *argc= , int *envchanged) unsigned int i; =20 for (i =3D 0; i < ARRAY_SIZE(options)-1; i++) { - struct option *p =3D options+i; + const struct option *p =3D options + i; printf("--%s ", p->long_name); } putchar('\n'); @@ -331,7 +331,7 @@ static int handle_options(const char ***argv, int *argc= , int *envchanged) #define RUN_SETUP (1<<0) #define USE_PAGER (1<<1) =20 -static int run_builtin(struct cmd_struct *p, int argc, const char **argv) +static int run_builtin(const struct cmd_struct *p, int argc, const char **= argv) { int status; struct stat st; @@ -390,7 +390,7 @@ static void handle_internal_command(int argc, const cha= r **argv) } =20 for (i =3D 0; i < ARRAY_SIZE(commands); i++) { - struct cmd_struct *p =3D commands+i; + const struct cmd_struct *p =3D commands+i; if (p->fn =3D=3D NULL) continue; if (strcmp(p->cmd, cmd)) --=20 2.53.0.239.g8d8fc8a987-goog