diff options
author | Jiri Slaby | 2022-06-07 12:49:40 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2022-06-10 13:37:03 +0200 |
commit | 1a086f5d63ae3f9bfa85a6ddfc3c377315a56187 (patch) | |
tree | b84759dbfb27e2f3d341c9eaaeb959143a159ab5 /drivers/tty/vt | |
parent | ff4606acb4dcf05c49a6053c26f1bacb5753d200 (diff) |
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: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220607104946.18710-30-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r-- | drivers/tty/vt/consolemap.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c index 65c83f9228e9..8abf114b6c68 100644 --- a/drivers/tty/vt/consolemap.c +++ b/drivers/tty/vt/consolemap.c @@ -694,49 +694,50 @@ out_unlock: */ int con_set_default_unimap(struct vc_data *vc) { - int i, j, err = 0, err1; - u16 *q; - struct uni_pagedict *p; + struct uni_pagedict *dict; + unsigned int fontpos, count; + int err = 0, err1; + u16 *dfont; if (dflt) { - p = *vc->vc_uni_pagedir_loc; - if (p == dflt) + dict = *vc->vc_uni_pagedir_loc; + if (dict == dflt) return 0; dflt->refcount++; *vc->vc_uni_pagedir_loc = dflt; - if (p && !--p->refcount) { - con_release_unimap(p); - kfree(p); + if (dict && !--dict->refcount) { + con_release_unimap(dict); + kfree(dict); } return 0; } - + /* The default font is always 256 characters */ err = con_do_clear_unimap(vc); if (err) return err; - - p = *vc->vc_uni_pagedir_loc; - q = dfont_unitable; - - for (i = 0; i < 256; i++) - for (j = dfont_unicount[i]; j; j--) { - err1 = con_insert_unipair(p, *(q++), i); + + dict = *vc->vc_uni_pagedir_loc; + dfont = dfont_unitable; + + for (fontpos = 0; fontpos < 256U; fontpos++) + for (count = dfont_unicount[fontpos]; count; count--) { + err1 = con_insert_unipair(dict, *(dfont++), fontpos); if (err1) err = err1; } - - if (con_unify_unimap(vc, p)) { + + if (con_unify_unimap(vc, dict)) { dflt = *vc->vc_uni_pagedir_loc; return err; } for (enum translation_map m = FIRST_MAP; m <= LAST_MAP; m++) - set_inverse_transl(vc, p, m); /* Update all inverse translations */ - set_inverse_trans_unicode(vc, p); - dflt = p; + set_inverse_transl(vc, dict, m); + set_inverse_trans_unicode(vc, dict); + dflt = dict; return err; } EXPORT_SYMBOL(con_set_default_unimap); |