mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
UTF-8: Leave driver->opt initialization to set_screen_driver_opt.
Don't bother to initialize driver->opt with memcpy in add_screen_driver.
This commit is contained in:
parent
f8fdf6a93d
commit
3786dd9265
@ -250,6 +250,8 @@ static const struct screen_driver *const screen_drivers[] = {
|
|||||||
|
|
||||||
static INIT_LIST_HEAD(active_screen_drivers);
|
static INIT_LIST_HEAD(active_screen_drivers);
|
||||||
|
|
||||||
|
/* Set driver->opt according to driver->type and term_spec.
|
||||||
|
* Other members of *driver need not have been initialized. */
|
||||||
static void
|
static void
|
||||||
set_screen_driver_opt(struct screen_driver *driver, struct option *term_spec)
|
set_screen_driver_opt(struct screen_driver *driver, struct option *term_spec)
|
||||||
{
|
{
|
||||||
@ -365,12 +367,11 @@ add_screen_driver(enum term_mode_type type, struct terminal *term, int env_len)
|
|||||||
driver = mem_alloc(sizeof(*driver) + env_len);
|
driver = mem_alloc(sizeof(*driver) + env_len);
|
||||||
if (!driver) return NULL;
|
if (!driver) return NULL;
|
||||||
|
|
||||||
memcpy(driver, screen_drivers[type], sizeof(*driver) - 1);
|
/* These four operations fully initialize *driver. */
|
||||||
memcpy(driver->name, term->spec->name, env_len + 1);
|
|
||||||
|
|
||||||
add_to_list(active_screen_drivers, driver);
|
add_to_list(active_screen_drivers, driver);
|
||||||
|
driver->type = type;
|
||||||
set_screen_driver_opt(driver, term->spec);
|
set_screen_driver_opt(driver, term->spec);
|
||||||
|
memcpy(driver->name, term->spec->name, env_len + 1);
|
||||||
|
|
||||||
term->spec->change_hook = screen_driver_change_hook;
|
term->spec->change_hook = screen_driver_change_hook;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user