diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-03-03 16:23:20 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-03-07 00:06:24 +0000 |
commit | b1b54c50d0e5851d72c1e7aff4057687be2e447e (patch) | |
tree | 9f58e135805accd2ce2bd0bf57d19a02c44064e4 /src/TMstate.c | |
parent | 4ece1c842a08c11c1f84b95355801d41cd8435b1 (diff) |
Replace XtRealloc() calls with XtReallocArray()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src/TMstate.c')
-rw-r--r-- | src/TMstate.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/TMstate.c b/src/TMstate.c index e4893eb..7a5a04d 100644 --- a/src/TMstate.c +++ b/src/TMstate.c @@ -141,9 +141,9 @@ GetBranchHead(TMParseStateTree parseTree, } else { parseTree->branchHeadTbl = (TMBranchHead) - XtRealloc((char *) parseTree->branchHeadTbl, - (Cardinal) (parseTree->branchHeadTblSize * - sizeof(TMBranchHeadRec))); + XtReallocArray(parseTree->branchHeadTbl, + (Cardinal) parseTree->branchHeadTblSize, + (Cardinal) sizeof(TMBranchHeadRec)); } } #ifdef TRACE_TM @@ -192,9 +192,9 @@ _XtGetQuarkIndex(TMParseStateTree parseTree, XrmQuark quark) } else { parseTree->quarkTbl = (XrmQuark *) - XtRealloc((char *) parseTree->quarkTbl, - (Cardinal) (parseTree->quarkTblSize * - sizeof(XrmQuark))); + XtReallocArray(parseTree->quarkTbl, + (Cardinal) parseTree->quarkTblSize, + (Cardinal) sizeof(XrmQuark)); } } parseTree->quarkTbl[parseTree->numQuarks++] = quark; @@ -240,9 +240,9 @@ GetComplexBranchIndex(TMParseStateTree parseTree, } else { parseTree->complexBranchHeadTbl = (StatePtr *) - XtRealloc((char *) parseTree->complexBranchHeadTbl, - (Cardinal) (parseTree->complexBranchHeadTblSize * - sizeof(StatePtr))); + XtReallocArray(parseTree->complexBranchHeadTbl, + (Cardinal) parseTree->complexBranchHeadTblSize, + (Cardinal) sizeof(StatePtr)); } } parseTree->complexBranchHeadTbl[parseTree->numComplexBranchHeads++] = NULL; @@ -280,9 +280,9 @@ _XtGetTypeIndex(Event *event) _XtGlobalTM.typeMatchSegmentTblSize = (TMShortCard) (_XtGlobalTM.typeMatchSegmentTblSize + 4); _XtGlobalTM.typeMatchSegmentTbl = (TMTypeMatch *) - XtRealloc((char *) _XtGlobalTM.typeMatchSegmentTbl, - (Cardinal) (_XtGlobalTM.typeMatchSegmentTblSize * - sizeof(TMTypeMatch))); + XtReallocArray(_XtGlobalTM.typeMatchSegmentTbl, + (Cardinal) _XtGlobalTM.typeMatchSegmentTblSize, + (Cardinal) sizeof(TMTypeMatch)); } _XtGlobalTM.typeMatchSegmentTbl[_XtGlobalTM.numTypeMatchSegments++] = segment = (TMTypeMatch) @@ -382,9 +382,9 @@ _XtGetModifierIndex(Event *event) _XtGlobalTM.modMatchSegmentTblSize = (TMShortCard) (_XtGlobalTM.modMatchSegmentTblSize + 4); _XtGlobalTM.modMatchSegmentTbl = (TMModifierMatch *) - XtRealloc((char *) _XtGlobalTM.modMatchSegmentTbl, - (Cardinal) (_XtGlobalTM.modMatchSegmentTblSize * - sizeof(TMModifierMatch))); + XtReallocArray(_XtGlobalTM.modMatchSegmentTbl, + (Cardinal) _XtGlobalTM.modMatchSegmentTblSize, + (Cardinal) sizeof(TMModifierMatch)); } _XtGlobalTM.modMatchSegmentTbl[_XtGlobalTM.numModMatchSegments++] = segment = (TMModifierMatch) @@ -712,9 +712,9 @@ PushContext(TMContext *contextPtr, StatePtr newState) (TMShortCard) (context->maxMatches + TM_CONTEXT_MATCHES_REALLOC); context->matches = (MatchPairRec *) - XtRealloc((char *) context->matches, - (Cardinal) (context->maxMatches * - sizeof(MatchPairRec))); + XtReallocArray(context->matches, + (Cardinal) context->maxMatches, + sizeof(MatchPairRec)); } context->matches[context->numMatches].isCycleStart = newState->isCycleStart; @@ -1376,9 +1376,9 @@ _XtCreateXlations(TMStateTree *stateTrees, if (_XtGlobalTM.numTms == _XtGlobalTM.tmTblSize) { _XtGlobalTM.tmTblSize = (TMShortCard) (_XtGlobalTM.tmTblSize + 16); _XtGlobalTM.tmTbl = (XtTranslations *) - XtRealloc((char *) _XtGlobalTM.tmTbl, - (Cardinal) (_XtGlobalTM.tmTblSize * - sizeof(XtTranslations))); + XtReallocArray(_XtGlobalTM.tmTbl, + (Cardinal) _XtGlobalTM.tmTblSize, + (Cardinal) sizeof(XtTranslations)); } _XtGlobalTM.tmTbl[_XtGlobalTM.numTms++] = xlations; UNLOCK_PROCESS; |