dynamic string implemented

AuthorKonata <konata@posteo.jp>
Date
Commit8a95cbfac86cccb4117e7040c2872293b5d25d5b
Parenta20ef80
4 files changed, 4 insertions(+), 4 deletions(-)
MMakefile
@@ -1,3 +1,3 @@
11 all:
2- gcc -Og -g -march=native -shared -fPIC -fstrict-aliasing vector.c -o cutils.so -flto \
2+ gcc -Og -g -march=native -shared -fPIC -fstrict-aliasing vector.c dyn_string.c -o cutils.so -flto \
33 -Wall -Werror -Wpedantic -Wnull-dereference -Wshadow -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wstrict-overflow=5 -Wunreachable-code -Wno-unused-parameter
Mcutils.h
@@ -1,4 +1,5 @@
11 #ifndef CUTILS_H
22 #define CUTILS_H
33 #include <vector.h>
4+#include <dyn_string.h>
45 #endif //CUTILS_H
Mvector.c
@@ -12,7 +12,7 @@ Vector* new_vector(void)
1212 return NULL;
1313 }
1414 vector->length = 0;
15- vector->capacity = 4;
15+ vector->capacity = VECTOR_DEFAULT_SIZE;
1616
1717 return vector;
1818 }
@@ -84,7 +84,7 @@ FindReturn vector_find(const Vector* haystack, const void* needle, bool (*cmp)(c
8484
8585 bool vector_insert(Vector* vector, size_t index, void* item)
8686 {
87- if(!vector_adjust_size(vector, ++vector->length))
87+ if(!vector_adjust_size(vector, vector->length))
8888 return false;
8989
9090 memmove(vector->items+index+1, vector->items+index, (vector->length-index)*sizeof(*vector->items));
Mvector.h
@@ -4,7 +4,6 @@
44 #include <stdint.h>
55 #include <stdlib.h>
66 #include <string.h>
7-#include <assert.h>
87 #include <stdbool.h>
98
109 typedef struct Vector