summaryrefslogtreecommitdiffstats
path: root/generic/tclClockFmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclClockFmt.c')
-rw-r--r--generic/tclClockFmt.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c
index a616074..4ab2423 100644
--- a/generic/tclClockFmt.c
+++ b/generic/tclClockFmt.c
@@ -558,7 +558,7 @@ ClockFmtScnStorageAllocProc(
allocsize -= sizeof(hPtr->key);
}
- fss = (ClockFmtScnStorage *)ckalloc(allocsize);
+ fss = (ClockFmtScnStorage *)Tcl_Alloc(allocsize);
/* initialize */
memset(fss, 0, sizeof(*fss));
@@ -590,17 +590,17 @@ ClockFmtScnStorageFreeProc(
ClockFmtScnStorage *fss = FmtScn4HashEntry(hPtr);
if (fss->scnTok != NULL) {
- ckfree(fss->scnTok);
+ Tcl_Free(fss->scnTok);
fss->scnTok = NULL;
fss->scnTokC = 0;
}
if (fss->fmtTok != NULL) {
- ckfree(fss->fmtTok);
+ Tcl_Free(fss->fmtTok);
fss->fmtTok = NULL;
fss->fmtTokC = 0;
}
- ckfree(fss);
+ Tcl_Free(fss);
}
/*
@@ -637,7 +637,8 @@ static const Tcl_ObjType ClockFmtObjType = {
ClockFmtObj_FreeInternalRep, /* freeIntRepProc */
ClockFmtObj_DupInternalRep, /* dupIntRepProc */
ClockFmtObj_UpdateString, /* updateStringProc */
- ClockFmtObj_SetFromAny /* setFromAnyProc */
+ ClockFmtObj_SetFromAny, /* setFromAnyProc */
+ TCL_OBJTYPE_V0
};
#define ObjClockFmtScn(objPtr) \
@@ -670,7 +671,7 @@ ClockFmtObj_DupInternalRep(
/* if no format representation, dup string representation */
if (fss == NULL) {
- copyPtr->bytes = (char *)ckalloc(srcPtr->length + 1);
+ copyPtr->bytes = (char *)Tcl_Alloc(srcPtr->length + 1);
memcpy(copyPtr->bytes, srcPtr->bytes, srcPtr->length + 1);
copyPtr->length = srcPtr->length;
}
@@ -737,7 +738,7 @@ ClockFmtObj_UpdateString(
}
len = strlen(name);
objPtr->length = len++,
- objPtr->bytes = (char *)attemptckalloc(len);
+ objPtr->bytes = (char *)Tcl_AttemptAlloc(len);
if (objPtr->bytes) {
memcpy(objPtr->bytes, name, len);
}
@@ -2143,7 +2144,7 @@ EstimateTokenCount(
#define AllocTokenInChain(tok, chain, tokCnt, type) \
if (++(tok) >= (chain) + (tokCnt)) { \
- chain = (type)attemptckrealloc((char *)(chain), \
+ chain = (type)Tcl_AttemptRealloc((char *)(chain), \
(tokCnt + CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE) * sizeof(*(tok))); \
if ((chain) == NULL) { \
goto done; \
@@ -2189,7 +2190,7 @@ ClockGetOrParseScanFormat(
fss->scnSpaceCount = 0;
- scnTok = tok = (ClockScanToken *)ckalloc(sizeof(*tok) * fss->scnTokC);
+ scnTok = tok = (ClockScanToken *)Tcl_Alloc(sizeof(*tok) * fss->scnTokC);
memset(tok, 0, sizeof(*tok));
tokCnt = 1;
while (p < e) {
@@ -2341,7 +2342,7 @@ ClockGetOrParseScanFormat(
* (1 is acceptable delta to prevent memory fragmentation) */
if (fss->scnTokC > tokCnt + (CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE / 2)) {
if ((tok = (ClockScanToken *)
- attemptckrealloc(scnTok, tokCnt * sizeof(*tok))) != NULL) {
+ Tcl_AttemptRealloc(scnTok, tokCnt * sizeof(*tok))) != NULL) {
scnTok = tok;
}
}
@@ -2732,13 +2733,13 @@ FrmResultAllocate(
char *newRes;
/* differentiate between stack and memory */
if (!FrmResultIsAllocated(dateFmt)) {
- newRes = (char *)attemptckalloc(newsize);
+ newRes = (char *)Tcl_AttemptAlloc(newsize);
if (newRes == NULL) {
return TCL_ERROR;
}
memcpy(newRes, dateFmt->resMem, dateFmt->output - dateFmt->resMem);
} else {
- newRes = (char *)attemptckrealloc(dateFmt->resMem, newsize);
+ newRes = (char *)Tcl_AttemptRealloc(dateFmt->resMem, newsize);
if (newRes == NULL) {
return TCL_ERROR;
}
@@ -3264,7 +3265,7 @@ ClockGetOrParseFmtFormat(
/* estimate token count by % char and format length */
fss->fmtTokC = EstimateTokenCount(p, e);
- fmtTok = tok = (ClockFormatToken *)ckalloc(sizeof(*tok) * fss->fmtTokC);
+ fmtTok = tok = (ClockFormatToken *)Tcl_Alloc(sizeof(*tok) * fss->fmtTokC);
memset(tok, 0, sizeof(*tok));
tokCnt = 1;
while (p < e) {
@@ -3359,7 +3360,7 @@ ClockGetOrParseFmtFormat(
* (1 is acceptable delta to prevent memory fragmentation) */
if (fss->fmtTokC > tokCnt + (CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE / 2)) {
if ((tok = (ClockFormatToken *)
- attemptckrealloc(fmtTok, tokCnt * sizeof(*tok))) != NULL) {
+ Tcl_AttemptRealloc(fmtTok, tokCnt * sizeof(*tok))) != NULL) {
fmtTok = tok;
}
}
@@ -3400,7 +3401,7 @@ ClockFormat(
dateFmt->resMem = resMem;
dateFmt->resEnd = dateFmt->resMem + sizeof(resMem);
if (fss->fmtMinAlloc > sizeof(resMem)) {
- dateFmt->resMem = (char *)attemptckalloc(fss->fmtMinAlloc);
+ dateFmt->resMem = (char *)Tcl_AttemptAlloc(fss->fmtMinAlloc);
if (dateFmt->resMem == NULL) {
return TCL_ERROR;
}
@@ -3512,7 +3513,7 @@ ClockFormat(
error:
if (dateFmt->resMem != resMem) {
- ckfree(dateFmt->resMem);
+ Tcl_Free(dateFmt->resMem);
}
dateFmt->resMem = NULL;
@@ -3525,13 +3526,13 @@ ClockFormat(
result->length = dateFmt->output - dateFmt->resMem;
size = result->length + 1;
if (dateFmt->resMem == resMem) {
- result->bytes = (char *)attemptckalloc(size);
+ result->bytes = (char *)Tcl_AttemptAlloc(size);
if (result->bytes == NULL) {
return TCL_ERROR;
}
memcpy(result->bytes, dateFmt->resMem, size);
} else if ((dateFmt->resEnd - dateFmt->resMem) / size > MAX_FMT_RESULT_THRESHOLD) {
- result->bytes = (char *)attemptckrealloc(dateFmt->resMem, size);
+ result->bytes = (char *)Tcl_AttemptRealloc(dateFmt->resMem, size);
if (result->bytes == NULL) {
result->bytes = dateFmt->resMem;
}