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

tty/vt: consolemap: saner variable names in con_do_clear_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-24-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c3fd9f71
...@@ -531,24 +531,23 @@ con_insert_unipair(struct uni_pagedict *p, u_short unicode, u_short fontpos) ...@@ -531,24 +531,23 @@ con_insert_unipair(struct uni_pagedict *p, u_short unicode, u_short fontpos)
/* Caller must hold the lock */ /* Caller must hold the lock */
static int con_do_clear_unimap(struct vc_data *vc) static int con_do_clear_unimap(struct vc_data *vc)
{ {
struct uni_pagedict *p, *q; struct uni_pagedict *old = *vc->vc_uni_pagedir_loc;
p = *vc->vc_uni_pagedir_loc; if (!old || --old->refcount) {
if (!p || --p->refcount) { struct uni_pagedict *new = kzalloc(sizeof(*new), GFP_KERNEL);
q = kzalloc(sizeof(*p), GFP_KERNEL); if (!new) {
if (!q) { if (old)
if (p) old->refcount++;
p->refcount++;
return -ENOMEM; return -ENOMEM;
} }
q->refcount=1; new->refcount = 1;
*vc->vc_uni_pagedir_loc = q; *vc->vc_uni_pagedir_loc = new;
} else { } else {
if (p == dflt) if (old == dflt)
dflt = NULL; dflt = NULL;
p->refcount++; old->refcount++;
p->sum = 0; old->sum = 0;
con_release_unimap(p); con_release_unimap(old);
} }
return 0; return 0;
} }
......
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