mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-10 04:24:17 +08:00
tty/vt: consolemap: saner variable names in con_unify_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-23-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d4a2245b8b
commit
c3fd9f7121
@ -454,42 +454,41 @@ void con_free_unimap(struct vc_data *vc)
|
|||||||
kfree(p);
|
kfree(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int con_unify_unimap(struct vc_data *conp, struct uni_pagedict *p)
|
static int con_unify_unimap(struct vc_data *conp, struct uni_pagedict *dict1)
|
||||||
{
|
{
|
||||||
int i, j, k;
|
struct uni_pagedict *dict2;
|
||||||
struct uni_pagedict *q;
|
unsigned int cons, d, r;
|
||||||
|
|
||||||
for (i = 0; i < MAX_NR_CONSOLES; i++) {
|
for (cons = 0; cons < MAX_NR_CONSOLES; cons++) {
|
||||||
if (!vc_cons_allocated(i))
|
if (!vc_cons_allocated(cons))
|
||||||
continue;
|
continue;
|
||||||
q = *vc_cons[i].d->vc_uni_pagedir_loc;
|
dict2 = *vc_cons[cons].d->vc_uni_pagedir_loc;
|
||||||
if (!q || q == p || q->sum != p->sum)
|
if (!dict2 || dict2 == dict1 || dict2->sum != dict1->sum)
|
||||||
continue;
|
continue;
|
||||||
for (j = 0; j < UNI_DIRS; j++) {
|
for (d = 0; d < UNI_DIRS; d++) {
|
||||||
u16 **p1, **q1;
|
u16 **dir1 = dict1->uni_pgdir[d];
|
||||||
p1 = p->uni_pgdir[j];
|
u16 **dir2 = dict2->uni_pgdir[d];
|
||||||
q1 = q->uni_pgdir[j];
|
if (!dir1 && !dir2)
|
||||||
if (!p1 && !q1)
|
|
||||||
continue;
|
continue;
|
||||||
if (!p1 || !q1)
|
if (!dir1 || !dir2)
|
||||||
break;
|
break;
|
||||||
for (k = 0; k < UNI_DIR_ROWS; k++) {
|
for (r = 0; r < UNI_DIR_ROWS; r++) {
|
||||||
if (!p1[k] && !q1[k])
|
if (!dir1[r] && !dir2[r])
|
||||||
continue;
|
continue;
|
||||||
if (!p1[k] || !q1[k])
|
if (!dir1[r] || !dir2[r])
|
||||||
break;
|
break;
|
||||||
if (memcmp(p1[k], q1[k], UNI_ROW_GLYPHS *
|
if (memcmp(dir1[r], dir2[r], UNI_ROW_GLYPHS *
|
||||||
sizeof(*p1[k])))
|
sizeof(*dir1[r])))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (k < UNI_DIR_ROWS)
|
if (r < UNI_DIR_ROWS)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (j == UNI_DIRS) {
|
if (d == UNI_DIRS) {
|
||||||
q->refcount++;
|
dict2->refcount++;
|
||||||
*conp->vc_uni_pagedir_loc = q;
|
*conp->vc_uni_pagedir_loc = dict2;
|
||||||
con_release_unimap(p);
|
con_release_unimap(dict1);
|
||||||
kfree(p);
|
kfree(dict1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user