diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-08-11 18:41:14 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-08-11 18:51:26 -0700 |
commit | 3c54e99864eb6dba0d0cde7fe0a23ed7c1f5875f (patch) | |
tree | c00b9f2dc00e8b391052d4a8726d356b0d772e8a /src/TMparse.c | |
parent | bbe78f905da6e36ebe1fe520903c760107b92b78 (diff) |
Use memcpy() instead of memmove() when buffers are known not to overlap
Most of these came from a mass bcopy() -> memmove() substitution
in 1993 with a commit comment of "ANSIfication".
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src/TMparse.c')
-rw-r--r-- | src/TMparse.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/TMparse.c b/src/TMparse.c index b20d787..49fc29c 100644 --- a/src/TMparse.c +++ b/src/TMparse.c @@ -673,7 +673,7 @@ FetchModifierToken(String str, XrmQuark *token_return) modStr = XtStackAlloc((size_t) (str - start + 1), modStrbuf); if (modStr == NULL) _XtAllocError(NULL); - (void) memmove(modStr, start, (size_t) (str - start)); + (void) memcpy(modStr, start, (size_t) (str - start)); modStr[str - start] = '\0'; *token_return = XrmStringToQuark(modStr); XtStackFree(modStr, modStrbuf); @@ -784,7 +784,7 @@ ParseXtEventType(register String str, eventTypeStr = XtStackAlloc((size_t) (str - start + 1), eventTypeStrbuf); if (eventTypeStr == NULL) _XtAllocError(NULL); - (void) memmove(eventTypeStr, start, (size_t) (str - start)); + (void) memcpy(eventTypeStr, start, (size_t) (str - start)); eventTypeStr[str - start] = '\0'; *tmEventP = LookupTMEventType(eventTypeStr, error); XtStackFree(eventTypeStr, eventTypeStrbuf); @@ -1016,7 +1016,7 @@ ParseKeySym(register String str, && *str != '\0') str++; keySymName = XtStackAlloc((size_t) (str - start + 1), keySymNamebuf); - (void) memmove(keySymName, start, (size_t) (str - start)); + (void) memcpy(keySymName, start, (size_t) (str - start)); keySymName[str - start] = '\0'; event->event.eventCode = StringToKeySym(keySymName, error); event->event.eventCodeMask = (unsigned long) (~0L); @@ -1062,7 +1062,7 @@ ParseTable(register String str, Opaque closure, EventPtr event, Boolean *error) *error = TRUE; return str; } - (void) memmove(tableSymName, start, (size_t) (str - start)); + (void) memcpy(tableSymName, start, (size_t) (str - start)); tableSymName[str - start] = '\0'; signature = StringToQuark(tableSymName); for (; table->signature != NULLQUARK; table++) @@ -1105,7 +1105,7 @@ ParseButton(String str, Opaque closure, EventPtr event, Boolean *error) *error = TRUE; return PanicModeRecovery(str); } - (void) memmove(buttonStr, start, len); + (void) memcpy(buttonStr, start, len); buttonStr[len] = '\0'; button = StrToNum(buttonStr); if (button < 1 || 255 < button) { @@ -1154,7 +1154,7 @@ ParseAtom(String str, Opaque closure _X_UNUSED, EventPtr event, Boolean *error) *error = TRUE; return str; } - (void) memmove(atomName, start, (size_t) (str - start)); + (void) memcpy(atomName, start, (size_t) (str - start)); atomName[str - start] = '\0'; event->event.eventCode = (TMLongCard) XrmStringToQuark(atomName); event->event.matchEvent = _XtMatchAtom; @@ -1566,7 +1566,7 @@ ParseRepeat(register String str, int *reps, Boolean *plus, Boolean *error) ScanNumeric(str); len = (size_t) (str - start); if (len < sizeof repStr) { - (void) memmove(repStr, start, len); + (void) memcpy(repStr, start, len); repStr[len] = '\0'; *reps = (int) StrToNum(repStr); } @@ -1706,7 +1706,7 @@ ParseActionProc(register String str, XrmQuark *actionProcNameP, Boolean *error) *error = TRUE; return str; } - (void) memmove(procName, start, (size_t) (str - start)); + (void) memcpy(procName, start, (size_t) (str - start)); procName[str - start] = '\0'; *actionProcNameP = XrmStringToQuark(procName); return str; @@ -1734,7 +1734,7 @@ ParseString(register String str, _XtString *strP) (*(str + 1) == '\\' && *(str + 2) == '"'))) { len = (unsigned) (prev_len + (str - start + 2)); *strP = XtRealloc(*strP, len); - (void) memmove(*strP + prev_len, start, (size_t) (str - start)); + (void) memcpy(*strP + prev_len, start, (size_t) (str - start)); prev_len = len - 1; str++; (*strP)[prev_len - 1] = *str; @@ -1745,7 +1745,7 @@ ParseString(register String str, _XtString *strP) } len = (unsigned) (prev_len + (str - start + 1)); *strP = XtRealloc(*strP, len); - (void) memmove(*strP + prev_len, start, (size_t) (str - start)); + (void) memcpy(*strP + prev_len, start, (size_t) (str - start)); (*strP)[len - 1] = '\0'; if (*str == '"') str++; @@ -1762,7 +1762,7 @@ ParseString(register String str, _XtString *strP) && *str != '\0') str++; *strP = __XtMalloc((unsigned) (str - start + 1)); - (void) memmove(*strP, start, (size_t) (str - start)); + (void) memcpy(*strP, start, (size_t) (str - start)); (*strP)[str - start] = '\0'; } return str; @@ -1910,7 +1910,7 @@ ShowProduction(String currentProduction) production = XtStackAlloc(len + 1, productionbuf); if (production == NULL) _XtAllocError(NULL); - (void) memmove(production, currentProduction, len); + (void) memcpy(production, currentProduction, len); production[len] = '\0'; params[0] = production; @@ -1972,7 +1972,7 @@ CheckForPoundSign(String str, start = str; str = ScanIdent(str); len = MIN(19, (int) (str - start)); - (void) memmove(operation, start, (size_t) len); + (void) memcpy(operation, start, (size_t) len); operation[len] = '\0'; if (!strcmp(operation, "replace")) opType = XtTableReplace; |