From 83b552b622da561de047f798e5d50d59f724b1eb Mon Sep 17 00:00:00 2001 From: Julian T Date: Mon, 23 Mar 2020 16:55:45 +0100 Subject: No dynamic allocation --- vector.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'vector.c') diff --git a/vector.c b/vector.c index 87eba37..0bcd1dc 100644 --- a/vector.c +++ b/vector.c @@ -4,14 +4,13 @@ #include #include #include +#include static inline vector_t *vector_exists(vector_t *v) { - if (v) { - return v; - } + assert(v); - return (vector_t *) malloc(sizeof(vector_t)); + return v; } // Overwrites stuff in p. If p is null a new vector is created -- cgit v1.2.3