mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-14 15:54:15 +08:00
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>
This commit is contained in:
parent
ff4606acb4
commit
1a086f5d63
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user