Fix build on FreeBSD
Some checks failed
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=OFF (push) Failing after 10s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=OFF (push) Failing after 11s
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=ON (push) Failing after 14s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=ON (push) Failing after 15s
CMake / ubuntu-latest - shared=OFF, pthread=ON, posix=ON (push) Failing after 15s
CMake / ubuntu-latest - shared=ON, pthread=ON, posix=ON (push) Has been cancelled
Some checks failed
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=OFF (push) Failing after 10s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=OFF (push) Failing after 11s
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=ON (push) Failing after 14s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=ON (push) Failing after 15s
CMake / ubuntu-latest - shared=OFF, pthread=ON, posix=ON (push) Failing after 15s
CMake / ubuntu-latest - shared=ON, pthread=ON, posix=ON (push) Has been cancelled
Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
2
build.sh
2
build.sh
@@ -4,7 +4,7 @@ set -e
|
||||
|
||||
BUILD_DIR="BUILD"
|
||||
INSTALL_DIR=$PWD/install
|
||||
CFLAGS="-Wall -Wextra -pedantic -Werror -Wno-newline-eof -Wno-language-extension-token"
|
||||
CFLAGS="-Wall -Wextra -pedantic -Werror -Wno-newline-eof -Wno-language-extension-token -Wno-unused-command-line-argument"
|
||||
BUILD_SHARED=1
|
||||
PTHREAD_SUPPORT=1
|
||||
POSIX_SUPPORT=1
|
||||
|
@@ -1,6 +1,5 @@
|
||||
#include <dcfg.h>
|
||||
|
||||
#include <alloca.h>
|
||||
#include <getopt.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
@@ -105,7 +104,7 @@ void walk_value(dcfg_Value *value, bool evaluate, int indent, bool first)
|
||||
size_t n = 0;
|
||||
dcfg_Value_get_object_keys(value, 0, &n, NULL);
|
||||
dcfg_StringView *keys
|
||||
= n ? (dcfg_StringView *)alloca(n * sizeof(*keys)) : NULL;
|
||||
= n ? (dcfg_StringView *)calloc(1, n * sizeof(*keys)) : NULL;
|
||||
dcfg_Value_get_object_keys(value, n, &n, keys);
|
||||
|
||||
printf("{\n");
|
||||
|
@@ -399,6 +399,12 @@ dcfg_Version dcfg_get_version(void)
|
||||
| ((uint64_t)VERSION_PATCH & 0xFFFFFFFFULL);
|
||||
}
|
||||
|
||||
#if __FreeBSD__
|
||||
#define MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE
|
||||
#else
|
||||
#define MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
|
||||
#endif
|
||||
|
||||
dcfg_Instance *dcfg_make_instance(dcfg_InstanceCreateInfo const *create_info)
|
||||
{
|
||||
assert(create_info);
|
||||
@@ -410,7 +416,7 @@ dcfg_Instance *dcfg_make_instance(dcfg_InstanceCreateInfo const *create_info)
|
||||
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
|
||||
pthread_mutexattr_settype(&attr, MUTEX_RECURSIVE);
|
||||
pthread_mutex_init(&instance->mtx, &attr);
|
||||
|
||||
instance->alloc = create_info->alloc;
|
||||
|
Reference in New Issue
Block a user