MCPcopy Create free account
hub / github.com/apache/qpid-proton / pni_data_intern_node

Function pni_data_intern_node

c/src/core/codec.c:485–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483}
484
485static int pni_data_intern_node(pn_data_t *data, pni_node_t *node)
486{
487 pn_bytes_t *bytes = pni_data_bytes(data, node);
488 if (!bytes) return 0;
489 if (data->buf == NULL) {
490 // Heuristic to avoid growing small buffers too much
491 // size + 1 to allow for zero termination
492 size_t size = pn_max(bytes->size+1, PNI_INTERN_MINSIZE);
493 data->buf = pn_buffer(size);
494 }
495 size_t oldcap = pn_buffer_capacity(data->buf);
496 ssize_t offset = pni_data_intern(data, bytes->start, bytes->size);
497 if (offset < 0) return offset;
498 node->data = true;
499 node->data_offset = offset;
500 node->data_size = bytes->size;
501 pn_rwbytes_t buf = pn_buffer_memory(data->buf);
502 bytes->start = buf.start + offset;
503
504 if (pn_buffer_capacity(data->buf) != oldcap) {
505 pni_data_rebase(data, buf.start);
506 }
507
508 return 0;
509}
510
511
512/*

Callers 4

pn_data_put_binaryFunction · 0.85
pn_data_put_stringFunction · 0.85
pn_data_put_symbolFunction · 0.85
pn_data_put_atomFunction · 0.85

Calls 6

pni_data_bytesFunction · 0.85
pn_bufferFunction · 0.85
pn_buffer_capacityFunction · 0.85
pni_data_internFunction · 0.85
pn_buffer_memoryFunction · 0.85
pni_data_rebaseFunction · 0.85

Tested by

no test coverage detected