diff options
author | Julian T <julian@jtle.dk> | 2020-03-23 16:55:45 +0100 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2020-03-23 16:55:45 +0100 |
commit | 83b552b622da561de047f798e5d50d59f724b1eb (patch) | |
tree | 5255a785b05aba1f4894062c8576bec15d6d3411 /vector.c | |
parent | 8fc5b36510c5964873d88069b61b558bc3ef23f6 (diff) |
No dynamic allocation
Diffstat (limited to 'vector.c')
-rw-r--r-- | vector.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -4,14 +4,13 @@ #include <string.h> #include <math.h> #include <stdio.h> +#include <assert.h> 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 |