Lines Matching refs:tbuf

172 _ti_grow_tbuf(TBUF *tbuf, size_t len)  in _ti_grow_tbuf()  argument
177 _DIAGASSERT(tbuf != NULL); in _ti_grow_tbuf()
179 l = tbuf->bufpos + len; in _ti_grow_tbuf()
180 if (l > tbuf->buflen) { in _ti_grow_tbuf()
181 if (tbuf->buflen == 0) in _ti_grow_tbuf()
184 buf = realloc(tbuf->buf, l); in _ti_grow_tbuf()
187 tbuf->buf = buf; in _ti_grow_tbuf()
188 tbuf->buflen = l; in _ti_grow_tbuf()
190 return tbuf->buf; in _ti_grow_tbuf()
194 _ti_find_cap(TIC *tic, TBUF *tbuf, char type, short ind) in _ti_find_cap() argument
200 _DIAGASSERT(tbuf != NULL); in _ti_find_cap()
202 cap = tbuf->buf; in _ti_find_cap()
203 for (n = tbuf->entries; n > 0; n--) { in _ti_find_cap()
226 _ti_find_extra(TIC *tic, TBUF *tbuf, const char *code) in _ti_find_extra() argument
232 _DIAGASSERT(tbuf != NULL); in _ti_find_extra()
235 cap = tbuf->buf; in _ti_find_extra()
236 for (n = tbuf->entries; n > 0; n--) { in _ti_find_extra()
415 encode_string(const char *term, const char *cap, TBUF *tbuf, const char *str, in encode_string() argument
421 if (_ti_grow_tbuf(tbuf, strlen(str) + 1) == NULL) in encode_string()
423 p = s = tbuf->buf + tbuf->bufpos; in encode_string()
518 tbuf->bufpos += (size_t)(p - s); in encode_string()
557 _ti_encode_buf_id_num(TBUF *tbuf, int ind, int num, size_t len) in _ti_encode_buf_id_num() argument
559 if (!_ti_grow_tbuf(tbuf, sizeof(uint16_t) + len)) in _ti_encode_buf_id_num()
561 _ti_encode_buf_16(tbuf, ind); in _ti_encode_buf_id_num()
563 _ti_encode_buf_32(tbuf, (uint32_t)num); in _ti_encode_buf_id_num()
565 _ti_encode_buf_16(tbuf, (uint16_t)num); in _ti_encode_buf_id_num()
566 tbuf->entries++; in _ti_encode_buf_id_num()
571 _ti_encode_buf_id_count_str(TBUF *tbuf, int ind, const void *buf, size_t len) in _ti_encode_buf_id_count_str() argument
573 if (!_ti_grow_tbuf(tbuf, 2 * sizeof(uint16_t) + len)) in _ti_encode_buf_id_count_str()
575 _ti_encode_buf_16(tbuf, ind); in _ti_encode_buf_id_count_str()
576 _ti_encode_buf_count_str(tbuf, buf, len); in _ti_encode_buf_id_count_str()
577 tbuf->entries++; in _ti_encode_buf_id_count_str()
582 _ti_encode_buf_id_flags(TBUF *tbuf, int ind, int flag) in _ti_encode_buf_id_flags() argument
584 if (!_ti_grow_tbuf(tbuf, sizeof(uint16_t) + 1)) in _ti_encode_buf_id_flags()
586 _ti_encode_buf_16(tbuf, ind); in _ti_encode_buf_id_flags()
587 tbuf->buf[tbuf->bufpos++] = flag; in _ti_encode_buf_id_flags()
588 tbuf->entries++; in _ti_encode_buf_id_flags()