MCPcopy Create free account
hub / github.com/apache/cloudberry / pq_getmsgrawstring

Function pq_getmsgrawstring

src/backend/libpq/pqformat.c:609–630  ·  view source on GitHub ↗

-------------------------------- * pq_getmsgrawstring - get a null-terminated text string - NO conversion * * Returns a pointer directly into the message buffer. * -------------------------------- */

Source from the content-addressed store, hash-verified

607 * --------------------------------
608 */
609const char *
610pq_getmsgrawstring(StringInfo msg)
611{
612 char *str;
613 int slen;
614
615 str = &msg->data[msg->cursor];
616
617 /*
618 * It's safe to use strlen() here because a StringInfo is guaranteed to
619 * have a trailing null byte. But check we found a null inside the
620 * message.
621 */
622 slen = strlen(str);
623 if (msg->cursor + slen >= msg->len)
624 ereport(ERROR,
625 (errcode(ERRCODE_PROTOCOL_VIOLATION),
626 errmsg("invalid string in message")));
627 msg->cursor += slen + 1;
628
629 return str;
630}
631
632/* --------------------------------
633 * pq_getmsgend - verify message fully consumed

Callers 3

HandleParallelMessageFunction · 0.85
pq_parse_errornoticeFunction · 0.85
CheckSCRAMAuthFunction · 0.85

Calls 2

errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected