Skip to content

Commit

Permalink
lib: Remove t_buffer_*_type()
Browse files Browse the repository at this point in the history
The t_buffer_*() shouldn't normally be used anyway except in some low-level
string/buffer manipulation code, so there's not much point in trying to make
easier to use versions of them.
  • Loading branch information
sirainen committed Dec 16, 2016
1 parent e8df5cf commit 6182623
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 0 additions & 6 deletions src/lib/data-stack.h
Expand Up @@ -101,20 +101,14 @@ size_t t_get_bytes_available(void) ATTR_PURE;
in the size parameter. If return value doesn't point to the same value
as last time, you need to memcpy() data from the old buffer to the
new one (or do some other trickery). See t_buffer_reget(). */
#define t_buffer_get_type(type, size) \
t_buffer_get(sizeof(type) * (size))
void *t_buffer_get(size_t size) ATTR_RETURNS_NONNULL;

/* Grow the buffer, memcpy()ing the memory to new location if needed. */
#define t_buffer_reget_type(buffer, type, size) \
t_buffer_reget(buffer, sizeof(type) * (size))
void *t_buffer_reget(void *buffer, size_t size) ATTR_RETURNS_NONNULL;

/* Make the last t_buffer_get()ed buffer permanent. Note that size MUST be
less or equal than the size you gave with last t_buffer_get() or the
result will be undefined. */
#define t_buffer_alloc_type(type, size) \
t_buffer_alloc(sizeof(type) * (size))
void t_buffer_alloc(size_t size);
/* Allocate the last t_buffer_get()ed data entirely. */
void t_buffer_alloc_last_full(void);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/test-data-stack.c
Expand Up @@ -94,9 +94,9 @@ static void test_ds_recurse(int depth, int number, size_t size)
char tag[2] = { depth+1, '\0' };
int try_fails = 0;
data_stack_frame_t t_id = t_push_named("test_ds_recurse[%i]", depth);
ps = t_buffer_get_type(char *, number);
ps = t_buffer_get(sizeof(char *) * number);
i_assert(ps != NULL);
t_buffer_alloc_type(char *, number);
t_buffer_alloc(sizeof(char *) * number);

for (i = 0; i < number; i++) {
ps[i] = t_malloc_no0(size/2);
Expand Down

0 comments on commit 6182623

Please sign in to comment.