From a79add6dff1113ea24cdac87b39d7431447498a7 Mon Sep 17 00:00:00 2001 From: pancake Date: Sat, 19 Nov 2022 01:05:18 +0100 Subject: [PATCH] Update sdb to remove double include paths ##build * Updated pkg-config paths --- .gitignore | 2 + Makefile | 11 ++-- binr/rules.mk | 2 +- libr/Makefile | 4 +- libr/anal/block.c | 1 - libr/anal/p/anal_arm_cs.c | 2 +- libr/anal/p/anal_arm_v35.c | 2 +- libr/anal/type.c | 2 +- libr/asm/arch/tms320/tms320_dasm.c | 2 +- libr/asm/p/asm_arm.c | 2 +- libr/bin/format/coff/coff.h | 1 - libr/bin/format/pe/pe.c | 2 +- libr/bin/p/bin_coff.c | 2 +- libr/bin/p/bin_dyldcache.c | 1 - libr/bin/p/bin_elf.inc | 2 +- libr/bin/p/bin_mach0.c | 2 +- libr/bin/p/bin_symbols.c | 2 +- libr/cons/grep.c | 2 +- libr/core/canal.c | 2 +- libr/core/cmd_api.c | 2 +- libr/core/cmd_debug.c | 2 +- libr/core/cmd_meta.c | 2 +- libr/core/cmd_search.c | 2 +- libr/core/core.c | 3 +- libr/esil/esil_handler.c | 2 +- libr/include/r_anal.h | 2 +- libr/include/r_arch.h | 2 +- libr/include/r_bin.h | 2 +- libr/include/r_cmd.h | 2 +- libr/include/r_cons.h | 4 +- libr/include/r_list.h | 2 +- libr/include/r_syscall.h | 2 +- libr/include/r_util/r_ctypes.h | 2 +- libr/include/r_util/r_event.h | 2 +- libr/include/r_util/r_str_constpool.h | 2 +- libr/include/rvc.h | 2 +- libr/io/io.c | 2 +- libr/io/io_map.c | 2 +- libr/util/list.c | 2 +- libr/util/sdb.mk | 7 ++- meson.build | 41 ++++++------- pkgcfg/r_util.pc.acr | 2 +- shlr/Makefile | 20 ++++--- shlr/ar/Makefile | 2 +- shlr/bochs/Makefile | 2 +- shlr/gdb/Makefile | 2 +- shlr/grub/Makefile | 2 +- shlr/java/Makefile | 2 +- shlr/java/class.h | 2 +- shlr/java/main.c | 2 +- shlr/qnx/Makefile | 2 +- shlr/sdb.mk | 2 +- shlr/sdb/Makefile | 61 ++++++++++---------- shlr/sdb/config.mk | 2 +- shlr/sdb/{src => include/sdb}/buffer.h | 0 shlr/sdb/{src => include/sdb}/cdb.h | 0 shlr/sdb/{src => include/sdb}/cdb_make.h | 0 shlr/sdb/{src => include/sdb}/config.h | 0 shlr/sdb/{src => include/sdb}/dict.h | 0 shlr/sdb/{src/sdbht.h => include/sdb/ht.h} | 0 shlr/sdb/{src => include/sdb}/ht_inc.h | 0 shlr/sdb/{src => include/sdb}/ht_pp.h | 0 shlr/sdb/{src => include/sdb}/ht_pu.h | 0 shlr/sdb/{src => include/sdb}/ht_up.h | 2 +- shlr/sdb/{src => include/sdb}/ht_uu.h | 2 +- shlr/sdb/{src => include/sdb}/ls.h | 0 shlr/sdb/{src/json => include/sdb}/rangstr.h | 4 +- shlr/sdb/{src => include/sdb}/sdb.h | 7 ++- shlr/sdb/{src => include/sdb}/set.h | 0 shlr/sdb/{src => include/sdb}/types.h | 0 shlr/sdb/meson.build | 38 ++++++------ shlr/sdb/src/Makefile | 17 +++--- shlr/sdb/src/array.c | 2 +- shlr/sdb/src/base64.c | 2 +- shlr/sdb/src/buffer.c | 2 +- shlr/sdb/src/cdb.c | 2 +- shlr/sdb/src/cdb_make.c | 6 +- shlr/sdb/src/dict.c | 2 +- shlr/sdb/src/diff.c | 2 +- shlr/sdb/src/disk.c | 2 +- shlr/sdb/src/fmt.c | 2 +- shlr/sdb/src/{sdbht.c => ht.c} | 2 +- shlr/sdb/src/ht_pp.c | 4 +- shlr/sdb/src/ht_pu.c | 4 +- shlr/sdb/src/ht_up.c | 4 +- shlr/sdb/src/ht_uu.c | 4 +- shlr/sdb/src/journal.c | 2 +- shlr/sdb/src/json.c | 3 +- shlr/sdb/src/json/Makefile | 1 + shlr/sdb/src/json/api.c | 2 +- shlr/sdb/src/json/js0n.c | 2 +- shlr/sdb/src/json/main.c | 6 +- shlr/sdb/src/json/path.c | 5 +- shlr/sdb/src/json/rangstr.c | 2 +- shlr/sdb/src/lock.c | 2 +- shlr/sdb/src/ls.c | 2 +- shlr/sdb/src/main.c | 22 ++++--- shlr/sdb/src/match.c | 2 +- shlr/sdb/src/ns.c | 2 +- shlr/sdb/src/num.c | 5 +- shlr/sdb/src/query.c | 2 +- shlr/sdb/src/sdb.c | 2 +- shlr/sdb/src/set.c | 2 +- shlr/sdb/src/text.c | 2 +- shlr/sdb/src/util.c | 2 +- shlr/sdb/wasi.mk | 4 +- shlr/sdb/wasi.sh | 9 +-- shlr/winkd/Makefile | 2 +- sys/sdk.sh | 2 +- test/Makefile | 1 + test/unit/Makefile | 4 +- vsfix.bat | 2 +- 112 files changed, 232 insertions(+), 210 deletions(-) rename shlr/sdb/{src => include/sdb}/buffer.h (100%) rename shlr/sdb/{src => include/sdb}/cdb.h (100%) rename shlr/sdb/{src => include/sdb}/cdb_make.h (100%) rename shlr/sdb/{src => include/sdb}/config.h (100%) rename shlr/sdb/{src => include/sdb}/dict.h (100%) rename shlr/sdb/{src/sdbht.h => include/sdb/ht.h} (100%) rename shlr/sdb/{src => include/sdb}/ht_inc.h (100%) rename shlr/sdb/{src => include/sdb}/ht_pp.h (100%) rename shlr/sdb/{src => include/sdb}/ht_pu.h (100%) rename shlr/sdb/{src => include/sdb}/ht_up.h (96%) rename shlr/sdb/{src => include/sdb}/ht_uu.h (95%) rename shlr/sdb/{src => include/sdb}/ls.h (100%) rename shlr/sdb/{src/json => include/sdb}/rangstr.h (95%) rename shlr/sdb/{src => include/sdb}/sdb.h (99%) rename shlr/sdb/{src => include/sdb}/set.h (100%) rename shlr/sdb/{src => include/sdb}/types.h (100%) rename shlr/sdb/src/{sdbht.c => ht.c} (98%) diff --git a/.gitignore b/.gitignore index 0bf6a0760c..f105442902 100644 --- a/.gitignore +++ b/.gitignore @@ -75,8 +75,10 @@ shlr/sdb/src/sdb shlr/sdb/src/.sdb shlr/sdb/src/sdb.exe shlr/sdb/src/.sdb.exe +shlr/sdb/include/sdb/version.h shlr/sdb/src/sdb-version.h shlr/sdb/src/sdb_version.h +shlr/sdb/include/sdb/version.h shlr/sdb/src/libsdb.so* shlr/spp/config.h shlr/.cs_tmp.zip diff --git a/Makefile b/Makefile index 0737bd277a..ef4a4b2c81 100644 --- a/Makefile +++ b/Makefile @@ -155,7 +155,7 @@ windist: mkdir -p "${WINDIST}/include/libr/r_util" mkdir -p "${WINDIST}/include/libr/r_anal" @echo "${C}[WINDIST] Copying development files${R}" - cp -f shlr/sdb/src/*.h "${WINDIST}/include/libr/sdb/" + cp -f shlr/sdb/include/*.h "${WINDIST}/include/libr/sdb/" cp -f libr/include/r_util/*.h "${WINDIST}/include/libr/r_util/" cp -f libr/include/r_anal/*.h "${WINDIST}/include/libr/r_anal/" cp -f libr/include/*.h "${WINDIST}/include/libr" @@ -232,10 +232,8 @@ install: install-doc install-man install-www install-pkgconfig $(MAKE) -C binr install $(MAKE) -C shlr install for DIR in ${DATADIRS} ; do $(MAKE) -C "$$DIR" install ; done - cd "$(DESTDIR)$(LIBDIR)/radare2/" ;\ - rm -f last ; ln -fs $(VERSION) last - cd "$(DESTDIR)$(DATADIR)/radare2/" ;\ - rm -f last ; ln -fs $(VERSION) last + cd "$(DESTDIR)$(LIBDIR)/radare2/" && rm -f last && ln -fs $(VERSION) last + cd "$(DESTDIR)$(DATADIR)/radare2/" && rm -f last && ln -fs $(VERSION) last rm -rf "${DESTDIR}${DATADIR}/radare2/${VERSION}/hud" mkdir -p "${DESTDIR}${DATADIR}/radare2/${VERSION}/hud" mkdir -p "${DESTDIR}${BINDIR}" @@ -410,6 +408,9 @@ osx-pkg: quality: ./sys/shellcheck.sh +ctags: + @ctags **/*.c **/*.h > /dev/null + menu nconfig: ./sys/menu.sh || true diff --git a/binr/rules.mk b/binr/rules.mk index eeee3eb714..17dbf4d169 100644 --- a/binr/rules.mk +++ b/binr/rules.mk @@ -15,7 +15,7 @@ endif ifeq ($(USE_PIE),1) CFLAGS+=-pie endif -CFLAGS:=-I$(LTOP)/include -I$(LTOP)/include/sdb $(CFLAGS) +CFLAGS:=-I$(LTOP)/include $(CFLAGS) ifeq (${ANDROID},1) LDFLAGS+=-lm diff --git a/libr/Makefile b/libr/Makefile index 7eb4177aa0..ccaae0794c 100644 --- a/libr/Makefile +++ b/libr/Makefile @@ -186,7 +186,7 @@ install-includes: done ; \ done) ${INSTALL_DIR} "${DESTDIR}${INCLUDEDIR}/libr/sdb" - (cd ../shlr/sdb/src && for FILE in *.h ; do \ + (cd ../shlr/sdb/include/sdb && for FILE in *.h ; do \ ${INSTALL_DATA} $$FILE "${DESTDIR}${INCLUDEDIR}/libr/sdb/$$FILE" ; \ done) for a in r_util r_crypto r_anal ; do \ @@ -202,7 +202,7 @@ symstall install-symlink: "${DESTDIR}${LIBDIR}/pkgconfig" \ "${DESTDIR}${LIBDIR}/radare2/${VERSION}" ; \ rm -rf "${DESTDIR}${INCLUDEDIR}/libr" && ln -fs "${PWD}/include" "${DESTDIR}${INCLUDEDIR}/libr" ; \ - rm -rf "${DESTDIR}${INCLUDEDIR}/libr/sdb" && ln -fs "${PWD}/../shlr/sdb/src" "${DESTDIR}${INCLUDEDIR}/libr/sdb" ; \ + rm -rf "${DESTDIR}${INCLUDEDIR}/libr/sdb" && ln -fs "${PWD}/../shlr/sdb/include/sdb" "${DESTDIR}${INCLUDEDIR}/libr/sdb" ; \ $(MAKE) install-pkgconfig-symlink ; \ $(foreach lib,${LIBS}, \ ln -fs "${PWD}/$(lib)/libr_$(lib).${EXT_SO}" \ diff --git a/libr/anal/block.c b/libr/anal/block.c index 7aa12a68aa..9c84b94051 100644 --- a/libr/anal/block.c +++ b/libr/anal/block.c @@ -2,7 +2,6 @@ #include #include -#include #define unwrap(rbnode) container_of (rbnode, RAnalBlock, _rb) diff --git a/libr/anal/p/anal_arm_cs.c b/libr/anal/p/anal_arm_cs.c index e20e6fbafa..647dbc9856 100644 --- a/libr/anal/p/anal_arm_cs.c +++ b/libr/anal/p/anal_arm_cs.c @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include #include diff --git a/libr/anal/p/anal_arm_v35.c b/libr/anal/p/anal_arm_v35.c index b24bd6ce33..3fddc67aaa 100644 --- a/libr/anal/p/anal_arm_v35.c +++ b/libr/anal/p/anal_arm_v35.c @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include "encodings_dec.h" #include "encodings_fmt.h" diff --git a/libr/anal/type.c b/libr/anal/type.c index 56bc355ed6..7db6664fd8 100644 --- a/libr/anal/type.c +++ b/libr/anal/type.c @@ -2,7 +2,7 @@ #include #include -#include +#include #include "base_types.h" #define KSZ 256 diff --git a/libr/asm/arch/tms320/tms320_dasm.c b/libr/asm/arch/tms320/tms320_dasm.c index bb97bf2dce..a040a3e73c 100644 --- a/libr/asm/arch/tms320/tms320_dasm.c +++ b/libr/asm/arch/tms320/tms320_dasm.c @@ -12,7 +12,7 @@ /* public headers */ #include #include -#include +#include /* private headers */ diff --git a/libr/asm/p/asm_arm.c b/libr/asm/p/asm_arm.c index c4fb38ebfc..5c1a4ed9d5 100644 --- a/libr/asm/p/asm_arm.c +++ b/libr/asm/p/asm_arm.c @@ -2,7 +2,7 @@ #include #include -#include +#include #include "cs_version.h" #include "../arch/arm/asm-arm.h" diff --git a/libr/bin/format/coff/coff.h b/libr/bin/format/coff/coff.h index 868dd34154..4f521112ec 100644 --- a/libr/bin/format/coff/coff.h +++ b/libr/bin/format/coff/coff.h @@ -7,7 +7,6 @@ #include #include #include -#include #define COFF_IS_BIG_ENDIAN 1 #define COFF_IS_LITTLE_ENDIAN 0 diff --git a/libr/bin/format/pe/pe.c b/libr/bin/format/pe/pe.c index 54471ef46a..e661a7def0 100644 --- a/libr/bin/format/pe/pe.c +++ b/libr/bin/format/pe/pe.c @@ -2,7 +2,7 @@ #include #include -#include +#include #include "pe.h" #define PE_IMAGE_FILE_MACHINE_RPI2 452 diff --git a/libr/bin/p/bin_coff.c b/libr/bin/p/bin_coff.c index 6cfd15bbd9..b063ed701c 100644 --- a/libr/bin/p/bin_coff.c +++ b/libr/bin/p/bin_coff.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include "coff/coff.h" diff --git a/libr/bin/p/bin_dyldcache.c b/libr/bin/p/bin_dyldcache.c index 5d615bd17d..7c41437626 100644 --- a/libr/bin/p/bin_dyldcache.c +++ b/libr/bin/p/bin_dyldcache.c @@ -6,7 +6,6 @@ #include #include #include -#include // #include "../format/mach0/mach0_defines.h" #define R_BIN_MACH064 1 #include "../format/mach0/mach0.h" diff --git a/libr/bin/p/bin_elf.inc b/libr/bin/p/bin_elf.inc index 44067d5105..46a3158c73 100644 --- a/libr/bin/p/bin_elf.inc +++ b/libr/bin/p/bin_elf.inc @@ -9,7 +9,7 @@ #include #include "../i/private.h" #include "elf/elf.h" -#include +#include static RBinInfo* info(RBinFile *bf); diff --git a/libr/bin/p/bin_mach0.c b/libr/bin/p/bin_mach0.c index b7d00749b5..a38714f353 100644 --- a/libr/bin/p/bin_mach0.c +++ b/libr/bin/p/bin_mach0.c @@ -5,7 +5,7 @@ #include "../i/private.h" #include "mach0/mach0.h" #include "objc/mach0_classes.h" -#include +#include typedef struct { ut8 *buf; diff --git a/libr/bin/p/bin_symbols.c b/libr/bin/p/bin_symbols.c index b3e2b4cf93..29dbbf1e48 100644 --- a/libr/bin/p/bin_symbols.c +++ b/libr/bin/p/bin_symbols.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include "../i/private.h" #include "mach0/coresymbolication.h" diff --git a/libr/cons/grep.c b/libr/cons/grep.c index b17bc221b6..4dc868959d 100644 --- a/libr/cons/grep.c +++ b/libr/cons/grep.c @@ -3,7 +3,7 @@ #include #include #include -#include +#include #define I(x) r_cons_singleton ()->x diff --git a/libr/core/canal.c b/libr/core/canal.c index 4a2a0c1e5a..73047710e2 100644 --- a/libr/core/canal.c +++ b/libr/core/canal.c @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include HEAPTYPE (ut64); diff --git a/libr/core/cmd_api.c b/libr/core/cmd_api.c index 295118fc69..e77cf86620 100644 --- a/libr/core/cmd_api.c +++ b/libr/core/cmd_api.c @@ -2,7 +2,7 @@ #define R_LOG_ORIGIN "cmdapi" #include -#include "ht_pp.h" +#include #define NCMDS (sizeof (cmd->cmds) / sizeof (*cmd->cmds)) diff --git a/libr/core/cmd_debug.c b/libr/core/cmd_debug.c index 5a4d284519..68f3817228 100644 --- a/libr/core/cmd_debug.c +++ b/libr/core/cmd_debug.c @@ -2,7 +2,7 @@ #include #include -#include +#include #define TN_KEY_LEN 32 #define TN_KEY_FMT "%"PFMT64u #ifndef SIGKILL diff --git a/libr/core/cmd_meta.c b/libr/core/cmd_meta.c index c6e3b47125..651529e81a 100644 --- a/libr/core/cmd_meta.c +++ b/libr/core/cmd_meta.c @@ -6,7 +6,7 @@ #include "r_core.h" #include "r_util.h" #include "r_types.h" -#include +#include char *getcommapath(RCore *core); diff --git a/libr/core/cmd_search.c b/libr/core/cmd_search.c index 026eb7a831..2ff354371b 100644 --- a/libr/core/cmd_search.c +++ b/libr/core/cmd_search.c @@ -1,7 +1,7 @@ /* radare - LGPL - Copyright 2010-2022 - pancake */ #include -#include +#include #include "cmd_search_rop.c" static int cmd_search(void *data, const char *input); diff --git a/libr/core/core.c b/libr/core/core.c index c824a746b1..1fadedb378 100644 --- a/libr/core/core.c +++ b/libr/core/core.c @@ -4171,7 +4171,8 @@ R_API RBuffer *r_core_syscall(RCore *core, const char *name, const char *args) { } R_API RCoreAutocomplete *r_core_autocomplete_add(RCoreAutocomplete *parent, const char* cmd, int type, bool lock) { - if (!parent || !cmd || type < 0 || type >= R_CORE_AUTOCMPLT_END) { + r_return_val_if_fail (parent && cmd, NULL); + if (type < 0 || type >= R_CORE_AUTOCMPLT_END) { return NULL; } RCoreAutocomplete *autocmpl = R_NEW0 (RCoreAutocomplete); diff --git a/libr/esil/esil_handler.c b/libr/esil/esil_handler.c index 7587ac924e..fa55458d74 100644 --- a/libr/esil/esil_handler.c +++ b/libr/esil/esil_handler.c @@ -1,6 +1,6 @@ #include #include -#include +#include static bool _set_interrupt(REsil *esil, REsilHandler *intr, ut32 intr_num) { return intr_num ? dict_set (esil->interrupts, intr_num, intr_num, intr) : (esil->intr0 = intr, true); diff --git a/libr/include/r_anal.h b/libr/include/r_anal.h index faed61ada3..bc990b7694 100644 --- a/libr/include/r_anal.h +++ b/libr/include/r_anal.h @@ -17,10 +17,10 @@ #include #include #include -#include #include #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/libr/include/r_arch.h b/libr/include/r_arch.h index 6da1a16df3..efc2603a8e 100644 --- a/libr/include/r_arch.h +++ b/libr/include/r_arch.h @@ -19,7 +19,7 @@ struct r_reg_t; #include #include -#include +#include enum { R_ARCH_SYNTAX_NONE = 0, diff --git a/libr/include/r_bin.h b/libr/include/r_bin.h index a80640b6cb..a130defaa8 100644 --- a/libr/include/r_bin.h +++ b/libr/include/r_bin.h @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/libr/include/r_cmd.h b/libr/include/r_cmd.h index f825b62c05..7cb4a779ba 100644 --- a/libr/include/r_cmd.h +++ b/libr/include/r_cmd.h @@ -3,7 +3,7 @@ #include #include -#include "ht_pp.h" +#include #ifdef __cplusplus extern "C" { diff --git a/libr/include/r_cons.h b/libr/include/r_cons.h index abe243c5fd..4383e78a8e 100644 --- a/libr/include/r_cons.h +++ b/libr/include/r_cons.h @@ -21,8 +21,8 @@ extern "C" { #include #include #include -#include -#include +#include +#include #include #include diff --git a/libr/include/r_list.h b/libr/include/r_list.h index dfd439896f..f46b7ff2ef 100644 --- a/libr/include/r_list.h +++ b/libr/include/r_list.h @@ -2,7 +2,7 @@ #define R2_LIST_H #include -#include +#include #ifdef __cplusplus extern "C" { #endif diff --git a/libr/include/r_syscall.h b/libr/include/r_syscall.h index 2da728c421..06da34c4b3 100644 --- a/libr/include/r_syscall.h +++ b/libr/include/r_syscall.h @@ -9,7 +9,7 @@ extern "C" { #include #include -#include +#include R_LIB_VERSION_HEADER (r_syscall); diff --git a/libr/include/r_util/r_ctypes.h b/libr/include/r_util/r_ctypes.h index 53f1e2e581..9250fc36d3 100644 --- a/libr/include/r_util/r_ctypes.h +++ b/libr/include/r_util/r_ctypes.h @@ -5,7 +5,7 @@ extern "C" { #endif -#include +#include typedef struct r_type_enum { char *name; diff --git a/libr/include/r_util/r_event.h b/libr/include/r_util/r_event.h index f08ea86265..6a8c6eb566 100644 --- a/libr/include/r_util/r_event.h +++ b/libr/include/r_util/r_event.h @@ -7,7 +7,7 @@ extern "C" { #endif -#include +#include #include typedef struct r_event_t { diff --git a/libr/include/r_util/r_str_constpool.h b/libr/include/r_util/r_str_constpool.h index cec9a56e90..a3cbc0f4ac 100644 --- a/libr/include/r_util/r_str_constpool.h +++ b/libr/include/r_util/r_str_constpool.h @@ -2,7 +2,7 @@ #define R_STR_CONSTPOOL_H #include -#include +#include #include diff --git a/libr/include/rvc.h b/libr/include/rvc.h index b181f1d7ed..5a3ec53f3c 100644 --- a/libr/include/rvc.h +++ b/libr/include/rvc.h @@ -9,7 +9,7 @@ extern "C" { #endif #include -#include +#include typedef struct r_vc_blob_t { char *fname; diff --git a/libr/io/io.c b/libr/io/io.c index 64ea56c2ff..8c9312205a 100644 --- a/libr/io/io.c +++ b/libr/io/io.c @@ -1,7 +1,7 @@ /* radare2 - LGPL - Copyright 2008-2022 - condret, pancake, alvaro_fe */ #include -#include +#include #include R_LIB_VERSION (r_io); diff --git a/libr/io/io_map.c b/libr/io/io_map.c index a9c697ea5c..e648a23afc 100644 --- a/libr/io/io_map.c +++ b/libr/io/io_map.c @@ -2,8 +2,8 @@ #include #include -#include #include +#include #define END_OF_MAP_IDS UT32_MAX R_IPI bool io_bank_has_map(RIO *io, const ut32 bankid, const ut32 mapid); diff --git a/libr/util/list.c b/libr/util/list.c index 3fbb9c3dde..54d4bbe974 100644 --- a/libr/util/list.c +++ b/libr/util/list.c @@ -2,7 +2,7 @@ #define _R_LIST_C_ #include "r_util.h" -#include +#include #define MERGE_LIMIT 24 diff --git a/libr/util/sdb.mk b/libr/util/sdb.mk index d5422433b5..9d66a554ab 100644 --- a/libr/util/sdb.mk +++ b/libr/util/sdb.mk @@ -1,4 +1,5 @@ -SDBPATH=../../shlr/sdb/src/ +SDBPATH=$(SHLR)/sdb/src/ +SDBINCDIR=$(SHLR)/sdb/include SDBLIB=${SDBPATH}/libsdb.a EXTRA_TARGETS+=${SDBLIB} EXTRA_PRE+=$(SDBLIB) @@ -16,7 +17,7 @@ SDB_OBJS+=ht_uu.o SDB_OBJS+=ht_up.o SDB_OBJS+=ht_pp.o SDB_OBJS+=ht_pu.o -SDB_OBJS+=sdbht.o +SDB_OBJS+=ht.o SDB_OBJS+=json.o SDB_OBJS+=text.o SDB_OBJS+=lock.o @@ -39,7 +40,7 @@ SDBOBJS=$(addprefix ${SDBPATH},${SDB_OBJS}) OBJS+=$(SDBOBJS) -CFLAGS+=-I$(SDBPATH) +CFLAGS+=-I$(SDBINCDIR) $(SDBLIB): $(MAKE) -C ../../shlr sdbs diff --git a/meson.build b/meson.build index 9753dbac12..f0e989167c 100644 --- a/meson.build +++ b/meson.build @@ -474,13 +474,14 @@ sdb_files = [ 'shlr/sdb/src/num.c', 'shlr/sdb/src/query.c', 'shlr/sdb/src/sdb.c', - 'shlr/sdb/src/sdbht.c', + 'shlr/sdb/src/ht.c', 'shlr/sdb/src/util.c', 'shlr/sdb/src/text.c' ] -sdb_inc = [platform_inc, include_directories(join_paths('shlr','sdb','src'))] +sdb_inc = [platform_inc, include_directories(join_paths('shlr','sdb','include'))] +# XXX we have sdb/meson.build for this!! dont dup # Create sdb_version.h r = run_command(py3_exe, join_paths('sys','sdb_version.py'), join_paths('shlr','sdb','config.mk')) if r.returncode() == 0 @@ -488,25 +489,25 @@ if r.returncode() == 0 else sdb_version = 'unknown' endif -run_command(py3_exe, '-c', 'with open("shlr/sdb/src/sdb_version.h", "w") as f: f.write("#define SDB_VERSION \"' + sdb_version + '\"")') +run_command(py3_exe, '-c', 'with open("shlr/sdb/include/sdb/version.h", "w") as f: f.write("#define SDB_VERSION \"' + sdb_version + '\"")') sdb_inc_files = [ - 'shlr/sdb/src/buffer.h', - 'shlr/sdb/src/cdb.h', - 'shlr/sdb/src/set.h', - 'shlr/sdb/src/cdb_make.h', - 'shlr/sdb/src/config.h', - 'shlr/sdb/src/dict.h', - 'shlr/sdb/src/ht_inc.h', - 'shlr/sdb/src/ht_pp.h', - 'shlr/sdb/src/ht_up.h', - 'shlr/sdb/src/ht_uu.h', - 'shlr/sdb/src/ht_pu.h', - 'shlr/sdb/src/ls.h', - 'shlr/sdb/src/sdb.h', - 'shlr/sdb/src/sdbht.h', - 'shlr/sdb/src/sdb_version.h', - 'shlr/sdb/src/types.h' + 'shlr/sdb/include/sdb/buffer.h', + 'shlr/sdb/include/sdb/cdb.h', + 'shlr/sdb/include/sdb/set.h', + 'shlr/sdb/include/sdb/cdb_make.h', + 'shlr/sdb/include/sdb/config.h', + 'shlr/sdb/include/sdb/dict.h', + 'shlr/sdb/include/sdb/ht_inc.h', + 'shlr/sdb/include/sdb/ht_pp.h', + 'shlr/sdb/include/sdb/ht_up.h', + 'shlr/sdb/include/sdb/ht_uu.h', + 'shlr/sdb/include/sdb/ht_pu.h', + 'shlr/sdb/include/sdb/ls.h', + 'shlr/sdb/include/sdb/sdb.h', + 'shlr/sdb/include/sdb/ht.h', + 'shlr/sdb/include/sdb/version.h', + 'shlr/sdb/include/sdb/types.h' ] install_headers(sdb_inc_files, install_dir: join_paths(r2_incdir, 'sdb')) @@ -523,7 +524,7 @@ sdb_dep = declare_dependency( sdb_exe = executable('sdb', ['shlr/sdb/src/main.c'] + sdb_files, include_directories: [ - include_directories('shlr/sdb/src') + include_directories('shlr/sdb/include') ], implicit_include_directories: false, native: true, diff --git a/pkgcfg/r_util.pc.acr b/pkgcfg/r_util.pc.acr index 9c5d7e3888..410240c63f 100644 --- a/pkgcfg/r_util.pc.acr +++ b/pkgcfg/r_util.pc.acr @@ -8,4 +8,4 @@ Description: radare foundation libraries Version: @VERSION@ Requires: Libs: -L${libdir} -lr_util @LIBZIP@ @DL_LIBS@ -Cflags: -I${includedir}/libr -I${includedir}/libr/sdb +Cflags: -I${includedir}/libr diff --git a/shlr/Makefile b/shlr/Makefile index 788ebf648a..f527eb269c 100644 --- a/shlr/Makefile +++ b/shlr/Makefile @@ -125,8 +125,8 @@ sdb-host: @echo "HOST SDB" @echo ">>>>>>>>" @echo - $(MAKE) -C sdb clean ; rm -f sdb/src/*.o sdb/src/sdb_version.h - $(MAKE) -C sdb/src "CC=${HOST_CC}" LDFLAGS='${HOST_LDFLAGS}' CPPFLAGS='' CFLAGS='${HOST_CFLAGS} ${PIC}' bin + $(MAKE) -C sdb clean ; rm -f sdb/src/*.o sdb/include/sdb/version.h + $(MAKE) -C sdb/src "CC=${HOST_CC}" LDFLAGS='${HOST_LDFLAGS}' CPPFLAGS='-I$(SHLR)/sdb/include' CFLAGS='${HOST_CFLAGS} ${PIC}' bin cp -f sdb/src/sdb${BUILD_EXT_EXE} sdb/src/.sdb${BUILD_EXT_EXE} cp -f sdb/src/sdb${BUILD_EXT_EXE} sdb/sdb$(BUILD_EXT_EXE) rm -f $(SDB_LIBA) @@ -139,19 +139,21 @@ sdb-target: @echo ">>>>>>>>>>" @echo rm -f src/libsdb.$(EXT_AR) - $(MAKE) -C sdb clean ; rm -f sdb/src/*.o sdb/src/sdb_version.h - $(MAKE) -C sdb/src sdb_version.h + $(MAKE) -C sdb clean ; rm -f sdb/src/*.o ../include/sdb/version.h + $(MAKE) -C sdb/src ../include/sdb/version.h ifeq ($(EXT_EXE),.wasm) - $(MAKE) -C sdb/src ARCH=xxx EXT_AR=.$(EXT_AR) RANLIB="${RANLIB}" CFLAGS_SHARED="${CFLAGS_SHARED} -DHAVE_MMAN=0" \ + $(MAKE) -C sdb/src ARCH=xxx EXT_AR=.$(EXT_AR) RANLIB="${RANLIB}" CPPFLAGS=-I$(SHLR)/sdb/include \ + CFLAGS_SHARED="${CFLAGS_SHARED} -DHAVE_MMAN=0" \ CC="${CC}" AR="${AR}" ARCH=undefined CFLAGS='${CFLAGS} -DHAVE_MMAN=0' LDFLAGS='${LDFLAGS}' libsdb.$(EXT_AR) else - $(MAKE) -C sdb/src ARCH=xxx EXT_AR=.$(EXT_AR) RANLIB="${RANLIB}" CFLAGS_SHARED="${CFLAGS_SHARED}" \ + $(MAKE) -C sdb/src ARCH=xxx EXT_AR=.$(EXT_AR) RANLIB="${RANLIB}" CPPFLAGS=-I$(SHLR)/sdb/include \ + CFLAGS_SHARED="${CFLAGS_SHARED}" \ CC="${CC}" AR="${AR}" ARCH=undefined LDFLAGS='${LDFLAGS}' libsdb.$(EXT_AR) endif $(RANLIB) sdb/src/libsdb.$(EXT_AR) .PHONY: sdb-sync sync-sdb sdbclean sdb-native sdb-target -SDB_F=README.md config.mk src Makefile meson.build wasi.mk wasi.sh +SDB_F=README.md config.mk src include Makefile meson.build wasi.mk wasi.sh SDB_SYNCFILES=$(addprefix sdb.vc/,${SDB_F}) I=../libr/include @@ -175,8 +177,8 @@ sdb-sync sync-sdb: mkdir -p sdb cp -rf ${SDB_SYNCFILES} sdb rm -rf sdb.vc - rm -f src/sdb_version.h - $(MAKE) -C sdb src/sdb_version.h + rm -f include/sdb/version.h + $(MAKE) -C sdb include/sdb/version.h mkdir -p sdb/test sdb/memcache sed -e 's,HAVE_VALA=,HAVE_VALA=#,' sdb/config.mk > .t mv .t sdb/config.mk diff --git a/shlr/ar/Makefile b/shlr/ar/Makefile index 284b4a6a34..6c398681ce 100644 --- a/shlr/ar/Makefile +++ b/shlr/ar/Makefile @@ -26,7 +26,7 @@ endif endif endif -CFLAGS:=-I../../libr/include -I../../libr/include/sdb $(CFLAGS) +CFLAGS:=-I../../libr/include $(CFLAGS) LIBAR=libr_ar.${EXT_AR} LDFLAGS+=-L../../libr/util LIBS=-lr_util diff --git a/shlr/bochs/Makefile b/shlr/bochs/Makefile index 8f4d5c106e..a4a18da405 100644 --- a/shlr/bochs/Makefile +++ b/shlr/bochs/Makefile @@ -6,7 +6,7 @@ AR?=ar RANLIB?=ranlib LIBNAME=libbochs LIBFILE=$(LIBNAME).$(EXT_SO) -CFLAGS:=-I$(LIBR)/include -I$(LIBR)/include/sdb -Iinclude $(PIC_CFLAGS) $(CFLAGS) +CFLAGS:=-I$(LIBR)/include -Iinclude $(PIC_CFLAGS) $(CFLAGS) MAJOR=0 MINOR=1 LD=$(CC) diff --git a/shlr/gdb/Makefile b/shlr/gdb/Makefile index 9eb2949dd0..042a6b1a6a 100644 --- a/shlr/gdb/Makefile +++ b/shlr/gdb/Makefile @@ -9,7 +9,7 @@ AR?=$(CC_AR) RANLIB?=ranlib LIBNAME=libgdbr LIBFILE=$(LIBNAME).$(EXT_SO) -CFLAGS:=-I$(LIBR)/include -I$(LIBR)/include/sdb $(PIC_CFLAGS) $(CFLAGS) +CFLAGS:=-I$(LIBR)/include $(PIC_CFLAGS) $(CFLAGS) CFLAGS+=-Iinclude -I${LIBR}/include MAJOR=0 MINOR=1 diff --git a/shlr/grub/Makefile b/shlr/grub/Makefile index e710c6aa61..f79f5bbba1 100644 --- a/shlr/grub/Makefile +++ b/shlr/grub/Makefile @@ -60,7 +60,7 @@ KERNFILES+=partmap/bsdlabel.c KERNFILES+=partmap/sunpc.c KERNOBJS=$(subst .c,.o,${KERNFILES}) -CFLAGS:=-I../../libr/include -I../../libr/include/sdb -DGRUB_TARGET_NO_MODULES $(CFLAGS) +CFLAGS:=-I../../libr/include -DGRUB_TARGET_NO_MODULES $(CFLAGS) CFLAGS+=-Iinclude # CFLAGS+=-g diff --git a/shlr/java/Makefile b/shlr/java/Makefile index f59d5924ec..bfb122f26c 100644 --- a/shlr/java/Makefile +++ b/shlr/java/Makefile @@ -25,7 +25,7 @@ CFLAGS+=-DMINGW32=1 endif # CFLAGS+=-g -CFLAGS:=-I../../libr/include -I../../libr/include/sdb $(CFLAGS) +CFLAGS:=-I../../libr/include $(CFLAGS) LDFLAGS+=-L../../libr/util OBJS=code.o class.o ops.o diff --git a/shlr/java/class.h b/shlr/java/class.h index e59a5354b4..916b96aca7 100644 --- a/shlr/java/class.h +++ b/shlr/java/class.h @@ -10,7 +10,7 @@ #define U(x) x #include #include -#include +#include #if defined(_MSC_VER) && !defined(R_API_BIN_ONLY) #undef R_API diff --git a/shlr/java/main.c b/shlr/java/main.c index 8b19acf7a9..bdb052d066 100644 --- a/shlr/java/main.c +++ b/shlr/java/main.c @@ -1,6 +1,6 @@ #include #include "code.h" -#include +#include int main() { Sdb *kv = sdb_new(NULL, NULL, 0); diff --git a/shlr/qnx/Makefile b/shlr/qnx/Makefile index 5954586def..4e46461b86 100644 --- a/shlr/qnx/Makefile +++ b/shlr/qnx/Makefile @@ -7,7 +7,7 @@ AR?=ar RANLIB?=ranlib LIBNAME=libqnxr LIBFILE=$(LIBNAME).$(EXT_SO) -CFLAGS:=-Iinclude -I$(LIBR)/include -I$(LIBR)/include/sdb $(PIC_CFLAGS) $(CFLAGS) +CFLAGS:=-Iinclude -I$(LIBR)/include $(PIC_CFLAGS) $(CFLAGS) MAJOR=0 MINOR=1 LD=$(CC) diff --git a/shlr/sdb.mk b/shlr/sdb.mk index 646fbb07f3..55eab31a65 100644 --- a/shlr/sdb.mk +++ b/shlr/sdb.mk @@ -1 +1 @@ -CFLAGS+=-I$(SHLR)/sdb/src +CFLAGS+=-I$(SHLR)/sdb/include diff --git a/shlr/sdb/Makefile b/shlr/sdb/Makefile index 76e1e88fd7..8cdc52cf7b 100644 --- a/shlr/sdb/Makefile +++ b/shlr/sdb/Makefile @@ -10,7 +10,7 @@ CFLAGS_ASAN=$(addprefix -fsanitize=,$(ASANOPTS)) CFLAGS_LEAK=$(addprefix -fsanitize=,$(LEAKOPTS)) MKDIR=mkdir -all: pkgconfig src/sdb_version.h +all: pkgconfig include/sdb/version.h ${MAKE} -C src ifeq ($(BUILD_MEMCACHE),1) ${MAKE} -C memcache @@ -36,7 +36,7 @@ o xo xoxo ox: g++ -o sdb src/*.c -I src/ wasi wasm: $(WASI_SDK) - ${MAKE} src/sdb_version.h + ${MAKE} include/sdb/version.h CC=$(WASI_CC) CFLAGS="$(WASI_CFLAGS)" $(MAKE) CC=$(WASI_CC) -C src all WITHPIC=0 mv src/sdb src/sdb.wasm file src/sdb.wasm @@ -45,34 +45,35 @@ test: ${MAKE} -C test asan: - $(MAKE) src/sdb_version.h + $(MAKE) include/sdb/version.h CC=gcc LDFLAGS="$(CFLAGS_ASAN)" CFLAGS="$(CFLAGS_ASAN)" ${MAKE} -C src all asantest: export ASAN_OPTIONS=detect_leaks=0 ; \ CC=gcc CFLAGS="$(CFLAGS_ASAN)" ${MAKE} -C test leak: - $(MAKE) src/sdb_version.h + $(MAKE) include/sdb/version.h CC=gcc LDFLAGS="$(CFLAGS_LEAK)" CFLAGS="$(CFLAGS_LEAK)" $(MAKE) -C src all + leaktest: - CC=gcc CFLAGS="$(CFLAGS_LEAK)" $(MAKE) -C test + CC=gcc CFLAGS="$(CFLAGS_LEAK)" LDFLAGS="$(CFLAGS_LEAK)" $(MAKE) -C test pkgconfig: [ -d pkgconfig ] && ${MAKE} -C pkgconfig || true -src/sdb_version.h: - echo '#define SDB_VERSION "${SDBVER}"' > src/sdb_version.h +include/sdb/version.h: + echo '#define SDB_VERSION "${SDBVER}"' > include/sdb/version.h CFILES=cdb.c buffer.c cdb_make.c ls.c ht.c sdb.c num.c base64.c text.c CFILES+=json.c ns.c lock.c util.c disk.c query.c array.c fmt.c main.c EMCCFLAGS=-O2 -s EXPORTED_FUNCTIONS="['_sdb_querys','_sdb_new0']" #EMCCFLAGS+=--embed-file sdb.data -sdb.js: src/sdb_version.h +sdb.js: include/sdb/version.h cd src ; emcc ${EMCCFLAGS} -I. -o ../sdb.js ${CFILES} clean: - rm -f src/sdb_version.h + rm -f include/sdb/version.h $(MAKE) -C src clean $(MAKE) -C memcache clean $(MAKE) -C test clean @@ -101,9 +102,9 @@ install-dirs: $(INSTALL_DIR) ${DESTDIR}${MANDIR} ${DESTDIR}${LIBDIR}/pkgconfig ${DESTDIR}${BINDIR} $(INSTALL_DIR) ${DESTDIR}${DATADIR}/vala/vapi ${DESTDIR}${INCDIR}/sdb -INCFILES=src/sdb.h src/sdb_version.h src/cdb.h src/ht_uu.h src/ht_up.h src/ht_pp.h src/types.h -INCFILES+=src/ls.h src/cdb_make.h src/buffer.h src/config.h src/sdbht.h -INCFILES+=src/dict.h src/set.h src/ht_inc.h +INCFLS=sdb.h version.h cdb.h ht_uu.h ht_up.h ht_pp.h types.h +INCFLS+=ls.h cdb_make.h buffer.h config.h ht.h dict.h set.h ht_inc.h +INCFILES=$(addprefix include/sdb/,$(INCFLS)) install: pkgconfig install-dirs $(INSTALL_MAN) src/sdb.1 ${DESTDIR}${MANDIR} @@ -115,8 +116,9 @@ install: pkgconfig install-dirs ln -s libsdb$(SOVER) libsdb$(EXT_SO) ; \ ln -s libsdb$(SOVER) libsdb$(EXT_SO).$(SOVERSION) ; \ fi - $(INSTALL_DATA) $(INCFILES) ${DESTDIR}${INCDIR}/sdb - $(INSTALL_PROGRAM) src/sdb ${DESTDIR}${BINDIR} + mkdir -p $(DESTDIR)/$(INCDIR)/sdb + $(INSTALL_DATA) $(INCFILES) $(DESTDIR)$(INCDIR)/sdb + $(INSTALL_PROGRAM) src/sdb $(DESTDIR)$(BINDIR) ifeq ($(BUILD_MEMCACHE),1) $(INSTALL_DATA) memcache/libmcsdb.a ${DESTDIR}${LIBDIR} $(INSTALL_DATA) memcache/mcsdb.h ${DESTDIR}${INCDIR}/sdb @@ -151,21 +153,21 @@ ifneq (${HAVE_VALA},) endif symstall: install-dirs - cd src ; for a in libsdb.* ; do \ - ln -fs ${PWD}/src/$$a ${DESTDIR}${LIBDIR}/$$a ; done + cd src && for a in libsdb.* ; do ln -fs ${PWD}/src/$$a ${DESTDIR}${LIBDIR}/$$a ; done ln -fs ${PWD}/src/sdb.1 ${DESTDIR}${MANDIR}/sdb.1 ln -fs ${PWD}/src/sdb ${DESTDIR}${BINDIR} - ln -fs ${PWD}/src/sdb.h ${DESTDIR}${INCDIR}/sdb - ln -fs ${PWD}/src/sdb_version.h ${DESTDIR}${INCDIR}/sdb - ln -fs ${PWD}/src/cdb.h ${DESTDIR}${INCDIR}/sdb - ln -fs ${PWD}/src/ht_uu.h ${DESTDIR}${INCDIR}/sdb - ln -fs ${PWD}/src/ht_up.h ${DESTDIR}${INCDIR}/sdb - ln -fs ${PWD}/src/ht_pp.h ${DESTDIR}${INCDIR}/sdb - ln -fs ${PWD}/src/types.h ${DESTDIR}${INCDIR}/sdb - ln -fs ${PWD}/src/ls.h ${DESTDIR}${INCDIR}/sdb - ln -fs ${PWD}/src/cdb_make.h ${DESTDIR}${INCDIR}/sdb - ln -fs ${PWD}/src/buffer.h ${DESTDIR}${INCDIR}/sdb - ln -fs ${PWD}/src/config.h ${DESTDIR}${INCDIR}/sdb + mkdir -p ${DESTDIR}${INCDIR}/sdb + ln -fs ${PWD}/include/sdb/sdb.h ${DESTDIR}${INCDIR}/sdb + ln -fs ${PWD}/include/sdb/version.h ${DESTDIR}${INCDIR}/sdb + ln -fs ${PWD}/include/sdb/cdb.h ${DESTDIR}${INCDIR}/sdb + ln -fs ${PWD}/include/sdb/ht_uu.h ${DESTDIR}${INCDIR}/sdb + ln -fs ${PWD}/include/sdb/ht_up.h ${DESTDIR}${INCDIR}/sdb + ln -fs ${PWD}/include/sdb/ht_pp.h ${DESTDIR}${INCDIR}/sdb + ln -fs ${PWD}/include/sdb/types.h ${DESTDIR}${INCDIR}/sdb + ln -fs ${PWD}/include/sdb/ls.h ${DESTDIR}${INCDIR}/sdb + ln -fs ${PWD}/include/sdb/cdb_make.h ${DESTDIR}${INCDIR}/sdb + ln -fs ${PWD}/include/sdb/buffer.h ${DESTDIR}${INCDIR}/sdb + ln -fs ${PWD}/include/sdb/config.h ${DESTDIR}${INCDIR}/sdb ln -fs ${PWD}/bindings/vala/sdb.pc ${DESTDIR}${LIBDIR}/pkgconfig ln -fs ${PWD}/bindings/vala/mcsdb.pc ${DESTDIR}${LIBDIR}/pkgconfig ifneq (${HAVE_VALA},) @@ -183,7 +185,7 @@ WCP=i386-mingw32 # mxe #WCP=i686-pc-mingw32 -w32: src/sdb_version.h +w32: include/sdb/version.h cd src ; \ ${MAKE} OS=w32 WCP=${WCP} CC=${WCP}-gcc AR=${WCP}-ar RANLIB=${WCP}-ranlib sdb.exe @@ -191,7 +193,8 @@ w32: src/sdb_version.h IOS_CC=$(shell xcrun --sdk iphoneos --find clang) -isysroot $(shell xcrun --sdk iphoneos --show-sdk-path) -arch armv7 -arch arm64 IOS_AR=$(shell xcrun --sdk iphoneos --find ar) IOS_RL=$(shell xcrun --sdk iphoneos --find ranlib) -ios: src/sdb_version.h + +ios: include/sdb/version.h ${MAKE} CFLAGS=-DUSE_DLSYSTEM=1 OS=Darwin ARCH=arm CC="${IOS_CC}" AR="${IOS_AR}" RANLIB="${IOS_RL}" HAVE_VALA= all v version: diff --git a/shlr/sdb/config.mk b/shlr/sdb/config.mk index 484ed5b293..93ebfc7587 100644 --- a/shlr/sdb/config.mk +++ b/shlr/sdb/config.mk @@ -6,7 +6,7 @@ INCDIR=${PREFIX}/include VAPIDIR=${DATADIR}/vala/vapi/ MANDIR=${DATADIR}/man/man1 -SDBVER=1.9.2 +SDBVER=1.9.4 BUILD_MEMCACHE=0 diff --git a/shlr/sdb/src/buffer.h b/shlr/sdb/include/sdb/buffer.h similarity index 100% rename from shlr/sdb/src/buffer.h rename to shlr/sdb/include/sdb/buffer.h diff --git a/shlr/sdb/src/cdb.h b/shlr/sdb/include/sdb/cdb.h similarity index 100% rename from shlr/sdb/src/cdb.h rename to shlr/sdb/include/sdb/cdb.h diff --git a/shlr/sdb/src/cdb_make.h b/shlr/sdb/include/sdb/cdb_make.h similarity index 100% rename from shlr/sdb/src/cdb_make.h rename to shlr/sdb/include/sdb/cdb_make.h diff --git a/shlr/sdb/src/config.h b/shlr/sdb/include/sdb/config.h similarity index 100% rename from shlr/sdb/src/config.h rename to shlr/sdb/include/sdb/config.h diff --git a/shlr/sdb/src/dict.h b/shlr/sdb/include/sdb/dict.h similarity index 100% rename from shlr/sdb/src/dict.h rename to shlr/sdb/include/sdb/dict.h diff --git a/shlr/sdb/src/sdbht.h b/shlr/sdb/include/sdb/ht.h similarity index 100% rename from shlr/sdb/src/sdbht.h rename to shlr/sdb/include/sdb/ht.h diff --git a/shlr/sdb/src/ht_inc.h b/shlr/sdb/include/sdb/ht_inc.h similarity index 100% rename from shlr/sdb/src/ht_inc.h rename to shlr/sdb/include/sdb/ht_inc.h diff --git a/shlr/sdb/src/ht_pp.h b/shlr/sdb/include/sdb/ht_pp.h similarity index 100% rename from shlr/sdb/src/ht_pp.h rename to shlr/sdb/include/sdb/ht_pp.h diff --git a/shlr/sdb/src/ht_pu.h b/shlr/sdb/include/sdb/ht_pu.h similarity index 100% rename from shlr/sdb/src/ht_pu.h rename to shlr/sdb/include/sdb/ht_pu.h diff --git a/shlr/sdb/src/ht_up.h b/shlr/sdb/include/sdb/ht_up.h similarity index 96% rename from shlr/sdb/src/ht_up.h rename to shlr/sdb/include/sdb/ht_up.h index 0f084baf18..23bde02e2d 100644 --- a/shlr/sdb/src/ht_up.h +++ b/shlr/sdb/include/sdb/ht_up.h @@ -8,7 +8,7 @@ #undef HT_TYPE #define HT_TYPE 2 #include "ht_inc.h" -#include "sdbht.h" +#include "sdb/ht.h" #ifdef __cplusplus extern "C" { diff --git a/shlr/sdb/src/ht_uu.h b/shlr/sdb/include/sdb/ht_uu.h similarity index 95% rename from shlr/sdb/src/ht_uu.h rename to shlr/sdb/include/sdb/ht_uu.h index bac103fbca..69a45e1a1b 100644 --- a/shlr/sdb/src/ht_uu.h +++ b/shlr/sdb/include/sdb/ht_uu.h @@ -8,7 +8,7 @@ #undef HT_TYPE #define HT_TYPE 3 #include "ht_inc.h" -#include "sdbht.h" +#include "ht.h" #ifdef __cplusplus extern "C" { diff --git a/shlr/sdb/src/ls.h b/shlr/sdb/include/sdb/ls.h similarity index 100% rename from shlr/sdb/src/ls.h rename to shlr/sdb/include/sdb/ls.h diff --git a/shlr/sdb/src/json/rangstr.h b/shlr/sdb/include/sdb/rangstr.h similarity index 95% rename from shlr/sdb/src/json/rangstr.h rename to shlr/sdb/include/sdb/rangstr.h index e73ceb8240..74181e575b 100644 --- a/shlr/sdb/src/json/rangstr.h +++ b/shlr/sdb/include/sdb/rangstr.h @@ -2,7 +2,7 @@ #define _INCLUDE_RANGSTR_H_ #include -#include "../types.h" +#include "sdb/types.h" #define RangstrType unsigned int @@ -13,7 +13,7 @@ typedef struct { const char *p; } Rangstr; -#if 0 +#if 1 SDB_IPI void rangstr_print (Rangstr *s); SDB_IPI Rangstr rangstr_new (const char *s); SDB_IPI Rangstr rangstr_null(void); diff --git a/shlr/sdb/src/sdb.h b/shlr/sdb/include/sdb/sdb.h similarity index 99% rename from shlr/sdb/src/sdb.h rename to shlr/sdb/include/sdb/sdb.h index 1265484191..b562900f4a 100644 --- a/shlr/sdb/src/sdb.h +++ b/shlr/sdb/include/sdb/sdb.h @@ -11,12 +11,13 @@ extern "C" { #endif #include "types.h" -#include "sdbht.h" +#include "ht.h" #include "ls.h" #include "dict.h" #include "cdb.h" #include "cdb_make.h" -#include "sdb_version.h" +#include "version.h" +#include "rangstr.h" /* Key value sizes */ #define SDB_MIN_VALUE 1 @@ -281,7 +282,7 @@ SDB_API ut32 sdb_hash_len(const char *key, ut32 *len); SDB_API ut8 sdb_hash_byte(const char *s); /* json api */ -// SDB_API int sdb_js0n(const unsigned char *js, RangstrType len, RangstrType *out); +SDB_API int sdb_js0n(const unsigned char *js, RangstrType len, RangstrType *out); SDB_API bool sdb_isjson(const char *k); SDB_API char *sdb_json_get_str (const char *json, const char *path); SDB_API bool sdb_json_get_bool(const char *json, const char *path); diff --git a/shlr/sdb/src/set.h b/shlr/sdb/include/sdb/set.h similarity index 100% rename from shlr/sdb/src/set.h rename to shlr/sdb/include/sdb/set.h diff --git a/shlr/sdb/src/types.h b/shlr/sdb/include/sdb/types.h similarity index 100% rename from shlr/sdb/src/types.h rename to shlr/sdb/include/sdb/types.h diff --git a/shlr/sdb/meson.build b/shlr/sdb/meson.build index db460eb853..bbfa1279b7 100644 --- a/shlr/sdb/meson.build +++ b/shlr/sdb/meson.build @@ -32,11 +32,11 @@ else libsdb_name = 'sdb' endif -# Create sdb_version.h +# Create include/sdb/version.h conf_data = configuration_data() conf_data.set_quoted('SDB_VERSION', sdb_version, description : 'From config.mk') configure_file( - output : 'sdb_version.h', + output : 'version.h', configuration : conf_data, install_dir : join_paths(get_option('includedir'), 'sdb') ) @@ -65,12 +65,12 @@ libsdb_sources = [ 'src/num.c', 'src/query.c', 'src/sdb.c', - 'src/sdbht.c', + 'src/ht.c', 'src/util.c', 'src/text.c' ] -sdb_inc = include_directories(['.', 'src']) +sdb_inc = include_directories(['.', 'include']) rpath_lib = '' rpath_exe = '' if get_option('local') and get_option('default_library') == 'shared' @@ -99,21 +99,21 @@ sdb_dep = declare_dependency( if not meson.is_subproject() include_files = [ - 'src/buffer.h', - 'src/cdb.h', - 'src/cdb_make.h', - 'src/config.h', - 'src/dict.h', - 'src/ht_inc.h', - 'src/ht_pp.h', - 'src/ht_up.h', - 'src/ht_uu.h', - 'src/ht_up.h', - 'src/ls.h', - 'src/sdb.h', - 'src/sdbht.h', - 'src/set.h', - 'src/types.h' + 'include/sdb/buffer.h', + 'include/sdb/cdb.h', + 'include/sdb/cdb_make.h', + 'include/sdb/config.h', + 'include/sdb/dict.h', + 'include/sdb/ht_inc.h', + 'include/sdb/ht_pp.h', + 'include/sdb/ht_up.h', + 'include/sdb/ht_uu.h', + 'include/sdb/ht_up.h', + 'include/sdb/ls.h', + 'include/sdb/sdb.h', + 'include/sdb/ht.h', + 'include/sdb/set.h', + 'include/sdb/types.h' ] install_headers(include_files, subdir: 'sdb') endif diff --git a/shlr/sdb/src/Makefile b/shlr/sdb/src/Makefile index 6bd84f0f45..785df1ba79 100644 --- a/shlr/sdb/src/Makefile +++ b/shlr/sdb/src/Makefile @@ -1,9 +1,10 @@ include ../config.mk CFLAGS:=-g $(CFLAGS) -OBJ=cdb.o buffer.o cdb_make.o ls.o sdbht.o ht_uu.o sdb.o num.o base64.o match.o +OBJ=cdb.o buffer.o cdb_make.o ls.o ht.o ht_uu.o sdb.o num.o base64.o match.o OBJ+=json.o ns.o lock.o util.o disk.o query.o array.o fmt.o journal.o text.o OBJ+=dict.o ht_pp.o ht_up.o ht_pu.o set.o diff.o +CFLAGS+=-I ../include SOBJ=$(subst .o,.o.o,${OBJ}) WITHPIC?=1 BIN=sdb${EXT_EXE} @@ -21,19 +22,19 @@ json.o: json/api.c json/js0n.c json/path.c json/rangstr.c json/indent.c install: $(MAKE) -C .. install -sdb_version.h: - $(MAKE) -C .. src/sdb_version.h +../include/sdb/version.h: + $(MAKE) -C .. include/sdb/version.h -shared: sdb_version.h +shared: ../include/sdb/version.h $(MAKE) libsdb${SOVER} -static: sdb_version.h +static: ../include/sdb/version.h $(MAKE) libsdb$(EXT_AR) -sdb_objs: sdb_version.h +sdb_objs: ../include/sdb/version.h $(MAKE) ${OBJ} -sdb_objs2: sdb_version.h +sdb_objs2: ../include/sdb/version.h $(MAKE) ${SOBJ} libsdb.lib libsdb$(EXT_AR): sdb_objs @@ -58,7 +59,7 @@ ifneq ($(SILENT),) endif $(CC) ${LDFLAGS} $(LDFLAGS_SHARED) -o $@ ${SOBJ} -bin_deps: sdb_version.h +bin_deps: ../include/sdb/version.h $(MAKE) libsdb.a main.o bin $(BIN): bin_deps diff --git a/shlr/sdb/src/array.c b/shlr/sdb/src/array.c index dfe750515a..b4dc72a70f 100644 --- a/shlr/sdb/src/array.c +++ b/shlr/sdb/src/array.c @@ -1,6 +1,6 @@ /* sdb - MIT - Copyright 2011-2022 - pancake */ -#include "sdb.h" +#include "sdb/sdb.h" #include // TODO: Push should always prepend. do not make this configurable diff --git a/shlr/sdb/src/base64.c b/shlr/sdb/src/base64.c index e78d165cf4..f923ff1ac8 100644 --- a/shlr/sdb/src/base64.c +++ b/shlr/sdb/src/base64.c @@ -1,6 +1,6 @@ /* base64 enc/dec - MIT - Copyright 2011-2022 - pancake */ -#include "sdb.h" +#include "sdb/sdb.h" #define SZ 1024 static const char cb64[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; diff --git a/shlr/sdb/src/buffer.c b/shlr/sdb/src/buffer.c index fb1510c1cd..15cbcf1113 100644 --- a/shlr/sdb/src/buffer.c +++ b/shlr/sdb/src/buffer.c @@ -1,6 +1,6 @@ /* Public Domain */ -#include "buffer.h" +#include "sdb/buffer.h" void buffer_init(buffer *s, BufferOp op, int fd, char *buf, ut32 len) { s->x = buf; diff --git a/shlr/sdb/src/cdb.c b/shlr/sdb/src/cdb.c index f7ee0d6cc5..f274093e14 100644 --- a/shlr/sdb/src/cdb.c +++ b/shlr/sdb/src/cdb.c @@ -1,7 +1,7 @@ /* Public domain - author D. J. Bernstein, modified by pancake - 2014-2016 */ #include -#include "cdb.h" +#include "sdb/cdb.h" #if USE_MMAN #include #endif diff --git a/shlr/sdb/src/cdb_make.c b/shlr/sdb/src/cdb_make.c index 1e99c1c976..9747f56337 100644 --- a/shlr/sdb/src/cdb_make.c +++ b/shlr/sdb/src/cdb_make.c @@ -1,8 +1,8 @@ /* Public domain. */ -#include "sdb.h" -#include "cdb.h" -#include "cdb_make.h" +#include "sdb/sdb.h" +#include "sdb/cdb.h" +#include "sdb/cdb_make.h" #define ALIGNMENT sizeof (void*) diff --git a/shlr/sdb/src/dict.c b/shlr/sdb/src/dict.c index 4c04b07ac9..40fc5a9874 100644 --- a/shlr/sdb/src/dict.c +++ b/shlr/sdb/src/dict.c @@ -1,6 +1,6 @@ /* sdb - MIT - Copyright 2017-2022 - pancake */ -#include "sdb.h" +#include "sdb/sdb.h" SDB_API dict *dict_new(ut32 size, dict_freecb f) { dict *m = (dict *)calloc (1, sizeof (dict)); diff --git a/shlr/sdb/src/diff.c b/shlr/sdb/src/diff.c index 8da4ae0252..2be35fb517 100644 --- a/shlr/sdb/src/diff.c +++ b/shlr/sdb/src/diff.c @@ -1,6 +1,6 @@ /* sdb - MIT - Copyright 2019 - thestr4ng3r */ -#include "sdb.h" +#include "sdb/sdb.h" SDB_API int sdb_diff_format(char *str, int size, const SdbDiff *diff) { int r = 0; diff --git a/shlr/sdb/src/disk.c b/shlr/sdb/src/disk.c index a59113ce3a..c209686dd2 100644 --- a/shlr/sdb/src/disk.c +++ b/shlr/sdb/src/disk.c @@ -3,7 +3,7 @@ #include #include #include -#include "sdb.h" +#include "sdb/sdb.h" #if __SDB_WINDOWS__ diff --git a/shlr/sdb/src/fmt.c b/shlr/sdb/src/fmt.c index c6404b7e46..283e431f07 100644 --- a/shlr/sdb/src/fmt.c +++ b/shlr/sdb/src/fmt.c @@ -1,6 +1,6 @@ /* sdb - MIT - Copyright 2014-2022 - pancake */ -#include "sdb.h" +#include "sdb/sdb.h" // TODO: convert into a function // TODO: Add 'a' format for array of pointers null terminated?? diff --git a/shlr/sdb/src/sdbht.c b/shlr/sdb/src/ht.c similarity index 98% rename from shlr/sdb/src/sdbht.c rename to shlr/sdb/src/ht.c index 4f216cf422..323f825324 100644 --- a/shlr/sdb/src/sdbht.c +++ b/shlr/sdb/src/ht.c @@ -1,6 +1,6 @@ /* sdb - MIT - Copyright 2011-2022 - pancake */ -#include "sdbht.h" +#include "sdb/ht.h" void sdbkv_fini(SdbKv *kv) { free (kv->base.key); diff --git a/shlr/sdb/src/ht_pp.c b/shlr/sdb/src/ht_pp.c index a5da5ede65..03e034031e 100644 --- a/shlr/sdb/src/ht_pp.c +++ b/shlr/sdb/src/ht_pp.c @@ -1,7 +1,7 @@ /* sdb - MIT - Copyright 2018-2022 - ret2libc, pancake */ -#include "sdb.h" -#include "ht_pp.h" +#include "sdb/sdb.h" +#include "sdb/ht_pp.h" #include "ht.inc" static HtName_(Ht)* internal_ht_default_new(ut32 size, ut32 prime_idx, HT_(DupValue) valdup, HT_(KvFreeFunc) pair_free, HT_(CalcSizeV) calcsizeV) { diff --git a/shlr/sdb/src/ht_pu.c b/shlr/sdb/src/ht_pu.c index ffadecc5fd..13790de311 100644 --- a/shlr/sdb/src/ht_pu.c +++ b/shlr/sdb/src/ht_pu.c @@ -1,7 +1,7 @@ /* sdb - MIT - Copyright 2018-2022 - ret2libc, pancake */ -#include "sdb.h" -#include "ht_pu.h" +#include "sdb/sdb.h" +#include "sdb/ht_pu.h" #include "ht.inc" static void free_kv_key(HT_(Kv) *kv) { diff --git a/shlr/sdb/src/ht_up.c b/shlr/sdb/src/ht_up.c index 9f167e8136..2e758a4681 100644 --- a/shlr/sdb/src/ht_up.c +++ b/shlr/sdb/src/ht_up.c @@ -1,7 +1,7 @@ /* sdb - MIT - Copyright 2018-2022 - ret2libc, pancake */ -#include "sdb.h" -#include "ht_up.h" +#include "sdb/sdb.h" +#include "sdb/ht_up.h" #include "ht.inc" static HtName_(Ht)* internal_ht_default_new(ut32 size, ut32 prime_idx, HT_(DupValue) valdup, HT_(KvFreeFunc) pair_free, HT_(CalcSizeV) calcsizeV) { diff --git a/shlr/sdb/src/ht_uu.c b/shlr/sdb/src/ht_uu.c index c2df1271aa..28e7d93683 100644 --- a/shlr/sdb/src/ht_uu.c +++ b/shlr/sdb/src/ht_uu.c @@ -1,7 +1,7 @@ /* sdb - MIT - Copyright 2018-2022 - ret2libc, pancake */ -#include "sdb.h" -#include "ht_uu.h" +#include "sdb/sdb.h" +#include "sdb/ht_uu.h" #include "ht.inc" // creates a default HtUU that has strings as keys diff --git a/shlr/sdb/src/journal.c b/shlr/sdb/src/journal.c index fd5d9d206e..90ae642567 100644 --- a/shlr/sdb/src/journal.c +++ b/shlr/sdb/src/journal.c @@ -1,6 +1,6 @@ /* sdb - MIT - Copyright 2011-2016 - pancake */ -#include "sdb.h" +#include "sdb/sdb.h" #include #if __UNIX__ || __MINGW32__ #include diff --git a/shlr/sdb/src/json.c b/shlr/sdb/src/json.c index ec5c6a17d0..e6d83b862b 100644 --- a/shlr/sdb/src/json.c +++ b/shlr/sdb/src/json.c @@ -1,7 +1,8 @@ /* sdb - MIT - Copyright 2012-2022 - pancake */ #include -#include "sdb.h" +#include "sdb/sdb.h" + #include "json/rangstr.c" #include "json/js0n.c" #include "json/path.c" diff --git a/shlr/sdb/src/json/Makefile b/shlr/sdb/src/json/Makefile index 1c3034f5df..9f075f0008 100644 --- a/shlr/sdb/src/json/Makefile +++ b/shlr/sdb/src/json/Makefile @@ -8,6 +8,7 @@ CFLAGS+=-Wall -g BIN=a.out OBJ=rangstr.o path.o js0n.o api.o main.o OBJ+=../libsdb.a +CFLAGS+=-I../../include all: ${BIN} diff --git a/shlr/sdb/src/json/api.c b/shlr/sdb/src/json/api.c index e2a5c86658..192502dd00 100644 --- a/shlr/sdb/src/json/api.c +++ b/shlr/sdb/src/json/api.c @@ -4,7 +4,7 @@ #include #include #include -#include "rangstr.h" +#include "sdb/rangstr.h" /* public sdb api */ char *api_json_get (const char *s, const char *p) { diff --git a/shlr/sdb/src/json/js0n.c b/shlr/sdb/src/json/js0n.c index 541f7f5ca8..c92d32a8b6 100644 --- a/shlr/sdb/src/json/js0n.c +++ b/shlr/sdb/src/json/js0n.c @@ -3,7 +3,7 @@ // opportunity to further optimize would be having different jump tables for higher depths -#include "rangstr.h" +#include "sdb/rangstr.h" #define PUSH(i) if(depth == 1) prev = *out++ = ((cur+i) - js) #define CAP(i) if(depth == 1) prev = *out++ = ((cur+i) - (js + prev) + 1) diff --git a/shlr/sdb/src/json/main.c b/shlr/sdb/src/json/main.c index 3415986abb..60cb5b827f 100644 --- a/shlr/sdb/src/json/main.c +++ b/shlr/sdb/src/json/main.c @@ -2,9 +2,9 @@ #include #include -#include "rangstr.h" -#include "json.h" -#include "../sdb.h" +#include "sdb/rangstr.h" +#include "sdb/json.h" +#include "sdb/sdb.h" Rangstr json_find (const char *s, Rangstr *rs); int test_main () { diff --git a/shlr/sdb/src/json/path.c b/shlr/sdb/src/json/path.c index fc5bae1173..9b52a07829 100644 --- a/shlr/sdb/src/json/path.c +++ b/shlr/sdb/src/json/path.c @@ -3,8 +3,9 @@ #include #include #include -#include "rangstr.c" -#include "../types.h" +#include "sdb/rangstr.h" +#include "sdb/sdb.h" +#include "sdb/types.h" SDB_IPI void json_path_first(Rangstr *s) { char *p; diff --git a/shlr/sdb/src/json/rangstr.c b/shlr/sdb/src/json/rangstr.c index d828757bfe..c022553cbb 100644 --- a/shlr/sdb/src/json/rangstr.c +++ b/shlr/sdb/src/json/rangstr.c @@ -6,7 +6,7 @@ #include #include #include -#include "rangstr.h" +#include "sdb/rangstr.h" SDB_IPI Rangstr rangstr_null(void) { Rangstr rs = {0, 0, 0, 0, 0}; diff --git a/shlr/sdb/src/lock.c b/shlr/sdb/src/lock.c index 743754f55d..7158f2291a 100644 --- a/shlr/sdb/src/lock.c +++ b/shlr/sdb/src/lock.c @@ -1,7 +1,7 @@ /* sdb - MIT - Copyright 2012-2022 - pancake */ #include -#include "sdb.h" +#include "sdb/sdb.h" SDB_API bool sdb_lock_file(const char *f, char *buf, size_t buf_size) { size_t len; diff --git a/shlr/sdb/src/ls.c b/shlr/sdb/src/ls.c index e2521e3342..981a810c0d 100644 --- a/shlr/sdb/src/ls.c +++ b/shlr/sdb/src/ls.c @@ -1,7 +1,7 @@ /* sdb - MIT - Copyright 2007-2022 - pancake, alvaro */ #include -#include "ls.h" +#include "sdb/ls.h" #if 0 1 128= 7s / 32 diff --git a/shlr/sdb/src/main.c b/shlr/sdb/src/main.c index 4548e4e404..0124709746 100644 --- a/shlr/sdb/src/main.c +++ b/shlr/sdb/src/main.c @@ -8,7 +8,7 @@ #if USE_DLSYSTEM #include #endif -#include "sdb.h" +#include "sdb/sdb.h" typedef enum { text, @@ -548,7 +548,9 @@ static int insertkeys(Sdb *db, const char **args, int nargs, int mode) { for (i = 0; i < nargs; i++) { switch (mode) { case '-': - must_save |= sdb_query (db, args[i]); + if (sdb_query (db, args[i])) { + must_save = true; + } break; case '=': if (strchr (args[i], '=')) { @@ -1011,18 +1013,22 @@ int main(int argc, const char **argv) { int kvs = mo->db0 + 2; if (mo->argi + 2 < mo->argc) { for (i = mo->argi + 2; i < argc; i++) { - save |= sdb_query (s, mo->argv[i]); + if (sdb_query (s, mo->argv[i])) { + save = true; + } if (mo->format) { fflush (stdout); ret = write_null (); } } } else { - if (kvs < argc) { - save |= insertkeys (s, argv + mo->argi + 2, argc - kvs, '-'); + if (kvs < argc && insertkeys (s, argv + mo->argi + 2, argc - kvs, '-')) { + save = true; } for (; (line = slurp (stdin, NULL));) { - save |= sdb_query (s, line); + if (sdb_query (s, line)) { + save = true; + } if (mo->format) { fflush (stdout); ret = write_null (); @@ -1050,7 +1056,9 @@ int main(int argc, const char **argv) { sdb_config (s, options); if (mo->argi + 1 < mo->argc) { for (i = mo->db0 + 1; i < argc; i++) { - save |= sdb_query (s, mo->argv[i]); + if (sdb_query (s, mo->argv[i])) { + save = true; + } if (mo->format) { fflush (stdout); ret = write_null (); diff --git a/shlr/sdb/src/match.c b/shlr/sdb/src/match.c index 75a5080378..2355117233 100644 --- a/shlr/sdb/src/match.c +++ b/shlr/sdb/src/match.c @@ -1,6 +1,6 @@ /* sdb - MIT - Copyright 2015-2016 - pancake */ -#include "sdb.h" +#include "sdb/sdb.h" #include static inline int haveSuffix(const char *glob, int glob_len, const char *sfx) { diff --git a/shlr/sdb/src/ns.c b/shlr/sdb/src/ns.c index 44a14bd0f1..beb15f1953 100644 --- a/shlr/sdb/src/ns.c +++ b/shlr/sdb/src/ns.c @@ -1,6 +1,6 @@ /* sdb - MIT - Copyright 2011-2022 - pancake */ -#include "sdb.h" +#include "sdb/sdb.h" SDB_API void sdb_ns_lock(Sdb *s, int lock, int depth) { SdbListIter *it; diff --git a/shlr/sdb/src/num.c b/shlr/sdb/src/num.c index b18fd072ec..00f14c7b4a 100644 --- a/shlr/sdb/src/num.c +++ b/shlr/sdb/src/num.c @@ -1,7 +1,6 @@ -/* sdb - MIT - Copyright 2011-2016 - pancake */ +/* sdb - MIT - Copyright 2011-2022 - pancake */ -#include "sdb.h" -#include "types.h" +#include "sdb/sdb.h" // check if key exists and if it's a number.. rename? SDB_API bool sdb_num_exists (Sdb *s, const char *key) { diff --git a/shlr/sdb/src/query.c b/shlr/sdb/src/query.c index 9db9b432e5..f499e31d25 100644 --- a/shlr/sdb/src/query.c +++ b/shlr/sdb/src/query.c @@ -3,7 +3,7 @@ #include #include #include -#include "sdb.h" +#include "sdb/sdb.h" typedef struct { char *buf; diff --git a/shlr/sdb/src/sdb.c b/shlr/sdb/src/sdb.c index a73ba680b8..7ea703b85b 100644 --- a/shlr/sdb/src/sdb.c +++ b/shlr/sdb/src/sdb.c @@ -3,7 +3,7 @@ #include #include #include -#include "sdb.h" +#include "sdb/sdb.h" #if 0 static inline SdbKv *kv_at(HtPP *ht, HtPPBucket *bt, ut32 i) { diff --git a/shlr/sdb/src/set.c b/shlr/sdb/src/set.c index f57821194e..cdb4f08f4d 100644 --- a/shlr/sdb/src/set.c +++ b/shlr/sdb/src/set.c @@ -1,6 +1,6 @@ /* sdb - MIT - Copyright 2019-2020 - pancake */ -#include "set.h" +#include "sdb/set.h" //// set foreach spaguetti typedef struct { diff --git a/shlr/sdb/src/text.c b/shlr/sdb/src/text.c index c6f1d253a4..c473ccdd0b 100644 --- a/shlr/sdb/src/text.c +++ b/shlr/sdb/src/text.c @@ -1,6 +1,6 @@ /* sdb - MIT - Copyright 2020-2022 - pancake, thestr4ng3r */ -#include "sdb.h" +#include "sdb/sdb.h" #include #include diff --git a/shlr/sdb/src/util.c b/shlr/sdb/src/util.c index b159e40d3e..c2f822e1c8 100644 --- a/shlr/sdb/src/util.c +++ b/shlr/sdb/src/util.c @@ -1,6 +1,6 @@ /* sdb - MIT - Copyright 2011-2022 - pancake */ -#include "sdb.h" +#include "sdb/sdb.h" #define FORCE_COLLISION 0 diff --git a/shlr/sdb/wasi.mk b/shlr/sdb/wasi.mk index 1b97a23450..07343c88a1 100644 --- a/shlr/sdb/wasi.mk +++ b/shlr/sdb/wasi.mk @@ -1,6 +1,6 @@ -WASI_SDK=$(HOME)/Downloads/wasi/wasi-sdk-12.0 -WASI_SYSROOT=$(HOME)/Downloads/wasi/wasi-sysroot +WASI_SDK=$(HOME)/Downloads/wasi/wasi-sdk-16.0 +WASI_SYSROOT=$(HOME)/Downloads/wasi/wasi-sysroot-16.0 WASI_CC="$(WASI_SDK)/bin/clang --sysroot=$(WASI_SYSROOT) -D_WASI_EMULATED_MMAN -D_WASI_EMULATED_SIGNAL -DUSE_MMAN=0 -DHAVE_SYSTEM=0" $(WASK_SDK): diff --git a/shlr/sdb/wasi.sh b/shlr/sdb/wasi.sh index 6f3448234c..f5e346a7a5 100755 --- a/shlr/sdb/wasi.sh +++ b/shlr/sdb/wasi.sh @@ -1,7 +1,7 @@ #!/bin/sh -export WASI_SDK=${HOME}/Downloads/wasi/wasi-sdk-12.0 -export WASI_SYSROOT=${HOME}/Downloads/wasi/wasi-sysroot +export WASI_SDK=${HOME}/Downloads/wasi/wasi-sdk-16.0 +export WASI_SYSROOT=${HOME}/Downloads/wasi/wasi-sysroot-16.0 if [ ! -d "$WASI_SDK" ]; then #OS=linux,macos,mingw @@ -12,11 +12,12 @@ if [ ! -d "$WASI_SDK" ]; then windows|Windows) OS=mingw ; ;; esac mkdir -p ~/Downloads/wasi - wget -c -O ~/Downloads/wasi/wasi-sdk.tar.gz https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-$OS.tar.gz || exit 1 - wget -c -O ~/Downloads/wasi/wasi-root.tar.gz https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sysroot-12.0.tar.gz || exit 1 + wget -c -O ~/Downloads/wasi/wasi-sdk.tar.gz https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-16/wasi-sdk-16.0-$OS.tar.gz || exit 1 + wget -c -O ~/Downloads/wasi/wasi-root.tar.gz https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-16/wasi-sysroot-16.0.tar.gz || exit 1 ( cd ~/Downloads/wasi tar xzvf wasi-sdk.tar.gz tar xzvf wasi-root.tar.gz + mv wasi-sysroot wasi-sysroot-16.0 ) fi diff --git a/shlr/winkd/Makefile b/shlr/winkd/Makefile index e21a22a504..494f7cc4e8 100644 --- a/shlr/winkd/Makefile +++ b/shlr/winkd/Makefile @@ -3,7 +3,7 @@ include ../../config-user.mk include ../../mk/platform.mk include ../../mk/${COMPILER}.mk -CFLAGS:=-I../../libr/include -I../../libr/include/sdb $(CFLAGS) +CFLAGS:=-I../../libr/include $(CFLAGS) CFLAGS+=${PIC_CFLAGS} LIBAR=libr_winkd.${EXT_AR} diff --git a/sys/sdk.sh b/sys/sdk.sh index 34119309db..f586410119 100755 --- a/sys/sdk.sh +++ b/sys/sdk.sh @@ -26,7 +26,7 @@ mkdir -p "${SDKDIR}"/lib rm -f libr/libr.a cp -rf libr/include "${SDKDIR}" mkdir -p "${SDKDIR}/include/sdb" -cp -rf shlr/sdb/src/*.h "${SDKDIR}/include/sdb/" +cp -rf shlr/sdb/include/sdb/* "${SDKDIR}/include/sdb" FILES=`find libr shlr -iname '*.a'` cp -f ${FILES} "${SDKDIR}"/lib OS=`uname` diff --git a/test/Makefile b/test/Makefile index dccda69019..bf63cd82c3 100644 --- a/test/Makefile +++ b/test/Makefile @@ -52,6 +52,7 @@ yara: bins ${RUNTEST} db/extras/cmd/yara clean: + $(MAKE) -C unit clean rm -rf tmp rc: diff --git a/test/unit/Makefile b/test/unit/Makefile index fc6c3a0ffe..78cac5a095 100644 --- a/test/unit/Makefile +++ b/test/unit/Makefile @@ -2,7 +2,7 @@ BINDIR := bin BINS=$(patsubst %.c,$(BINDIR)/%,$(wildcard *.c)) LDFLAGS+=$(shell pkg-config --libs r_core) CFLAGS+=-I../../libr/include -CFLAGS+=-I../../shlr/sdb/src +CFLAGS+=-I../../shlr/sdb/include CFLAGS+=-g ifeq ($(ASAN),1) ASAN_LD_PRELOAD=LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.5 @@ -24,6 +24,6 @@ run: $(BINS) clean: rm -f $(BINS) - rm -fd "$(BINDIR)" + -rm -fd "$(BINDIR)" .PHONY: all diff --git a/vsfix.bat b/vsfix.bat index eb9501a9b6..5251b2f7b2 100644 --- a/vsfix.bat +++ b/vsfix.bat @@ -2,4 +2,4 @@ @for /r %%d in (*.dll) do @copy /Y "%%d" ..\binr\radare2 > NUL @cd ..\binr @for /r %%d in (*.exe) do @copy /Y "%%d" ..\binr\radare2 > NUL -@cd ..\.. \ No newline at end of file +@cd ..\..