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

Function pn_string_grow

c/src/core/object/string.c:151–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151int pn_string_grow(pn_string_t *string, size_t capacity)
152{
153 if (!string) return PN_ARG_ERR;
154
155 bool grow = false;
156 while (string->capacity < (capacity*sizeof(char) + 1)) {
157 string->capacity *= 2;
158 grow = true;
159 }
160
161 if (grow) {
162 char *growed = (char *) pni_mem_subreallocate(pn_class(string), string, string->bytes, string->capacity);
163 if (growed) {
164 string->bytes = growed;
165 } else {
166 return PN_ERR;
167 }
168 }
169
170 return 0;
171}
172
173int pn_string_setn(pn_string_t *string, const char *bytes, size_t n)
174{

Callers 4

pn_quoteFunction · 0.85
pn_string_setnFunction · 0.85
pn_string_vaddfFunction · 0.85
pn_string_resizeFunction · 0.85

Calls 2

pni_mem_subreallocateFunction · 0.85
pn_classFunction · 0.85

Tested by

no test coverage detected