aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkoekeishiya <aasvi93@hotmail.com>2020-12-01 13:10:50 +0100
committerkoekeishiya <aasvi93@hotmail.com>2020-12-01 13:10:50 +0100
commit78ee158939eaf58591244ffc6371c984a3a4f2a6 (patch)
treeb269aa4b97e673b0300e3926274de019425e770a
parent311328d8bfd001c57e135b1fda6267ea1b68df99 (diff)
downloadskhd-78ee158939eaf58591244ffc6371c984a3a4f2a6.tar.gz
skhd-78ee158939eaf58591244ffc6371c984a3a4f2a6.zip
use unique macro names..
-rw-r--r--src/sbuffer.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/sbuffer.h b/src/sbuffer.h
index 3558bbc..dc98b6e 100644
--- a/src/sbuffer.h
+++ b/src/sbuffer.h
@@ -11,10 +11,10 @@ struct buf_hdr
char buf[0];
};
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-#define OFFSETOF(t, f) (size_t)((char *)&(((t *)0)->f) - (char *)0)
+#define buf_MAX(a, b) ((a) > (b) ? (a) : (b))
+#define buf_OFFSETOF(t, f) (size_t)((char *)&(((t *)0)->f) - (char *)0)
-#define buf__hdr(b) ((struct buf_hdr *)((char *)(b) - OFFSETOF(struct buf_hdr, buf)))
+#define buf__hdr(b) ((struct buf_hdr *)((char *)(b) - buf_OFFSETOF(struct buf_hdr, buf)))
#define buf__should_grow(b, n) (buf_len(b) + (n) >= buf_cap(b))
#define buf__fit(b, n) (buf__should_grow(b, n) ? ((b) = buf__grow_f(b, buf_len(b) + (n), sizeof(*(b)))) : 0)
@@ -28,8 +28,8 @@ struct buf_hdr
internal void *buf__grow_f(const void *buf, size_t new_len, size_t elem_size)
{
- size_t new_cap = MAX(1 + 2*buf_cap(buf), new_len);
- size_t new_size = OFFSETOF(struct buf_hdr, buf) + new_cap*elem_size;
+ size_t new_cap = buf_MAX(1 + 2*buf_cap(buf), new_len);
+ size_t new_size = buf_OFFSETOF(struct buf_hdr, buf) + new_cap*elem_size;
struct buf_hdr *new_hdr = realloc(buf ? buf__hdr(buf) : 0, new_size);
new_hdr->cap = new_cap;
if (!buf) {