From e6a815749a5414c7841a9f449f86b21d85699ee8 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 3 May 2016 23:56:20 +0100 Subject: [PATCH] Fix *_appendv bug --- README.md | 2 +- gb.h | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 30b33d9..bff45a4 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ gb single-file public domain libraries for C & C++ library | latest version | category | languages | description ----------------|----------------|----------|-----------|------------- -**gb.h** | 0.08 | misc | C, C++ | A C helper library for C & C++ +**gb.h** | 0.08a | misc | C, C++ | A C helper library for C & C++ **gb_math.h** | 0.06b | math | C, C++ | A C/C++ vector math library geared towards game development **gb_gl.h** | 0.04b | graphics | C, C++ | A C/C++ OpenGL Helper Library **gb_string.h** | 0.95 | strings | C, C++ | A better string library for C & C++ (this is built into gb.h too with custom allocator support!) diff --git a/gb.h b/gb.h index e9fe1d5..fbebc4f 100644 --- a/gb.h +++ b/gb.h @@ -1,4 +1,4 @@ -/* gb.h - v0.08 - Ginger Bill's C Helper Library - public domain +/* gb.h - v0.08a - Ginger Bill's C Helper Library - public domain - no warranty implied; use at your own risk This is a single header file with a bunch of useful stuff @@ -26,6 +26,7 @@ Conventions used: Version History: + 0.08a - Fix *_appendv bug 0.08 - Huge Overhaul! 0.07a - Fix alignment in gb_heap_allocator_proc 0.07 - Hash Table and Hashing Functions @@ -1142,10 +1143,10 @@ typedef struct gbBufferHeader { #define gb_buffer_append(x, item) do { (x)[gb_buffer_count(x)++] = (item); } while (0) -#define gb_buffer_appednv(x, items, item_count) do { \ +#define gb_buffer_appendv(x, items, item_count) do { \ GB_ASSERT(gb_size_of(*(items)) == gb_size_of(*(x))); \ GB_ASSERT(gb_buffer_count(x)+item_count <= gb_buffer_capacity(x)); \ - gb_memcopy((x)[gb_buffer_count(x)], (items), gb_size_of(*(x))*(item_count)); \ + gb_memcopy(&(x)[gb_buffer_count(x)], (items), gb_size_of(*(x))*(item_count)); \ gb_buffer_count(x) += (item_count); \ } while (0) @@ -1286,7 +1287,7 @@ GB_DEF void *gb__set_array_capacity(void *array, isize capacity, isize element_s GB_ASSERT(gb_size_of((items)[0]) == gb_size_of((x)[0])); \ if (gb__ah->capacity < gb__ah->count+(item_count)) \ gb_array_grow(x, gb__ah->count+(item_count)); \ - gb_memcopy((x)[gb__ah->count], (items), gb_size_of((x)[0])*(item_count));\ + gb_memcopy(&(x)[gb__ah->count], (items), gb_size_of((x)[0])*(item_count));\ gb__ah->count += (item_count); \ } while (0)