dynamic string implemented

AuthorKonata <konata@posteo.jp>
Date
Commit8a95cbfac86cccb4117e7040c2872293b5d25d5b
Parenta20ef80
4 files changed, 4 insertions(+), 4 deletions(-)
▾MMakefile
@@ -1,3 +1,3 @@
all:
gcc -Og -g -march=native -shared -fPIC -fstrict-aliasing vector.c -o cutils.so -flto \
gcc -Og -g -march=native -shared -fPIC -fstrict-aliasing vector.c dyn_string.c -o cutils.so -flto \
-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 @@
#ifndef CUTILS_H
#define CUTILS_H
#include <vector.h>
#include <dyn_string.h>
#endif //CUTILS_H
▾Mvector.c
@@ -12,7 +12,7 @@ Vector* new_vector(void)
return NULL;
}
vector->length = 0;
vector->capacity = 4;
vector->capacity = VECTOR_DEFAULT_SIZE;
return vector;
}
@@ -84,7 +84,7 @@ FindReturn vector_find(const Vector* haystack, const void* needle, bool (*cmp)(c
bool vector_insert(Vector* vector, size_t index, void* item)
{
if(!vector_adjust_size(vector, ++vector->length))
if(!vector_adjust_size(vector, vector->length))
return false;
memmove(vector->items+index+1, vector->items+index, (vector->length-index)*sizeof(*vector->items));
▾Mvector.h
@@ -4,7 +4,6 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>
typedef struct Vector