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

tty/vt: consolemap: saner variable names in con_set_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-29-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5a79458c
...@@ -627,7 +627,7 @@ static struct uni_pagedict *con_unshare_unimap(struct vc_data *vc, ...@@ -627,7 +627,7 @@ static struct uni_pagedict *con_unshare_unimap(struct vc_data *vc,
int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list) int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
{ {
int err = 0, err1; int err = 0, err1;
struct uni_pagedict *p; struct uni_pagedict *dict;
struct unipair *unilist, *plist; struct unipair *unilist, *plist;
if (!ct) if (!ct)
...@@ -640,19 +640,19 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list) ...@@ -640,19 +640,19 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
console_lock(); console_lock();
/* Save original vc_unipagdir_loc in case we allocate a new one */ /* Save original vc_unipagdir_loc in case we allocate a new one */
p = *vc->vc_uni_pagedir_loc; dict = *vc->vc_uni_pagedir_loc;
if (!p) { if (!dict) {
err = -EINVAL; err = -EINVAL;
goto out_unlock; goto out_unlock;
} }
if (p->refcount > 1) { if (dict->refcount > 1) {
p = con_unshare_unimap(vc, p); dict = con_unshare_unimap(vc, dict);
if (IS_ERR(p)) { if (IS_ERR(dict)) {
err = PTR_ERR(p); err = PTR_ERR(dict);
goto out_unlock; goto out_unlock;
} }
} else if (p == dflt) { } else if (dict == dflt) {
dflt = NULL; dflt = NULL;
} }
...@@ -660,7 +660,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list) ...@@ -660,7 +660,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
* Insert user specified unicode pairs into new table. * Insert user specified unicode pairs into new table.
*/ */
for (plist = unilist; ct; ct--, plist++) { for (plist = unilist; ct; ct--, plist++) {
err1 = con_insert_unipair(p, plist->unicode, plist->fontpos); err1 = con_insert_unipair(dict, plist->unicode, plist->fontpos);
if (err1) if (err1)
err = err1; err = err1;
} }
...@@ -668,12 +668,12 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list) ...@@ -668,12 +668,12 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
/* /*
* Merge with fontmaps of any other virtual consoles. * Merge with fontmaps of any other virtual consoles.
*/ */
if (con_unify_unimap(vc, p)) if (con_unify_unimap(vc, dict))
goto out_unlock; goto out_unlock;
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 inverse translations */ set_inverse_transl(vc, dict, m);
set_inverse_trans_unicode(vc, p); set_inverse_trans_unicode(vc, dict);
out_unlock: out_unlock:
console_unlock(); console_unlock();
......
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