Mercurial > dovecot > core-2.2
changeset 21318:5e70e91e4c78
lib: Remove t_buffer_*_type()
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.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 12 Dec 2016 03:55:54 +0200 |
parents | 1892618b85f9 |
children | a3bbf15ea8d7 |
files | src/lib/data-stack.h src/lib/test-data-stack.c |
diffstat | 2 files changed, 2 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib/data-stack.h Mon Dec 12 03:48:49 2016 +0200 +++ b/src/lib/data-stack.h Mon Dec 12 03:55:54 2016 +0200 @@ -96,20 +96,14 @@ 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);
--- a/src/lib/test-data-stack.c Mon Dec 12 03:48:49 2016 +0200 +++ b/src/lib/test-data-stack.c Mon Dec 12 03:55:54 2016 +0200 @@ -94,9 +94,9 @@ char tag[2] = { depth+1, '\0' }; int try_fails = 0; unsigned int 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(size/2);