Skip to content

Commit 4c26d45

Browse files
committed
Replace memcpy with memmove
1 parent 887603d commit 4c26d45

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

contrib/pg_dtm/sockhub/sockhub.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ void ShubLoop(Shub* shub)
367367
}
368368
}
369369
/* Move partly fetched message header (if any) to the beginning of buffer */
370-
memcpy(shub->out_buffer, shub->out_buffer + pos, available - pos);
370+
memmove(shub->out_buffer, shub->out_buffer + pos, available - pos);
371371
shub->out_buffer_used = available - pos;
372372
} else { /* receive request from client */
373373
int chan = i;
@@ -454,7 +454,7 @@ void ShubLoop(Shub* shub)
454454
shub->params->error_handler("Failed to write to inet socket", SHUB_RECOVERABLE_ERROR);
455455
reconnect(shub);
456456
}
457-
memcpy(shub->in_buffer, shub->in_buffer + pos, available -= pos);
457+
memmove(shub->in_buffer, shub->in_buffer + pos, available -= pos);
458458
pos = 0;
459459
} else {
460460
available -= pos;

contrib/pg_dtm/sockhub/start-async-clients.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
n_clients=10
1+
n_clients=8
22
n_iters=10000
33
pkill -9 sockub
44
pkill -9 test-async-client

contrib/pg_dtm/sockhub/test-server.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ int main(int argc, char* argv[])
9393
if (msg->hdr.code == MSG_DISCONNECT) {
9494
assert(msg->hdr.size == 0);
9595
printf("Disconnect client [%d:%d]\n", i, msg->hdr.chan);
96-
memcpy(buf + pos, buf + pos + sizeof(ShubMessageHdr), available - pos - sizeof(ShubMessageHdr));
96+
memmove(buf + pos, buf + pos + sizeof(ShubMessageHdr), available - pos - sizeof(ShubMessageHdr));
9797
available -= sizeof(ShubMessageHdr);
9898
} else {
9999
assert(sizeof(ShubMessageHdr) + msg->hdr.size == sizeof(Message));

0 commit comments

Comments
 (0)