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

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

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: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220607104946.18710-30-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ff4606ac
...@@ -694,49 +694,50 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list) ...@@ -694,49 +694,50 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
*/ */
int con_set_default_unimap(struct vc_data *vc) int con_set_default_unimap(struct vc_data *vc)
{ {
int i, j, err = 0, err1; struct uni_pagedict *dict;
u16 *q; unsigned int fontpos, count;
struct uni_pagedict *p; int err = 0, err1;
u16 *dfont;
if (dflt) { if (dflt) {
p = *vc->vc_uni_pagedir_loc; dict = *vc->vc_uni_pagedir_loc;
if (p == dflt) if (dict == dflt)
return 0; return 0;
dflt->refcount++; dflt->refcount++;
*vc->vc_uni_pagedir_loc = dflt; *vc->vc_uni_pagedir_loc = dflt;
if (p && !--p->refcount) { if (dict && !--dict->refcount) {
con_release_unimap(p); con_release_unimap(dict);
kfree(p); kfree(dict);
} }
return 0; return 0;
} }
/* The default font is always 256 characters */ /* The default font is always 256 characters */
err = con_do_clear_unimap(vc); err = con_do_clear_unimap(vc);
if (err) if (err)
return err; return err;
p = *vc->vc_uni_pagedir_loc; dict = *vc->vc_uni_pagedir_loc;
q = dfont_unitable; dfont = dfont_unitable;
for (i = 0; i < 256; i++) for (fontpos = 0; fontpos < 256U; fontpos++)
for (j = dfont_unicount[i]; j; j--) { for (count = dfont_unicount[fontpos]; count; count--) {
err1 = con_insert_unipair(p, *(q++), i); err1 = con_insert_unipair(dict, *(dfont++), fontpos);
if (err1) if (err1)
err = err1; err = err1;
} }
if (con_unify_unimap(vc, p)) { if (con_unify_unimap(vc, dict)) {
dflt = *vc->vc_uni_pagedir_loc; dflt = *vc->vc_uni_pagedir_loc;
return err; return err;
} }
for (enum translation_map m = FIRST_MAP; m <= LAST_MAP; m++) for (enum translation_map m = FIRST_MAP; m <= LAST_MAP; m++)
set_inverse_transl(vc, p, m); /* Update all inverse translations */ set_inverse_transl(vc, dict, m);
set_inverse_trans_unicode(vc, p); set_inverse_trans_unicode(vc, dict);
dflt = p; dflt = dict;
return err; return err;
} }
EXPORT_SYMBOL(con_set_default_unimap); EXPORT_SYMBOL(con_set_default_unimap);
......
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