From 6b60dc5be58a5781cacc4e6f238454d5e8421760 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Mon, 1 Feb 2016 19:24:38 +0100 Subject: extensions: rename xt_buf to xt_xlate Use a more generic name for this object to prepare the introduction of other translation specific fields. Signed-off-by: Pablo Neira Ayuso --- libxtables/xtables.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'libxtables') diff --git a/libxtables/xtables.c b/libxtables/xtables.c index 21e515d2..32d6a5a2 100644 --- a/libxtables/xtables.c +++ b/libxtables/xtables.c @@ -1987,54 +1987,54 @@ void get_kernel_version(void) kernel_version = LINUX_VERSION(x, y, z); } -struct xt_buf { +struct xt_xlate { char *data; int size; int rem; int off; }; -struct xt_buf *xt_buf_alloc(int size) +struct xt_xlate *xt_xlate_alloc(int size) { - struct xt_buf *buf; + struct xt_xlate *xl; - buf = malloc(sizeof(struct xt_buf)); - if (buf == NULL) + xl = malloc(sizeof(struct xt_xlate)); + if (xl == NULL) xtables_error(RESOURCE_PROBLEM, "OOM"); - buf->data = malloc(size); - if (buf->data == NULL) + xl->data = malloc(size); + if (xl->data == NULL) xtables_error(RESOURCE_PROBLEM, "OOM"); - buf->size = size; - buf->rem = size; - buf->off = 0; + xl->size = size; + xl->rem = size; + xl->off = 0; - return buf; + return xl; } -void xt_buf_free(struct xt_buf *buf) +void xt_xlate_free(struct xt_xlate *xl) { - free(buf->data); - free(buf); + free(xl->data); + free(xl); } -void xt_buf_add(struct xt_buf *buf, const char *fmt, ...) +void xt_xlate_add(struct xt_xlate *xl, const char *fmt, ...) { va_list ap; int len; va_start(ap, fmt); - len = vsnprintf(buf->data + buf->off, buf->rem, fmt, ap); - if (len < 0 || len >= buf->rem) + len = vsnprintf(xl->data + xl->off, xl->rem, fmt, ap); + if (len < 0 || len >= xl->rem) xtables_error(RESOURCE_PROBLEM, "OOM"); va_end(ap); - buf->rem -= len; - buf->off += len; + xl->rem -= len; + xl->off += len; } -const char *xt_buf_get(struct xt_buf *buf) +const char *xt_xlate_get(struct xt_xlate *xl) { - return buf->data; + return xl->data; } -- cgit v1.2.3