Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: vt: remove char32_t typedef

It boils down to uint32_t, so use u32 directly, instead. This makes the
code more obvious.

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230112080136.4929-5-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
0c8414a6 4ba77bfb

+12 -14
+12 -14
drivers/tty/vt/vt.c
··· 316 316 * Code to manage unicode-based screen buffers 317 317 */ 318 318 319 - typedef uint32_t char32_t; 320 - 321 319 /* 322 320 * Our screen buffer is preceded by an array of line pointers so that 323 321 * scrolling only implies some pointer shuffling. 324 322 */ 325 323 struct uni_screen { 326 - char32_t *lines[0]; 324 + u32 *lines[0]; 327 325 }; 328 326 329 327 static struct uni_screen *vc_uniscr_alloc(unsigned int cols, unsigned int rows) ··· 358 360 vc->vc_uni_screen = new_uniscr; 359 361 } 360 362 361 - static void vc_uniscr_putc(struct vc_data *vc, char32_t uc) 363 + static void vc_uniscr_putc(struct vc_data *vc, u32 uc) 362 364 { 363 365 struct uni_screen *uniscr = vc->vc_uni_screen; 364 366 ··· 371 373 struct uni_screen *uniscr = vc->vc_uni_screen; 372 374 373 375 if (uniscr) { 374 - char32_t *ln = uniscr->lines[vc->state.y]; 376 + u32 *ln = uniscr->lines[vc->state.y]; 375 377 unsigned int x = vc->state.x, cols = vc->vc_cols; 376 378 377 379 memmove(&ln[x + nr], &ln[x], (cols - x - nr) * sizeof(*ln)); ··· 384 386 struct uni_screen *uniscr = vc->vc_uni_screen; 385 387 386 388 if (uniscr) { 387 - char32_t *ln = uniscr->lines[vc->state.y]; 389 + u32 *ln = uniscr->lines[vc->state.y]; 388 390 unsigned int x = vc->state.x, cols = vc->vc_cols; 389 391 390 392 memcpy(&ln[x], &ln[x + nr], (cols - x - nr) * sizeof(*ln)); ··· 398 400 struct uni_screen *uniscr = vc->vc_uni_screen; 399 401 400 402 if (uniscr) { 401 - char32_t *ln = uniscr->lines[vc->state.y]; 403 + u32 *ln = uniscr->lines[vc->state.y]; 402 404 403 405 memset32(&ln[x], ' ', nr); 404 406 } ··· 433 435 d = sz - nr; 434 436 } 435 437 for (i = 0; i < gcd(d, sz); i++) { 436 - char32_t *tmp = uniscr->lines[t + i]; 438 + u32 *tmp = uniscr->lines[t + i]; 437 439 j = i; 438 440 while (1) { 439 441 k = j + d; ··· 464 466 return; 465 467 466 468 while (src_top_row < src_bot_row) { 467 - char32_t *src_line = src->lines[src_top_row]; 468 - char32_t *dst_line = dst->lines[dst_row]; 469 + u32 *src_line = src->lines[src_top_row]; 470 + u32 *dst_line = dst->lines[dst_row]; 469 471 470 472 memcpy(dst_line, src_line, src_cols * sizeof(*src_line)); 471 473 if (dst_cols - src_cols) ··· 474 476 dst_row++; 475 477 } 476 478 while (dst_row < dst_rows) { 477 - char32_t *dst_line = dst->lines[dst_row]; 479 + u32 *dst_line = dst->lines[dst_row]; 478 480 479 481 memset32(dst_line, ' ', dst_cols); 480 482 dst_row++; ··· 514 516 p = (unsigned short *)vc->vc_origin; 515 517 mask = vc->vc_hi_font_mask | 0xff; 516 518 for (y = 0; y < vc->vc_rows; y++) { 517 - char32_t *line = uniscr->lines[y]; 519 + u32 *line = uniscr->lines[y]; 518 520 for (x = 0; x < vc->vc_cols; x++) { 519 521 u16 glyph = scr_readw(p++) & mask; 520 522 line[x] = inverse_translate(vc, glyph, true); ··· 548 550 */ 549 551 row = (pos - vc->vc_origin) / vc->vc_size_row; 550 552 col = ((pos - vc->vc_origin) % vc->vc_size_row) / 2; 551 - memcpy(dest, &uniscr->lines[row][col], nr * sizeof(char32_t)); 553 + memcpy(dest, &uniscr->lines[row][col], nr * sizeof(u32)); 552 554 } else { 553 555 /* 554 556 * Scrollback is active. For now let's simply backtranslate ··· 558 560 */ 559 561 u16 *p = (u16 *)pos; 560 562 int mask = vc->vc_hi_font_mask | 0xff; 561 - char32_t *uni_buf = dest; 563 + u32 *uni_buf = dest; 562 564 while (nr--) { 563 565 u16 glyph = scr_readw(p++) & mask; 564 566 *uni_buf++ = inverse_translate(vc, glyph, true);