diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-05-28 15:29:51 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-05-28 15:29:51 +0000 |
commit | 2ba48262b928c6d7b185b526965befc26944906a (patch) | |
tree | c563a3351b71127912de000b6671fddc73568c8c /src | |
parent | 3fdfce683935b44bf89b8603e099e77b0ae8fd9e (diff) | |
download | postgresql-2ba48262b928c6d7b185b526965befc26944906a.tar.gz postgresql-2ba48262b928c6d7b185b526965befc26944906a.zip |
Suppress useless memmove() when buffer already contains left-justified
data.
Diffstat (limited to 'src')
-rw-r--r-- | src/interfaces/libpq/fe-misc.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index 17501665e69..04be4bb692e 100644 --- a/src/interfaces/libpq/fe-misc.c +++ b/src/interfaces/libpq/fe-misc.c @@ -25,7 +25,7 @@ * * * 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) /* Left-justify any data in the buffer to make room */ if (conn->inStart < conn->inEnd) { - memmove(conn->inBuffer, conn->inBuffer + conn->inStart, - conn->inEnd - conn->inStart); - conn->inEnd -= conn->inStart; - conn->inCursor -= conn->inStart; - conn->inStart = 0; + if (conn->inStart > 0) + { + memmove(conn->inBuffer, conn->inBuffer + conn->inStart, + conn->inEnd - conn->inStart); + conn->inEnd -= conn->inStart; + conn->inCursor -= conn->inStart; + conn->inStart = 0; + } } else + { + /* buffer is logically empty, reset it */ conn->inStart = conn->inCursor = conn->inEnd = 0; + } /* * If the buffer is fairly full, enlarge it. We need to be able to |