diff options
author | David Robillard <d@drobilla.net> | 2022-05-30 16:07:25 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-05-30 16:07:25 -0400 |
commit | 12cade49c05d5ae4c388284a03a5e4fb86f2cd7c (patch) | |
tree | 627203206c857dd843c89e17c32309fdfd43841e /src | |
parent | 04c7d3ca92881d66d8c74ec73f5fd917d73f5b23 (diff) | |
download | jalv-12cade49c05d5ae4c388284a03a5e4fb86f2cd7c.tar.gz jalv-12cade49c05d5ae4c388284a03a5e4fb86f2cd7c.tar.bz2 jalv-12cade49c05d5ae4c388284a03a5e4fb86f2cd7c.zip |
Move implementations out of shared header
Generally cleaner, and conveniently avoids clang-tidy warnings that result from
checking this code as C++.
Diffstat (limited to 'src')
-rw-r--r-- | src/jalv_internal.h | 37 | ||||
-rw-r--r-- | src/log.c | 32 |
2 files changed, 40 insertions, 29 deletions
diff --git a/src/jalv_internal.h b/src/jalv_internal.h index bf8c56c..0800405 100644 --- a/src/jalv_internal.h +++ b/src/jalv_internal.h @@ -491,35 +491,14 @@ atom_to_turtle(LV2_URID_Unmap* unmap, const SerdNode* predicate, const LV2_Atom* atom); -static inline void -jalv_print_control(Jalv* jalv, const struct Port* port, float value) -{ - const LilvNode* sym = lilv_port_get_symbol(jalv->plugin, port->lilv_port); - printf("%s = %f\n", lilv_node_as_string(sym), value); -} - -static inline char* -jalv_strdup(const char* str) -{ - const size_t len = strlen(str); - char* copy = (char*)malloc(len + 1); - memcpy(copy, str, len + 1); - return copy; -} - -static inline char* -jalv_strjoin(const char* a, const char* b) -{ - const size_t a_len = strlen(a); - const size_t b_len = strlen(b); - char* const out = (char*)malloc(a_len + b_len + 1); - - memcpy(out, a, a_len); - memcpy(out + a_len, b, b_len); - out[a_len + b_len] = '\0'; - - return out; -} +void +jalv_print_control(Jalv* jalv, const struct Port* port, float value); + +char* +jalv_strdup(const char* str); + +char* +jalv_strjoin(const char* a, const char* b); JALV_LOG_FUNC(3, 4) int @@ -30,6 +30,38 @@ #include <stdbool.h> #include <stdio.h> +void +jalv_print_control(Jalv* const jalv, + const struct Port* const port, + const float value) +{ + const LilvNode* sym = lilv_port_get_symbol(jalv->plugin, port->lilv_port); + printf("%s = %f\n", lilv_node_as_string(sym), value); +} + +char* +jalv_strdup(const char* const str) +{ + const size_t len = strlen(str); + char* copy = (char*)malloc(len + 1); + memcpy(copy, str, len + 1); + return copy; +} + +char* +jalv_strjoin(const char* const a, const char* const b) +{ + const size_t a_len = strlen(a); + const size_t b_len = strlen(b); + char* const out = (char*)malloc(a_len + b_len + 1); + + memcpy(out, a, a_len); + memcpy(out + a_len, b, b_len); + out[a_len + b_len] = '\0'; + + return out; +} + int jalv_printf(LV2_Log_Handle handle, LV2_URID type, const char* fmt, ...) { |