Commit 2ba48262 authored by Tom Lane's avatar Tom Lane

Suppress useless memmove() when buffer already contains left-justified

data.
parent 3fdfce68
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.48 2001/03/31 23:13:30 tgl Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.49 2001/05/28 15:29:51 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -400,14 +400,20 @@ pqReadData(PGconn *conn) ...@@ -400,14 +400,20 @@ pqReadData(PGconn *conn)
/* Left-justify any data in the buffer to make room */ /* Left-justify any data in the buffer to make room */
if (conn->inStart < conn->inEnd) if (conn->inStart < conn->inEnd)
{ {
memmove(conn->inBuffer, conn->inBuffer + conn->inStart, if (conn->inStart > 0)
conn->inEnd - conn->inStart); {
conn->inEnd -= conn->inStart; memmove(conn->inBuffer, conn->inBuffer + conn->inStart,
conn->inCursor -= conn->inStart; conn->inEnd - conn->inStart);
conn->inStart = 0; conn->inEnd -= conn->inStart;
conn->inCursor -= conn->inStart;
conn->inStart = 0;
}
} }
else else
{
/* buffer is logically empty, reset it */
conn->inStart = conn->inCursor = conn->inEnd = 0; conn->inStart = conn->inCursor = conn->inEnd = 0;
}
/* /*
* If the buffer is fairly full, enlarge it. We need to be able to * If the buffer is fairly full, enlarge it. We need to be able to
......
Markdown is supported
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