Add build script
All checks were successful
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=OFF (push) Successful in 12s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=OFF (push) Successful in 11s
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=ON (push) Successful in 11s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=ON (push) Successful in 14s
CMake / ubuntu-latest - shared=OFF, pthread=ON, posix=ON (push) Successful in 14s
CMake / ubuntu-latest - shared=ON, pthread=ON, posix=ON (push) Successful in 11s

Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
2025-07-26 22:20:41 +03:00
parent 82f5e3b77e
commit 0b5c556f84
3 changed files with 78 additions and 2 deletions

View File

@@ -169,6 +169,8 @@ struct dcfg_Value {
Instance *instance;
dcfg_ValueType type;
SourceLocation location;
int i_sourcev_idx;
int i_source_pathv_idx;
union {
int64_t i;
@@ -194,6 +196,9 @@ struct dcfg_Instance {
dcfg_FtellFn ftell;
char last_error[256];
StringView *sourcev; // Strings should be freed.
StringView *source_pathv; // Strings should be freed.
};
#define ALLOC(sz) (instance->alloc((sz)))
@@ -248,6 +253,9 @@ dcfg_Instance *dcfg_make_instance(dcfg_InstanceCreateInfo const *create_info)
assert(instance->fseek);
assert(instance->ftell);
instance->sourcev = vector_create();
instance->source_pathv = vector_create();
return instance;
}
@@ -255,6 +263,9 @@ void dcfg_destroy_instance(dcfg_Instance *instance)
{
assert(instance);
vector_free(instance->source_pathv);
vector_free(instance->sourcev);
pthread_mutex_lock(&instance->mtx);
{ // De-init other instance things
}
@@ -1109,8 +1120,8 @@ dcfg_Value *dcfg_parse(dcfg_Instance *instance, dcfg_StringView const file_path)
StringView str = {
.size = size,
.data = ALLOC(size),
};
str.data = ALLOC(size);
if (!fread((void *)str.data, str.size, 1, fp)) {
FREE(abs);
FREE((void *)str.data);
@@ -1150,6 +1161,12 @@ dcfg_Value *dcfg_parse(dcfg_Instance *instance, dcfg_StringView const file_path)
return NULL;
}
vector_add(&instance->sourcev, str);
vector_add(&instance->source_pathv, abs_sv);
v->i_sourcev_idx = vector_size(instance->sourcev) - 1;
v->i_source_pathv_idx = vector_size(instance->source_pathv) - 1;
return v;
}