Commit d524e1c7 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

tty/vt: consolemap: saner variable names in set_inverse_transl()

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.
Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220614090537.15557-4-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a7311228
...@@ -214,29 +214,29 @@ struct uni_pagedict { ...@@ -214,29 +214,29 @@ struct uni_pagedict {
static struct uni_pagedict *dflt; 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) enum translation_map m)
{ {
int j, glyph;
unsigned short *t = translations[m]; unsigned short *t = translations[m];
unsigned char *q; unsigned char *inv;
if (!p) if (!dict)
return; return;
q = p->inverse_translations[m]; inv = dict->inverse_translations[m];
if (!q) { if (!inv) {
q = p->inverse_translations[m] = kmalloc(MAX_GLYPH, GFP_KERNEL); inv = dict->inverse_translations[m] = kmalloc(MAX_GLYPH,
if (!q) GFP_KERNEL);
if (!inv)
return; return;
} }
memset(q, 0, MAX_GLYPH); memset(inv, 0, MAX_GLYPH);
for (j = 0; j < ARRAY_SIZE(translations[m]); j++) { for (unsigned int ch = 0; ch < ARRAY_SIZE(translations[m]); ch++) {
glyph = conv_uni_to_pc(conp, t[j]); int glyph = conv_uni_to_pc(conp, t[ch]);
if (glyph >= 0 && glyph < MAX_GLYPH && q[glyph] < 32) { if (glyph >= 0 && glyph < MAX_GLYPH && inv[glyph] < 32) {
/* prefer '-' above SHY etc. */ /* prefer '-' above SHY etc. */
q[glyph] = j; inv[glyph] = ch;
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment