From 8b5c6a54c4396bb9daeb9ec5d9cbb0d3deedcbe3 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 11 Sep 2024 15:15:49 +0200 Subject: Replace gratuitous memmove() with memcpy() The index access methods all had similar code that copied the passed-in scan keys to local storage. They all used memmove() for that, which is not wrong, but it seems confusing not to use memcpy() when that would work. Presumably, this was all once copied from ancient code and never adjusted. Discussion: https://www.postgresql.org/message-id/flat/f8c739d9-f48d-4187-b214-df3391ba41ab@eisentraut.org --- src/backend/access/gist/gistscan.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/backend/access/gist/gistscan.c') diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c index e05801e2f5b..de472e16373 100644 --- a/src/backend/access/gist/gistscan.c +++ b/src/backend/access/gist/gistscan.c @@ -233,8 +233,7 @@ gistrescan(IndexScanDesc scan, ScanKey key, int nkeys, fn_extras[i] = scan->keyData[i].sk_func.fn_extra; } - memmove(scan->keyData, key, - scan->numberOfKeys * sizeof(ScanKeyData)); + memcpy(scan->keyData, key, scan->numberOfKeys * sizeof(ScanKeyData)); /* * Modify the scan key so that the Consistent method is called for all @@ -289,8 +288,7 @@ gistrescan(IndexScanDesc scan, ScanKey key, int nkeys, fn_extras[i] = scan->orderByData[i].sk_func.fn_extra; } - memmove(scan->orderByData, orderbys, - scan->numberOfOrderBys * sizeof(ScanKeyData)); + memcpy(scan->orderByData, orderbys, scan->numberOfOrderBys * sizeof(ScanKeyData)); so->orderByTypes = (Oid *) palloc(scan->numberOfOrderBys * sizeof(Oid)); -- cgit v1.2.3