diff options
Diffstat (limited to 'Src/Modules/terminfo.c')
-rw-r--r-- | Src/Modules/terminfo.c | 42 |
1 files changed, 11 insertions, 31 deletions
diff --git a/Src/Modules/terminfo.c b/Src/Modules/terminfo.c index 6e9e32588..610df5a6d 100644 --- a/Src/Modules/terminfo.c +++ b/Src/Modules/terminfo.c @@ -165,9 +165,7 @@ createtihash() return NULL; pm->level = pm->old ? locallevel : 0; - pm->gets.hfn = hashgetfn; - pm->sets.hfn = hashsetfn; - pm->unsetfn = stdunsetfn; + pm->gsu.h = &stdhash_gsu; pm->u.hash = ht = newhashtable(7, terminfo_nam, NULL); ht->hash = hasher; @@ -201,42 +199,32 @@ getterminfo(UNUSED(HashTable ht), char *name) unmetafy(name, &len); - pm = (Param) zhalloc(sizeof(struct param)); + pm = (Param) hcalloc(sizeof(struct param)); pm->nam = dupstring(name); pm->flags = PM_READONLY; - pm->unsetfn = NULL; - pm->ct = 0; - pm->env = NULL; - pm->ename = NULL; - pm->old = NULL; - pm->level = 0; if (((num = tigetnum(name)) != -1) && (num != -2)) { pm->u.val = num; pm->flags |= PM_INTEGER; - pm->sets.ifn = NULL; - pm->gets.ifn = intgetfn; + pm->gsu.i = &nullsetinteger_gsu; } else if ((num = tigetflag(name)) != -1) { pm->u.str = num ? dupstring("yes") : dupstring("no"); pm->flags |= PM_SCALAR; - pm->sets.cfn = NULL; - pm->gets.cfn = strgetfn; + pm->gsu.s = &nullsetscalar_gsu; } else if ((tistr = (char *)tigetstr(name)) != NULL && tistr != (char *)-1) { pm->u.str = dupstring(tistr); pm->flags |= PM_SCALAR; - pm->sets.cfn = NULL; - pm->gets.cfn = strgetfn; + pm->gsu.s = &nullsetscalar_gsu; } else { /* zwarn("no such capability: %s", name, 0); */ pm->u.str = dupstring(""); pm->flags |= PM_UNSET; - pm->sets.cfn = NULL; - pm->gets.cfn = strgetfn; + pm->gsu.s = &nullsetscalar_gsu; } return (HashNode) pm; } @@ -319,16 +307,10 @@ scanterminfo(UNUSED(HashTable ht), ScanFunc func, int flags) "slength", NULL}; #endif - pm = (Param) zhalloc(sizeof(struct param)); - pm->unsetfn = NULL; - pm->ct = 0; - pm->env = NULL; - pm->ename = NULL; - pm->old = NULL; - + pm = (Param) hcalloc(sizeof(struct param)); + pm->flags = PM_READONLY | PM_SCALAR; - pm->sets.cfn = NULL; - pm->gets.cfn = strgetfn; + pm->gsu.s = &nullsetscalar_gsu; for (capname = (char **)boolnames; *capname; capname++) { if ((num = tigetflag(*capname)) != -1) { @@ -339,8 +321,7 @@ scanterminfo(UNUSED(HashTable ht), ScanFunc func, int flags) } pm->flags = PM_READONLY | PM_INTEGER; - pm->sets.ifn = NULL; - pm->gets.ifn = intgetfn; + pm->gsu.i = &nullsetinteger_gsu; for (capname = (char **)numnames; *capname; capname++) { if (((num = tigetnum(*capname)) != -1) && (num != -2)) { @@ -351,8 +332,7 @@ scanterminfo(UNUSED(HashTable ht), ScanFunc func, int flags) } pm->flags = PM_READONLY | PM_SCALAR; - pm->sets.cfn = NULL; - pm->gets.cfn = strgetfn; + pm->gsu.s = &nullsetscalar_gsu; for (capname = (char **)strnames; *capname; capname++) { if ((tistr = (char *)tigetstr(*capname)) != NULL && |