summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2017-05-29 20:37:35 (GMT)
committersebres <sebres@users.sourceforge.net>2017-05-29 20:37:35 (GMT)
commit1f3b8ce93addfdc476ac5ee7f33c5fb90c5ab5e1 (patch)
treed39bd40f728131f480c6524b56e03af473c3cb37
parent072ced07bed0a287c473e942e7249ec197709cda (diff)
parent887b450f7e64e2426a51e06246cb9295b126932c (diff)
downloadtcl-1f3b8ce93addfdc476ac5ee7f33c5fb90c5ab5e1.zip
tcl-1f3b8ce93addfdc476ac5ee7f33c5fb90c5ab5e1.tar.gz
tcl-1f3b8ce93addfdc476ac5ee7f33c5fb90c5ab5e1.tar.bz2
merge sebres-8-6-clock-speedupsebres_trunk_clock_speedup
-rw-r--r--generic/tclClock.c15
-rw-r--r--generic/tclClockFmt.c5
2 files changed, 11 insertions, 9 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c
index 3ef9e91..4577288 100644
--- a/generic/tclClock.c
+++ b/generic/tclClock.c
@@ -3110,14 +3110,19 @@ ClockParseFmtScnArgs(
/* Base (by scan or add) or clock value (by format) */
if (opts->baseObj != NULL) {
- if (TclGetWideIntFromObj(NULL, opts->baseObj, &baseVal) != TCL_OK) {
+ register Tcl_Obj *baseObj = opts->baseObj;
+ /* bypass integer recognition if looks like option "-now" */
+ if (
+ (baseObj->length == 4 && baseObj->bytes && *(baseObj->bytes+1) == 'n') ||
+ TclGetWideIntFromObj(NULL, baseObj, &baseVal) != TCL_OK
+ ) {
/* we accept "-now" as current date-time */
- const char *const nowOpts[] = {
+ static const char *const nowOpts[] = {
"-now", NULL
};
int idx;
- if (Tcl_GetIndexFromObj(NULL, opts->baseObj, nowOpts, "seconds or -now",
+ if (Tcl_GetIndexFromObj(NULL, baseObj, nowOpts, "seconds or -now",
TCL_EXACT, &idx) == TCL_OK
) {
goto baseNow;
@@ -3125,7 +3130,7 @@ ClockParseFmtScnArgs(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected integer but got \"%s\"",
- Tcl_GetString(opts->baseObj)));
+ Tcl_GetString(baseObj)));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INTEGER", NULL);
i = 1;
goto badOption;
@@ -3135,7 +3140,7 @@ ClockParseFmtScnArgs(
* that it isn't.
*/
- if (opts->baseObj->typePtr == &tclBignumType) {
+ if (baseObj->typePtr == &tclBignumType) {
Tcl_SetObjResult(interp, dataPtr->literals[LIT_INTEGER_VALUE_TOO_LARGE]);
return TCL_ERROR;
}
diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c
index d3cb339..d923ede 100644
--- a/generic/tclClockFmt.c
+++ b/generic/tclClockFmt.c
@@ -34,9 +34,6 @@ static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss);
static void ClockFrmScnFinalize(ClientData clientData);
-/* Msgcat index literals prefixed with _IDX_, used for quick dictionary search */
-CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLitIdxs, "_IDX_");
-
/*
* Clock scan and format facilities.
*/
@@ -1906,7 +1903,7 @@ EstimateTokenCount(
#define AllocTokenInChain(tok, chain, tokCnt) \
if (++(tok) >= (chain) + (tokCnt)) { \
- *((char **)&chain) = ckrealloc((char *)(chain), \
+ chain = ckrealloc((char *)(chain), \
(tokCnt + CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE) * sizeof(*(tok))); \
if ((chain) == NULL) { goto done; }; \
(tok) = (chain) + (tokCnt); \