diff options
author | treectrl <treectrl> | 2006-11-19 23:37:57 (GMT) |
---|---|---|
committer | treectrl <treectrl> | 2006-11-19 23:37:57 (GMT) |
commit | b289820a7e3f5cee2cb35ed34260587f12f9cb3c (patch) | |
tree | ab82b416ff129ae8a693e58efc2e8e0fb5c2f820 /generic | |
parent | a43d62741070ed4384fdedcf01f4d656f4a88cea (diff) | |
download | tktreectrl-b289820a7e3f5cee2cb35ed34260587f12f9cb3c.zip tktreectrl-b289820a7e3f5cee2cb35ed34260587f12f9cb3c.tar.gz tktreectrl-b289820a7e3f5cee2cb35ed34260587f12f9cb3c.tar.bz2 |
Use OptionSpec_Find in a few places.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkTreeElem.c | 63 |
1 files changed, 21 insertions, 42 deletions
diff --git a/generic/tkTreeElem.c b/generic/tkTreeElem.c index 4671014..ff349cc 100644 --- a/generic/tkTreeElem.c +++ b/generic/tkTreeElem.c @@ -5,7 +5,7 @@ * * Copyright (c) 2002-2006 Tim Baker * - * RCS: @(#) $Id: tkTreeElem.c,v 1.49 2006/11/03 18:55:30 treectrl Exp $ + * RCS: @(#) $Id: tkTreeElem.c,v 1.50 2006/11/19 23:37:57 treectrl Exp $ */ #include "tkTreeCtrl.h" @@ -402,17 +402,11 @@ static void StringTableRestore( int BooleanCO_Init(Tk_OptionSpec *optionTable, CONST char *optionName) { - int i; - - for (i = 0; optionTable[i].type != TK_OPTION_END; i++) { - if (!strcmp(optionTable[i].optionName, optionName)) { + Tk_OptionSpec *specPtr; - /* Update the option table */ - optionTable[i].clientData = (ClientData) &booleanCO; - return TCL_OK; - } - } - return TCL_ERROR; + specPtr = OptionSpec_Find(optionTable, optionName); + specPtr->clientData = &booleanCO; + return TCL_OK; } Tk_ObjCustomOption * @@ -456,26 +450,17 @@ IntegerCO_Init( int flags ) { - Tk_ObjCustomOption *co; - int i; - - for (i = 0; optionTable[i].type != TK_OPTION_END; i++) { - if (!strcmp(optionTable[i].optionName, optionName)) { + Tk_OptionSpec *specPtr; - if (optionTable[i].type != TK_OPTION_CUSTOM) - panic("IntegerCO_Init: %s is not TK_OPTION_CUSTOM", optionName); + specPtr = OptionSpec_Find(optionTable, optionName); + if (specPtr->type != TK_OPTION_CUSTOM) + panic("IntegerCO_Init: %s is not TK_OPTION_CUSTOM", optionName); + if (specPtr->clientData != NULL) + return TCL_OK; - if (optionTable[i].clientData != NULL) - return TCL_OK; + specPtr->clientData = IntegerCO_Alloc(optionName, min, max, empty, flags); - co = IntegerCO_Alloc(optionName, min, max, empty, flags); - - /* Update the option table */ - optionTable[i].clientData = (ClientData) co; - return TCL_OK; - } - } - return TCL_ERROR; + return TCL_OK; } Tk_ObjCustomOption * @@ -506,23 +491,17 @@ StringTableCO_Alloc( int StringTableCO_Init(Tk_OptionSpec *optionTable, CONST char *optionName, CONST char **tablePtr) { - Tk_ObjCustomOption *co; - int i; + Tk_OptionSpec *specPtr; - for (i = 0; optionTable[i].type != TK_OPTION_END; i++) { - if (!strcmp(optionTable[i].optionName, optionName)) { + specPtr = OptionSpec_Find(optionTable, optionName); + if (specPtr->type != TK_OPTION_CUSTOM) + panic("StringTableCO_Init: %s is not TK_OPTION_CUSTOM", optionName); + if (specPtr->clientData != NULL) + return TCL_OK; - if (optionTable[i].clientData != NULL) - return TCL_OK; + specPtr->clientData = StringTableCO_Alloc(optionName, tablePtr); - co = StringTableCO_Alloc(optionName, tablePtr); - - /* Update the option table */ - optionTable[i].clientData = (ClientData) co; - return TCL_OK; - } - } - return TCL_ERROR; + return TCL_OK; } /*****/ |