Remove unused 'countincludesself' argument to pq_sendcountedtext()

It has been unused since we removed support for protocol version 2.
This commit is contained in:
Heikki Linnakangas 2024-03-04 12:56:05 +02:00
parent 0dd094c4a0
commit 24eebc65c2
6 changed files with 14 additions and 19 deletions

View File

@ -95,8 +95,7 @@ printsimple(TupleTableSlot *slot, DestReceiver *self)
pq_sendcountedtext(&buf, pq_sendcountedtext(&buf,
VARDATA_ANY(t), VARDATA_ANY(t),
VARSIZE_ANY_EXHDR(t), VARSIZE_ANY_EXHDR(t));
false);
} }
break; break;
@ -107,7 +106,7 @@ printsimple(TupleTableSlot *slot, DestReceiver *self)
int len; int len;
len = pg_ltoa(num, str); len = pg_ltoa(num, str);
pq_sendcountedtext(&buf, str, len, false); pq_sendcountedtext(&buf, str, len);
} }
break; break;
@ -118,7 +117,7 @@ printsimple(TupleTableSlot *slot, DestReceiver *self)
int len; int len;
len = pg_lltoa(num, str); len = pg_lltoa(num, str);
pq_sendcountedtext(&buf, str, len, false); pq_sendcountedtext(&buf, str, len);
} }
break; break;
@ -129,7 +128,7 @@ printsimple(TupleTableSlot *slot, DestReceiver *self)
int len; int len;
len = pg_ultoa_n(num, str); len = pg_ultoa_n(num, str);
pq_sendcountedtext(&buf, str, len, false); pq_sendcountedtext(&buf, str, len);
} }
break; break;

View File

@ -355,7 +355,7 @@ printtup(TupleTableSlot *slot, DestReceiver *self)
char *outputstr; char *outputstr;
outputstr = OutputFunctionCall(&thisState->finfo, attr); outputstr = OutputFunctionCall(&thisState->finfo, attr);
pq_sendcountedtext(buf, outputstr, strlen(outputstr), false); pq_sendcountedtext(buf, outputstr, strlen(outputstr));
} }
else else
{ {

View File

@ -133,30 +133,27 @@ pq_sendbytes(StringInfo buf, const void *data, int datalen)
* pq_sendcountedtext - append a counted text string (with character set conversion) * pq_sendcountedtext - append a counted text string (with character set conversion)
* *
* The data sent to the frontend by this routine is a 4-byte count field * The data sent to the frontend by this routine is a 4-byte count field
* followed by the string. The count includes itself or not, as per the * followed by the string. The count does not include itself, as required by
* countincludesself flag (pre-3.0 protocol requires it to include itself). * protocol version 3.0. The passed text string need not be null-terminated,
* The passed text string need not be null-terminated, and the data sent * and the data sent to the frontend isn't either.
* to the frontend isn't either.
* -------------------------------- * --------------------------------
*/ */
void void
pq_sendcountedtext(StringInfo buf, const char *str, int slen, pq_sendcountedtext(StringInfo buf, const char *str, int slen)
bool countincludesself)
{ {
int extra = countincludesself ? 4 : 0;
char *p; char *p;
p = pg_server_to_client(str, slen); p = pg_server_to_client(str, slen);
if (p != str) /* actual conversion has been done? */ if (p != str) /* actual conversion has been done? */
{ {
slen = strlen(p); slen = strlen(p);
pq_sendint32(buf, slen + extra); pq_sendint32(buf, slen);
appendBinaryStringInfoNT(buf, p, slen); appendBinaryStringInfoNT(buf, p, slen);
pfree(p); pfree(p);
} }
else else
{ {
pq_sendint32(buf, slen + extra); pq_sendint32(buf, slen);
appendBinaryStringInfoNT(buf, str, slen); appendBinaryStringInfoNT(buf, str, slen);
} }
} }

View File

@ -851,7 +851,7 @@ logicalrep_write_tuple(StringInfo out, Relation rel, TupleTableSlot *slot,
pq_sendbyte(out, LOGICALREP_COLUMN_TEXT); pq_sendbyte(out, LOGICALREP_COLUMN_TEXT);
outputstr = OidOutputFunctionCall(typclass->typoutput, values[i]); outputstr = OidOutputFunctionCall(typclass->typoutput, values[i]);
pq_sendcountedtext(out, outputstr, strlen(outputstr), false); pq_sendcountedtext(out, outputstr, strlen(outputstr));
pfree(outputstr); pfree(outputstr);
} }

View File

@ -85,7 +85,7 @@ SendFunctionResult(Datum retval, bool isnull, Oid rettype, int16 format)
getTypeOutputInfo(rettype, &typoutput, &typisvarlena); getTypeOutputInfo(rettype, &typoutput, &typisvarlena);
outputstr = OidOutputFunctionCall(typoutput, retval); outputstr = OidOutputFunctionCall(typoutput, retval);
pq_sendcountedtext(&buf, outputstr, strlen(outputstr), false); pq_sendcountedtext(&buf, outputstr, strlen(outputstr));
pfree(outputstr); pfree(outputstr);
} }
else if (format == 1) else if (format == 1)

View File

@ -23,8 +23,7 @@ extern void pq_endmessage(StringInfo buf);
extern void pq_endmessage_reuse(StringInfo buf); extern void pq_endmessage_reuse(StringInfo buf);
extern void pq_sendbytes(StringInfo buf, const void *data, int datalen); extern void pq_sendbytes(StringInfo buf, const void *data, int datalen);
extern void pq_sendcountedtext(StringInfo buf, const char *str, int slen, extern void pq_sendcountedtext(StringInfo buf, const char *str, int slen);
bool countincludesself);
extern void pq_sendtext(StringInfo buf, const char *str, int slen); extern void pq_sendtext(StringInfo buf, const char *str, int slen);
extern void pq_sendstring(StringInfo buf, const char *str); extern void pq_sendstring(StringInfo buf, const char *str);
extern void pq_send_ascii_string(StringInfo buf, const char *str); extern void pq_send_ascii_string(StringInfo buf, const char *str);