diff options
author | sebres <sebres@users.sourceforge.net> | 2017-01-10 22:38:56 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2017-01-10 22:38:56 (GMT) |
commit | 9487f2cdcd7045ccc7f540099755acc0d2b36244 (patch) | |
tree | 4c5454ef6d689584f27bacbb860cdb9390f5c722 /generic/tclClockFmt.c | |
parent | fb0ed853e7c49ff24e17f4cb633876d0780b64b5 (diff) | |
download | tcl-9487f2cdcd7045ccc7f540099755acc0d2b36244.zip tcl-9487f2cdcd7045ccc7f540099755acc0d2b36244.tar.gz tcl-9487f2cdcd7045ccc7f540099755acc0d2b36244.tar.bz2 |
locale months scan switched to from list seek to index tree; bug fixing
Diffstat (limited to 'generic/tclClockFmt.c')
-rw-r--r-- | generic/tclClockFmt.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 92040d8..478941b 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -682,6 +682,7 @@ ClockMCGetMultiListIdxTree( } ClockMCSetIdx(opts, mcKey, objPtr); + objPtr = NULL; }; done: @@ -788,22 +789,24 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; */ + static int monthsKeys[] = {MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, 0}; + int ret, val; int minLen, maxLen; + TclStrIdxTree *idxTree; DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); - ret = LocaleListSearch(opts, info, MCLIT_MONTHS_FULL, &val, - minLen, maxLen); + /* get or create tree in msgcat dict */ + + idxTree = ClockMCGetMultiListIdxTree(opts, MCLIT_MONTHS_COMB, monthsKeys); + if (idxTree == NULL) { + return TCL_ERROR; + } + + ret = ClockStrIdxTreeSearch(opts, info, idxTree, &val, minLen, maxLen); if (ret != TCL_OK) { - /* if not found */ - if (ret == TCL_RETURN) { - ret = LocaleListSearch(opts, info, MCLIT_MONTHS_ABBREV, &val, - minLen, maxLen); - } - if (ret != TCL_OK) { - return ret; - } + return ret; } yyMonth = val + 1; |