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/Selection.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/Selection.c')
-rw-r--r-- | src/Selection.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/Selection.c b/src/Selection.c index 9215d05..4f69ae4 100644 --- a/src/Selection.c +++ b/src/Selection.c @@ -292,12 +292,12 @@ MakeInfo(Select ctx, info->callbacks = (XtSelectionCallbackProc *) __XtMalloc((unsigned) ((size_t) count * sizeof(XtSelectionCallbackProc))); - (void) memmove((char *) info->callbacks, (char *) callbacks, - (size_t) count * sizeof(XtSelectionCallbackProc)); + (void) memcpy(info->callbacks, callbacks, + (size_t) count * sizeof(XtSelectionCallbackProc)); info->req_closure = (XtPointer *) __XtMalloc((unsigned) ((size_t) count * sizeof(XtPointer))); - (void) memmove((char *) info->req_closure, (char *) closures, - (size_t) count * sizeof(XtPointer)); + (void) memcpy(info->req_closure, closures, + (size_t) count * sizeof(XtPointer)); if (count == 1 && properties != NULL && properties[0] != None) info->property = properties[0]; else { @@ -309,8 +309,8 @@ MakeInfo(Select ctx, info->time = time; info->incremental = (Boolean *) __XtMalloc((Cardinal) ((size_t) count * sizeof(Boolean))); - (void) memmove((char *) info->incremental, (char *) incremental, - (size_t) count * sizeof(Boolean)); + (void) memcpy(info->incremental, incremental, + (size_t) count * sizeof(Boolean)); info->current = 0; info->value = NULL; return (info); @@ -1240,7 +1240,7 @@ HandleGetIncrement(Widget widget, int size = (int) BYTELENGTH(length, info->format) + 1; char *tmp = __XtMalloc((Cardinal) size); - (void) memmove(tmp, value, (size_t) size); + (void) memcpy(tmp, value, (size_t) size); XFree(value); value = tmp; #endif @@ -1256,7 +1256,7 @@ HandleGetIncrement(Widget widget, info->value = XtRealloc(info->value, (Cardinal) info->bytelength); } - (void) memmove(&info->value[info->offset], value, (size_t) size); + (void) memcpy(&info->value[info->offset], value, (size_t) size); info->offset += size; XFree(value); } @@ -1353,7 +1353,7 @@ HandleNormal(Display *dpy, int size = (int) BYTELENGTH(length, info->format) + 1; char *tmp = __XtMalloc((Cardinal) size); - (void) memmove(tmp, value, (size_t) size); + (void) memcpy(tmp, value, (size_t) size); XFree(value); value = (unsigned char *) tmp; } @@ -1514,7 +1514,7 @@ DoLocalTransfer(Request req, /* both sides think they own this storage */ temp = __XtMalloc((unsigned) bytelength); - (void) memmove(temp, value, (size_t) bytelength); + (void) memcpy(temp, value, (size_t) bytelength); value = temp; } /* use care; older clients were never warned that @@ -1545,7 +1545,7 @@ DoLocalTransfer(Request req, (Cardinal) (totallength = totallength + (unsigned long) bytelength)); - (void) memmove((char *) total + totallength - bytelength, + (void) memcpy((char *) total + totallength - bytelength, value, (size_t) bytelength); (*(XtConvertSelectionIncrProc) ctx->convert) (ctx->widget, &selection, &target, @@ -1577,7 +1577,7 @@ DoLocalTransfer(Request req, /* both sides think they own this storage; better copy */ temp = __XtMalloc((unsigned) bytelength); - (void) memmove(temp, value, (size_t) bytelength); + (void) memcpy(temp, value, (size_t) bytelength); value = temp; } if (value == NULL) @@ -1757,7 +1757,7 @@ GetSelectionValues(Widget widget, info->target = (Atom *) __XtMalloc((unsigned) ((size_t) (count + 1) * sizeof(Atom))); (*info->target) = ctx->prop_list->indirect_atom; - (void) memmove((char *) info->target + sizeof(Atom), (char *) targets, + (void) memcpy((char *) info->target + sizeof(Atom), targets, (size_t) count * sizeof(Atom)); pairs = (IndirectPair *) __XtMalloc((unsigned) ((size_t) count * sizeof(IndirectPair))); @@ -2289,7 +2289,7 @@ XtGetSelectionParameters(Widget owner, int size = (int) BYTELENGTH(*length_return, *format_return) + 1; char *tmp = __XtMalloc((Cardinal) size); - (void) memmove(tmp, *value_return, (size_t) size); + (void) memcpy(tmp, *value_return, (size_t) size); XFree(*value_return); *value_return = tmp; } |