MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / PyBytesWriter_Grow

Function PyBytesWriter_Grow

asyncpg/protocol/record/pythoncapi_compat.h:2479–2497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2477}
2478
2479static inline int
2480PyBytesWriter_Grow(PyBytesWriter *writer, Py_ssize_t size)
2481{
2482 if (size < 0 && writer->size + size < 0) {
2483 PyErr_SetString(PyExc_ValueError, "invalid size");
2484 return -1;
2485 }
2486 if (size > PY_SSIZE_T_MAX - writer->size) {
2487 PyErr_NoMemory();
2488 return -1;
2489 }
2490 size = writer->size + size;
2491
2492 if (_PyBytesWriter_Resize_impl(writer, size, 1) < 0) {
2493 return -1;
2494 }
2495 writer->size = size;
2496 return 0;
2497}
2498
2499static inline void*
2500PyBytesWriter_GrowAndUpdatePointer(PyBytesWriter *writer,

Callers 2

PyBytesWriter_WriteBytesFunction · 0.85

Calls 1

Tested by

no test coverage detected