From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Jiri Slaby <jslaby@suse.cz>
Cc: gregkh@linuxfoundation.org, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/7] tty/vt: consolemap: saner variable names in set_inverse_transl()
Date: Tue, 14 Jun 2022 11:35:18 +0300 (EEST) [thread overview]
Message-ID: <74fc76bf-a7f-be34-10cd-412234990f1@linux.intel.com> (raw)
In-Reply-To: <20220614075713.32767-4-jslaby@suse.cz>
[-- Attachment #1: Type: text/plain, Size: 2219 bytes --]
On Tue, 14 Jun 2022, Jiri Slaby wrote:
> The function uses too vague variable names like i, j, k for iterators, p,
> q, p1, p2 for pointers etc.
>
> Rename all these, so that it is clear what is going on:
> - dict: for dictionaries.
> - d, r, g: for dir, row, glyph iterators -- these are unsigned now.
> - dir, row: for directory and row pointers.
> - glyph: for the glyph.
> - and so on...
>
> This is a lot of shuffling, but the result pays off, IMO.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
> drivers/tty/vt/consolemap.c | 26 +++++++++++++-------------
> 1 file changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c
> index a69dfda8e3d0..3d0e10dac6d9 100644
> --- a/drivers/tty/vt/consolemap.c
> +++ b/drivers/tty/vt/consolemap.c
> @@ -214,29 +214,29 @@ struct uni_pagedict {
>
> static struct uni_pagedict *dflt;
>
> -static void set_inverse_transl(struct vc_data *conp, struct uni_pagedict *p,
> +static void set_inverse_transl(struct vc_data *conp, struct uni_pagedict *dict,
> enum translation_map m)
> {
> - int j, glyph;
> unsigned short *t = translations[m];
> - unsigned char *q;
> + unsigned char *inv;
>
> - if (!p)
> + if (!dict)
> return;
> - q = p->inverse_translations[m];
> + inv = dict->inverse_translations[m];
>
> - if (!q) {
> - q = p->inverse_translations[m] = kmalloc(MAX_GLYPH, GFP_KERNEL);
> - if (!q)
> + if (!inv) {
> + inv = dict->inverse_translations[m] = kmalloc(MAX_GLYPH,
> + GFP_KERNEL);
> + if (!inv)
> return;
> }
> - memset(q, 0, MAX_GLYPH);
> + memset(inv, 0, MAX_GLYPH);
>
> - for (j = 0; j < ARRAY_SIZE(translations[i]); j++) {
> - glyph = conv_uni_to_pc(conp, t[j]);
> - if (glyph >= 0 && glyph < MAX_GLYPH && q[glyph] < 32) {
> + for (unsigned int ch = 0; ch < ARRAY_SIZE(translations[m]); ch++) {
This removes the compile error you introduced earlier. Other than that:
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> + int glyph = conv_uni_to_pc(conp, t[ch]);
> + if (glyph >= 0 && glyph < MAX_GLYPH && inv[glyph] < 32) {
> /* prefer '-' above SHY etc. */
> - q[glyph] = j;
> + inv[glyph] = ch;
> }
> }
> }
>
--
i.
next prev parent reply other threads:[~2022-06-14 8:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-14 7:57 [PATCH 1/7] tty/vt: consolemap: use ARRAY_SIZE(), part II Jiri Slaby
2022-06-14 7:57 ` [PATCH 2/7] tty/vt: consolemap: remove unused parameter from set_inverse_trans_unicode() Jiri Slaby
2022-06-14 7:57 ` [PATCH 3/7] tty/vt: consolemap: saner variable names in set_inverse_trans_unicode() Jiri Slaby
2022-06-14 7:57 ` [PATCH 4/7] tty/vt: consolemap: saner variable names in set_inverse_transl() Jiri Slaby
2022-06-14 8:35 ` Ilpo Järvinen [this message]
2022-06-14 8:40 ` Jiri Slaby
2022-06-14 7:57 ` [PATCH 5/7] tty/vt: consolemap: rename struct vc_data::vc_uni_pagedir* Jiri Slaby
2022-06-14 8:38 ` Ilpo Järvinen
2022-06-14 7:57 ` [PATCH 6/7] tty/vt: consolemap: improve UNI_*() macros definitions Jiri Slaby
2022-06-14 7:57 ` [PATCH 7/7] tty/vt: consolemap: remove dflt reset from con_do_clear_unimap() Jiri Slaby
2022-06-14 8:41 ` Ilpo Järvinen
2022-06-14 8:17 ` [PATCH 1/7] tty/vt: consolemap: use ARRAY_SIZE(), part II Ilpo Järvinen
2022-06-14 8:32 ` Ilpo Järvinen
2022-06-14 9:03 ` Jiri Slaby
2022-06-14 9:05 ` [PATCH v2 1/8] " Jiri Slaby
2022-06-14 9:05 ` [PATCH v2 2/8] tty/vt: consolemap: remove unused parameter from set_inverse_trans_unicode() Jiri Slaby
2022-06-14 9:05 ` [PATCH v2 3/8] tty/vt: consolemap: saner variable names in set_inverse_trans_unicode() Jiri Slaby
2022-06-14 9:05 ` [PATCH v2 4/8] tty/vt: consolemap: saner variable names in set_inverse_transl() Jiri Slaby
2022-06-14 9:05 ` [PATCH v2 5/8] tty/vt: consolemap: rename struct vc_data::vc_uni_pagedir* Jiri Slaby
2022-06-14 9:05 ` [PATCH v2 6/8] tty/vt: consolemap: improve UNI_*() macros definitions Jiri Slaby
2022-06-14 9:05 ` [PATCH v2 7/8] tty/vt: consolemap: remove dflt reset from con_do_clear_unimap() Jiri Slaby
2022-06-14 9:05 ` [PATCH v2 8/8] tty/vt: consolemap: use E_TABSZ for the translations size Jiri Slaby
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=74fc76bf-a7f-be34-10cd-412234990f1@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@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.