* pqGets[_append]: * get a null-terminated string from the connection, * and store it in an expansible PQExpBuffer. * If we run out of memory, all of the string is still read, * but the excess characters are silently discarded. */
| 114 | * but the excess characters are silently discarded. |
| 115 | */ |
| 116 | static int |
| 117 | pqGets_internal(PQExpBuffer buf, PGconn *conn, bool resetbuffer) |
| 118 | { |
| 119 | /* Copy conn data to locals for faster search loop */ |
| 120 | char *inBuffer = conn->inBuffer; |
| 121 | int inCursor = conn->inCursor; |
| 122 | int inEnd = conn->inEnd; |
| 123 | int slen; |
| 124 | |
| 125 | while (inCursor < inEnd && inBuffer[inCursor]) |
| 126 | inCursor++; |
| 127 | |
| 128 | if (inCursor >= inEnd) |
| 129 | return EOF; |
| 130 | |
| 131 | slen = inCursor - conn->inCursor; |
| 132 | |
| 133 | if (resetbuffer) |
| 134 | resetPQExpBuffer(buf); |
| 135 | |
| 136 | appendBinaryPQExpBuffer(buf, inBuffer + conn->inCursor, slen); |
| 137 | |
| 138 | conn->inCursor = ++inCursor; |
| 139 | |
| 140 | return 0; |
| 141 | } |
| 142 | |
| 143 | int |
| 144 | pqGets(PQExpBuffer buf, PGconn *conn) |
no test coverage detected