From 3786dd926514cc3e051d875328cc454a4eb9ca4c Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sat, 19 May 2007 09:20:37 +0300 Subject: [PATCH] UTF-8: Leave driver->opt initialization to set_screen_driver_opt. Don't bother to initialize driver->opt with memcpy in add_screen_driver. --- src/terminal/screen.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/terminal/screen.c b/src/terminal/screen.c index 2eb8d35a..4bcfd269 100644 --- a/src/terminal/screen.c +++ b/src/terminal/screen.c @@ -250,6 +250,8 @@ static const struct screen_driver *const 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 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); if (!driver) return NULL; - memcpy(driver, screen_drivers[type], sizeof(*driver) - 1); - memcpy(driver->name, term->spec->name, env_len + 1); - + /* These four operations fully initialize *driver. */ add_to_list(active_screen_drivers, driver); - + driver->type = type; set_screen_driver_opt(driver, term->spec); + memcpy(driver->name, term->spec->name, env_len + 1); term->spec->change_hook = screen_driver_change_hook;