MCPcopy Create free account
hub / github.com/numpy/numpy / _append_char

Function _append_char

numpy/core/src/multiarray/buffer.c:62–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60#define INIT_SIZE 16
61
62static int
63_append_char(_tmp_string_t *s, char c)
64{
65 if (s->pos >= s->allocated) {
66 char *p;
67 size_t to_alloc = (s->allocated == 0) ? INIT_SIZE : (2 * s->allocated);
68
69 p = PyObject_Realloc(s->s, to_alloc);
70 if (p == NULL) {
71 PyErr_SetString(PyExc_MemoryError, "memory allocation failed");
72 return -1;
73 }
74 s->s = p;
75 s->allocated = to_alloc;
76 }
77 s->s[s->pos] = c;
78 ++s->pos;
79 return 0;
80}
81
82static int
83_append_str(_tmp_string_t *s, char const *p)

Callers 4

_append_strFunction · 0.85
_append_field_nameFunction · 0.85
_buffer_format_stringFunction · 0.85
_buffer_info_newFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected