From: Stephen Hemminger <stephen@networkplumber.org>
To: Jan Engelhardt <jengelh@inai.de>
Cc: netdev@vger.kernel.org
Subject: Re: [iproute PATCH] lib/color: introduce freely configurable color strings
Date: Mon, 12 Oct 2020 08:04:54 -0700 [thread overview]
Message-ID: <20201012080454.6b57ccfe@hermes.local> (raw)
In-Reply-To: <20201012145021.10539-1-jengelh@inai.de>
On Mon, 12 Oct 2020 16:50:21 +0200
Jan Engelhardt <jengelh@inai.de> wrote:
> Implement fine-grained control over color codes for iproute, very
> similar to the GCC_COLORS environment variable.
>
> Signed-off-by: Jan Engelhardt <jengelh@inai.de>
> ---
> lib/color.c | 127 ++++++++++++++++++++++++--------------------------
> man/man8/ip.8 | 25 ++++++++--
> 2 files changed, 81 insertions(+), 71 deletions(-)
I like the idea a lot.
But there are some style issues.
Checkpatch sees:
WARNING: Missing a blank line after declarations
#165: FILE: lib/color.c:46:
+ const char *s = getenv("COLORTERM"), *s2 = getenv("COLORFGBG");
+ color_is_enabled = (s != NULL && strtoul(s, NULL, 0) != 0) ||
ERROR: code indent should use tabs where possible
#166: FILE: lib/color.c:47:
+^I (s2 != NULL && *s2 != '\0');$
ERROR: do not use assignment in if condition
#188: FILE: lib/color.c:99:
+ if (p && (p = strrchr(p, ';')) != NULL && (p[1] == '7' && p[2] == '\0'))
WARNING: Missing a blank line after declarations
#197: FILE: lib/color.c:108:
+ const char *code = NULL;
+ for (size_t j = 0; j < ARRAY_SIZE(color_codes); ++j) {
WARNING: Missing a blank line after declarations
#207: FILE: lib/color.c:118:
+ const char *next = strchr(p, ':');
+ if (next == NULL)
WARNING: Missing a blank line after declarations
#228: FILE: lib/color.c:144:
+ const struct color_code *k = &color_codes[attr];
+ if (k->code != NULL && *k->code != '\0')
Also, please don't mix declarations in code like:
+ for (size_t j = 0; j < ARRAY_SIZE(color_codes); ++j) {
Iproute2 tries to stick to the kernel coding style, and loop variables
like this are allowed in that standard.
prev parent reply other threads:[~2020-10-12 15:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-12 14:50 [iproute PATCH] lib/color: introduce freely configurable color strings Jan Engelhardt
2020-10-12 15:04 ` Stephen Hemminger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201012080454.6b57ccfe@hermes.local \
--to=stephen@networkplumber.org \
--cc=jengelh@inai.de \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.