From 7cec0d7707cbee5340e27d69b923236ccbda68bb Mon Sep 17 00:00:00 2001
From: ratchetfreak <ratchetfreak@users.noreply.github.com>
Date: Thu, 15 Feb 2024 13:05:43 +0100
Subject: [PATCH] Update nob.h

make `nob_da_append_many(da, items, count-1);`  actually work correctly
---
 src/nob.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/nob.h b/src/nob.h
index f66fa60..3811564 100644
--- a/src/nob.h
+++ b/src/nob.h
@@ -120,18 +120,18 @@ Nob_File_Type nob_get_file_type(const char *path);
 // Append several items to a dynamic array
 #define nob_da_append_many(da, new_items, new_items_count)                                  \
     do {                                                                                    \
-        if ((da)->count + new_items_count > (da)->capacity) {                               \
+        if ((da)->count + (new_items_count) > (da)->capacity) {                               \
             if ((da)->capacity == 0) {                                                      \
                 (da)->capacity = NOB_DA_INIT_CAP;                                           \
             }                                                                               \
-            while ((da)->count + new_items_count > (da)->capacity) {                        \
+            while ((da)->count + (new_items_count) > (da)->capacity) {                        \
                 (da)->capacity *= 2;                                                        \
             }                                                                               \
             (da)->items = NOB_REALLOC((da)->items, (da)->capacity*sizeof(*(da)->items)); \
             NOB_ASSERT((da)->items != NULL && "Buy more RAM lol");                          \
         }                                                                                   \
-        memcpy((da)->items + (da)->count, new_items, new_items_count*sizeof(*(da)->items)); \
-        (da)->count += new_items_count;                                                     \
+        memcpy((da)->items + (da)->count, (new_items), (new_items_count)*sizeof(*(da)->items)); \
+        (da)->count += (new_items_count);                                                     \
     } while (0)
 
 typedef struct {