Skip to content

Commit 7b367a6

Browse files
committed
include: Fix includes for memcpy, malloc & realloc
Predictably, copying the Linux declarations won't fly on macOS or Windows. Just include the system headers.
1 parent 37c75e5 commit 7b367a6

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

include/v.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,8 @@ static inline size_t grow_x_2(size_t capacity, size_t elem_size) {
9696
return capacity * 2;
9797
}
9898

99-
// TODO: How do I want to deal with system headers? I'd rather not #include string.h here.
100-
// string.h
101-
extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
102-
size_t __n) __THROW __nonnull ((1, 2));
103-
// stdlib.h
104-
extern void *malloc (size_t __size) __THROW __attribute_malloc__
105-
__attribute_alloc_size__ ((1)) __wur;
106-
extern void *realloc (void *__ptr, size_t __size)
107-
__THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2));
108-
extern void free (void *__ptr) __THROW;
99+
#include <string.h>
100+
#include <stdlib.h>
109101

110102
#define v_arr_def(T) \
111103
struct T##_arr { \

0 commit comments

Comments
 (0)