Commit 1aaf5d50 authored by Alan Coopersmith's avatar Alan Coopersmith
Browse files

Use memcpy() instead of XtMemmove() when buffers are known to differ



Most of these came from a mass XtBCopy() -> XtMemmove() substitution
in 1993 with a commit comment of "ANSIfication".

But include/X11/IntrinsicI.h now defines XtMemmmove() as just
calling memcpy() as long as src & dst differ, so remove an
unnecessary check when we've just allocated a buffer, and reduce
the chance that someone thinks we'll actually call memmove() instead
of memcpy()

Signed-off-by: Alan Coopersmith's avatarAlan Coopersmith <alan.coopersmith@oracle.com>
parent 3c54e998
Pipeline #663851 passed with stages
in 2 minutes and 17 seconds
......@@ -377,7 +377,7 @@ _XtDependencies(XtResourceList *class_resp, /* VAR */
new_res = (XrmResourceList *)
__XtMalloc((Cardinal) (new_num_res * sizeof(XrmResourceList)));
if (super_num_res > 0)
XtMemmove(new_res, super_res, super_num_res * sizeof(XrmResourceList));
memcpy(new_res, super_res, super_num_res * sizeof(XrmResourceList));
/* Put pointers to class resource entries into new_res */
new_next = super_num_res;
......
......@@ -471,8 +471,7 @@ EnterBindCache(Widget w,
}
_XtGlobalTM.bindCacheTbl[_XtGlobalTM.numBindCache++] = bindCache;
#endif /* TRACE_TM */
XtMemmove((XtPointer) &bindCache->procs[0],
(XtPointer) procs, procsSize);
memcpy(&bindCache->procs[0], procs, procsSize);
}
UNLOCK_PROCESS;
return &bindCache->procs[0];
......
......@@ -140,7 +140,7 @@ GetBranchHead(TMParseStateTree parseTree,
TMBranchHead oldBranchHeadTbl = parseTree->branchHeadTbl;
parseTree->branchHeadTbl = (TMBranchHead) __XtMalloc(newSize);
XtMemmove(parseTree->branchHeadTbl, oldBranchHeadTbl, newSize);
memcpy(parseTree->branchHeadTbl, oldBranchHeadTbl, newSize);
parseTree->isStackBranchHeads = False;
}
else {
......@@ -195,7 +195,7 @@ _XtGetQuarkIndex(TMParseStateTree parseTree, XrmQuark quark)
XrmQuark *oldquarkTbl = parseTree->quarkTbl;
parseTree->quarkTbl = (XrmQuark *) __XtMalloc(newSize);
XtMemmove(parseTree->quarkTbl, oldquarkTbl, newSize);
memcpy(parseTree->quarkTbl, oldquarkTbl, newSize);
parseTree->isStackQuarks = False;
}
else {
......@@ -242,8 +242,8 @@ GetComplexBranchIndex(TMParseStateTree parseTree,
StatePtr *oldcomplexBranchHeadTbl = parseTree->complexBranchHeadTbl;
parseTree->complexBranchHeadTbl = (StatePtr *) __XtMalloc(newSize);
XtMemmove(parseTree->complexBranchHeadTbl,
oldcomplexBranchHeadTbl, newSize);
memcpy(parseTree->complexBranchHeadTbl,
oldcomplexBranchHeadTbl, newSize);
parseTree->isStackComplexBranchHeads = False;
}
else {
......@@ -1421,8 +1421,8 @@ _XtParseTreeToStateTree(TMParseStateTree parseTree)
(unsigned) (parseTree->numComplexBranchHeads * sizeof(StatePtr));
complexTree->complexBranchHeadTbl = (StatePtr *)
__XtMalloc(tableSize);
XtMemmove(complexTree->complexBranchHeadTbl,
parseTree->complexBranchHeadTbl, tableSize);
memcpy(complexTree->complexBranchHeadTbl,
parseTree->complexBranchHeadTbl, tableSize);
complexTree->numComplexBranchHeads = parseTree->numComplexBranchHeads;
simpleTree = (TMSimpleStateTree) complexTree;
}
......@@ -1436,14 +1436,13 @@ _XtParseTreeToStateTree(TMParseStateTree parseTree)
tableSize =
(unsigned) (parseTree->numBranchHeads * sizeof(TMBranchHeadRec));
simpleTree->branchHeadTbl = (TMBranchHead)
__XtMalloc(tableSize);
XtMemmove(simpleTree->branchHeadTbl, parseTree->branchHeadTbl, tableSize);
simpleTree->branchHeadTbl = (TMBranchHead) __XtMalloc(tableSize);
memcpy(simpleTree->branchHeadTbl, parseTree->branchHeadTbl, tableSize);
simpleTree->numBranchHeads = parseTree->numBranchHeads;
tableSize = (unsigned) (parseTree->numQuarks * sizeof(XrmQuark));
simpleTree->quarkTbl = (XrmQuark *) __XtMalloc(tableSize);
XtMemmove(simpleTree->quarkTbl, parseTree->quarkTbl, tableSize);
memcpy(simpleTree->quarkTbl, parseTree->quarkTbl, tableSize);
simpleTree->numQuarks = parseTree->numQuarks;
return (TMStateTree) simpleTree;
......@@ -1883,8 +1882,8 @@ MakeBindData(TMComplexBindProcs bindings,
if (oldBindData && oldBindData->simple.isComplex)
cBindData->accel_context =
((TMComplexBindData) oldBindData)->accel_context;
XtMemmove((char *) &cBindData->bindTbl[0], (char *) bindings,
numBindings * sizeof(TMComplexBindProcsRec));
memcpy(&cBindData->bindTbl[0], bindings,
numBindings * sizeof(TMComplexBindProcsRec));
}
return bindData;
}
......@@ -2074,9 +2073,9 @@ _XtGetTranslationValue(Widget w)
aXlations->hasBindings = True;
aXlations->xlations = xlations;
aXlations->next = NULL;
XtMemmove((char *) &aXlations->bindTbl[0],
(char *) &cBindData->bindTbl[0],
numBindings * sizeof(TMComplexBindProcsRec));
memcpy(&aXlations->bindTbl[0],
&cBindData->bindTbl[0],
numBindings * sizeof(TMComplexBindProcsRec));
return (XtTranslations) aXlations;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment