aboutsummaryrefslogtreecommitdiffhomepage
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/backend.c26
-rw-r--r--core/config.c66
-rw-r--r--core/core.c12
-rw-r--r--core/plugin.c28
-rw-r--r--core/routing.c8
5 files changed, 71 insertions, 69 deletions
diff --git a/core/backend.c b/core/backend.c
index 263fda3..b7c2d9e 100644
--- a/core/backend.c
+++ b/core/backend.c
@@ -55,7 +55,7 @@ int backends_handle(size_t nfds, managed_fd* fds){
DBGPF("Notifying backend %s of %" PRIsize_t " waiting FDs", registry.backends[u].name, n);
rv |= registry.backends[u].process(n, fds);
if(rv){
- fprintf(stderr, "Backend %s failed to handle input\n", registry.backends[u].name);
+ LOGPF("Backend %s failed to handle input", registry.backends[u].name);
}
}
}
@@ -100,7 +100,7 @@ MM_API channel* mm_channel(instance* inst, uint64_t ident, uint8_t create){
DBGPF("\tBucket %" PRIsize_t " entry %" PRIsize_t " inst %" PRIu64 " ident %" PRIu64, bucket, u, (uint64_t) channels.entry[bucket][u]->instance, channels.entry[bucket][u]->ident);
if(channels.entry[bucket][u]->instance == inst
&& channels.entry[bucket][u]->ident == ident){
- DBGPF("Requested channel %" PRIu64 " on instance %s already exists, reusing (bucket %" PRIsize_t ", %" PRIsize_t " search steps)\n", ident, inst->name, bucket, u);
+ DBGPF("Requested channel %" PRIu64 " on instance %s already exists, reusing (bucket %" PRIsize_t ", %" PRIsize_t " search steps)", ident, inst->name, bucket, u);
return channels.entry[bucket][u];
}
}
@@ -113,14 +113,14 @@ MM_API channel* mm_channel(instance* inst, uint64_t ident, uint8_t create){
DBGPF("Creating previously unknown channel %" PRIu64 " on instance %s, bucket %" PRIsize_t, ident, inst->name, bucket);
channels.entry[bucket] = realloc(channels.entry[bucket], (channels.n[bucket] + 1) * sizeof(channel*));
if(!channels.entry[bucket]){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
channels.n[bucket] = 0;
return NULL;
}
channels.entry[bucket][channels.n[bucket]] = calloc(1, sizeof(channel));
if(!channels.entry[bucket][channels.n[bucket]]){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
return NULL;
}
@@ -161,7 +161,7 @@ MM_API void mm_channel_update(channel* chan, uint64_t ident){
//add to new bucket
channels.entry[new_bucket] = realloc(channels.entry[new_bucket], (channels.n[new_bucket] + 1) * sizeof(channel*));
if(!channels.entry[new_bucket]){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
channels.n[new_bucket] = 0;
return;
}
@@ -184,14 +184,14 @@ instance* mm_instance(backend* b){
//extend
registry.instances[u] = realloc(registry.instances[u], (n + 2) * sizeof(instance*));
if(!registry.instances[u]){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
return NULL;
}
//sentinel
registry.instances[u][n + 1] = NULL;
registry.instances[u][n] = calloc(1, sizeof(instance));
if(!registry.instances[u][n]){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
}
registry.instances[u][n]->backend = b;
return registry.instances[u][n];
@@ -238,7 +238,7 @@ MM_API int mm_backend_instances(char* name, size_t* ninst, instance*** inst){
*inst = calloc(i, sizeof(instance*));
if(!*inst){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
return 1;
}
@@ -304,7 +304,7 @@ MM_API int mm_backend_register(backend b){
registry.backends = realloc(registry.backends, (registry.n + 1) * sizeof(backend));
registry.instances = realloc(registry.instances, (registry.n + 1) * sizeof(instance**));
if(!registry.backends || !registry.instances){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
registry.n = 0;
return 1;
}
@@ -312,7 +312,7 @@ MM_API int mm_backend_register(backend b){
registry.instances[registry.n] = NULL;
registry.n++;
- fprintf(stderr, "Registered backend %s\n", b.name);
+ LOGPF("Registered backend %s", b.name);
return 0;
}
return 1;
@@ -331,14 +331,14 @@ int backends_start(){
//fetch list of instances
if(mm_backend_instances(registry.backends[u].name, &n, &inst)){
- fprintf(stderr, "Failed to fetch instance list for initialization of backend %s\n", registry.backends[u].name);
+ LOGPF("Failed to fetch instance list for initialization of backend %s", registry.backends[u].name);
return 1;
}
//start the backend
current = registry.backends[u].start(n, inst);
if(current){
- fprintf(stderr, "Failed to start backend %s\n", registry.backends[u].name);
+ LOGPF("Failed to start backend %s", registry.backends[u].name);
}
//clean up
@@ -378,7 +378,7 @@ int backends_stop(){
for(u = 0; u < registry.n; u++){
//fetch list of instances
if(mm_backend_instances(registry.backends[u].name, &n, &inst)){
- fprintf(stderr, "Failed to fetch instance list for shutdown of backend %s\n", registry.backends[u].name);
+ LOGPF("Failed to fetch instance list for shutdown of backend %s", registry.backends[u].name);
inst = NULL;
n = 0;
}
diff --git a/core/config.c b/core/config.c
index c1c3124..705f690 100644
--- a/core/config.c
+++ b/core/config.c
@@ -45,7 +45,7 @@ static ssize_t getline(char** line, size_t* alloc, FILE* stream){
*alloc = GETLINE_BUFFER;
*line = calloc(GETLINE_BUFFER, sizeof(char));
if(!*line){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
return -1;
}
}
@@ -60,7 +60,7 @@ static ssize_t getline(char** line, size_t* alloc, FILE* stream){
*alloc += GETLINE_BUFFER;
*line = realloc(*line, (*alloc) * sizeof(char));
if(!*line){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
return -1;
}
}
@@ -175,13 +175,13 @@ static int config_glob_scan(instance* inst, channel_spec* spec){
for(glob_start = strchr(glob_start, '{'); glob_start; glob_start = strchr(glob_start, '{')){
glob_end = strchr(glob_start, '}');
if(!glob_end){
- fprintf(stderr, "Failed to parse channel spec, unterminated glob: %s\n", spec->spec);
+ LOGPF("Failed to parse channel spec, unterminated glob: %s", spec->spec);
return 1;
}
spec->glob = realloc(spec->glob, (spec->globs + 1) * sizeof(channel_glob));
if(!spec->glob){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
return 1;
}
@@ -205,7 +205,7 @@ static int config_glob_scan(instance* inst, channel_spec* spec){
}
if(!spec->internal){
//TODO try to parse globs externally
- fprintf(stderr, "Failed to parse glob %" PRIsize_t " in %s internally\n", u + 1, spec->spec);
+ LOGPF("Failed to parse glob %" PRIsize_t " in %s internally", u + 1, spec->spec);
return 1;
}
@@ -322,7 +322,7 @@ static int config_map(char* to_raw, char* from_raw){
if(!from || !to){
free(from);
free(to);
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
return 1;
}
@@ -334,7 +334,7 @@ static int config_map(char* to_raw, char* from_raw){
}
if(!spec_from.spec[0] || !spec_to.spec[0]){
- fprintf(stderr, "Mapping does not contain a proper instance specification\n");
+ LOG("Mapping does not contain a proper instance specification");
goto done;
}
@@ -348,7 +348,7 @@ static int config_map(char* to_raw, char* from_raw){
instance_from = instance_match(from);
if(!instance_to || !instance_from){
- fprintf(stderr, "No such instance %s\n", instance_from ? to : from);
+ LOGPF("No such instance %s", instance_from ? to : from);
goto done;
}
@@ -361,7 +361,7 @@ static int config_map(char* to_raw, char* from_raw){
if((spec_to.channels != spec_from.channels && spec_from.channels != 1 && spec_to.channels != 1)
|| spec_to.channels == 0
|| spec_from.channels == 0){
- fprintf(stderr, "Multi-channel specification size mismatch: %s.%s (%" PRIsize_t " channels) - %s.%s (%" PRIsize_t " channels)\n",
+ LOGPF("Multi-channel specification size mismatch: %s.%s (%" PRIsize_t " channels) - %s.%s (%" PRIsize_t " channels)",
instance_from->name,
spec_from.spec,
spec_from.channels,
@@ -410,7 +410,7 @@ static int config_line(char* line){
current_backend = backend_match(line + 9);
if(!current_backend){
- fprintf(stderr, "Cannot configure unknown backend %s\n", line + 9);
+ LOGPF("Cannot configure unknown backend %s", line + 9);
return 1;
}
@@ -419,7 +419,7 @@ static int config_line(char* line){
if(!overrides[u].handled && overrides[u].type == override_backend
&& !strcmp(overrides[u].target, current_backend->name)){
if(current_backend->conf(overrides[u].option, overrides[u].value)){
- fprintf(stderr, "Configuration override for %s failed for backend %s\n",
+ LOGPF("Configuration override for %s failed for backend %s",
overrides[u].option, current_backend->name);
return 1;
}
@@ -447,7 +447,7 @@ static int config_line(char* line){
for(separator = line; *separator && *separator != ' '; separator++){
}
if(!*separator){
- fprintf(stderr, "No instance name specified for backend %s\n", line);
+ LOGPF("No instance name specified for backend %s", line);
return 1;
}
*separator = 0;
@@ -455,18 +455,18 @@ static int config_line(char* line){
current_backend = backend_match(line);
if(!current_backend){
- fprintf(stderr, "No such backend %s\n", line);
+ LOGPF("No such backend %s", line);
return 1;
}
if(instance_match(separator)){
- fprintf(stderr, "Duplicate instance name %s\n", separator);
+ LOGPF("Duplicate instance name %s", separator);
return 1;
}
//validate instance name
if(strchr(separator, ' ') || strchr(separator, '.')){
- fprintf(stderr, "Invalid instance name %s\n", separator);
+ LOGPF("Invalid instance name %s", separator);
return 1;
}
@@ -476,20 +476,20 @@ static int config_line(char* line){
}
if(current_backend->create(current_instance)){
- fprintf(stderr, "Failed to create %s instance %s\n", line, separator);
+ LOGPF("Failed to create %s instance %s", line, separator);
return 1;
}
current_instance->name = strdup(separator);
current_instance->backend = current_backend;
- fprintf(stderr, "Created %s instance %s\n", line, separator);
+ LOGPF("Created %s instance %s", line, separator);
//apply overrides
for(u = 0; u < noverrides; u++){
if(!overrides[u].handled && overrides[u].type == override_instance
&& !strcmp(overrides[u].target, current_instance->name)){
if(current_backend->conf_instance(current_instance, overrides[u].option, overrides[u].value)){
- fprintf(stderr, "Configuration override for %s failed for instance %s\n",
+ LOGPF("Configuration override for %s failed for instance %s",
overrides[u].option, current_instance->name);
return 1;
}
@@ -514,7 +514,7 @@ static int config_line(char* line){
break;
case 0:
default:
- fprintf(stderr, "Not a channel mapping: %s\n", line);
+ LOGPF("Not a channel mapping: %s", line);
return 1;
}
@@ -529,13 +529,13 @@ static int config_line(char* line){
if(mapping_type == map_ltr || mapping_type == map_bidir){
if(config_map(separator, line)){
- fprintf(stderr, "Failed to map channel %s to %s\n", line, separator);
+ LOGPF("Failed to map channel %s to %s", line, separator);
return 1;
}
}
if(mapping_type == map_rtl || mapping_type == map_bidir){
if(config_map(line, separator)){
- fprintf(stderr, "Failed to map channel %s to %s\n", separator, line);
+ LOGPF("Failed to map channel %s to %s", separator, line);
return 1;
}
}
@@ -545,7 +545,7 @@ static int config_line(char* line){
//find separator
separator = strchr(line, '=');
if(!separator){
- fprintf(stderr, "Not an assignment (currently expecting %s configuration): %s\n", line, (parser_state == backend_cfg) ? "backend" : "instance");
+ LOGPF("Not an assignment (currently expecting %s configuration): %s", line, (parser_state == backend_cfg) ? "backend" : "instance");
return 1;
}
@@ -555,11 +555,11 @@ static int config_line(char* line){
separator = config_trim_line(separator);
if(parser_state == backend_cfg && current_backend->conf(line, separator)){
- fprintf(stderr, "Failed to configure backend %s\n", current_backend->name);
+ LOGPF("Failed to configure backend %s", current_backend->name);
return 1;
}
else if(parser_state == instance_cfg && current_backend->conf_instance(current_instance, line, separator)){
- fprintf(stderr, "Failed to configure instance %s\n", current_instance->name);
+ LOGPF("Failed to configure instance %s", current_instance->name);
return 1;
}
}
@@ -583,7 +583,7 @@ int config_read(char* cfg_filepath){
#endif
if(!source_dir){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
return 1;
}
@@ -594,12 +594,12 @@ int config_read(char* cfg_filepath){
source_file++;
if(!getcwd(original_dir, sizeof(original_dir))){
- fprintf(stderr, "Failed to read current working directory: %s\n", strerror(errno));
+ LOGPF("Failed to read current working directory: %s", strerror(errno));
goto bail;
}
if(chdir(source_dir)){
- fprintf(stderr, "Failed to change to configuration file directory %s: %s\n", source_dir, strerror(errno));
+ LOGPF("Failed to change to configuration file directory %s: %s", source_dir, strerror(errno));
goto bail;
}
}
@@ -607,11 +607,11 @@ int config_read(char* cfg_filepath){
source_file = source_dir;
}
- fprintf(stderr, "Reading configuration file %s\n", cfg_filepath);
+ LOGPF("Reading configuration file %s", cfg_filepath);
source = fopen(source_file, "r");
if(!source){
- fprintf(stderr, "Failed to open %s for reading\n", cfg_filepath);
+ LOGPF("Failed to open %s for reading", cfg_filepath);
goto bail;
}
@@ -644,7 +644,7 @@ int config_add_override(override_type type, char* data_raw){
char* data = strdup(data_raw);
if(!data){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
goto bail;
}
@@ -652,7 +652,7 @@ int config_add_override(override_type type, char* data_raw){
char* value = strchr(data, '=');
if(!option || !value){
- fprintf(stderr, "Override %s is not a valid assignment\n", data_raw);
+ LOGPF("Override %s is not a valid assignment", data_raw);
goto bail;
}
@@ -672,14 +672,14 @@ int config_add_override(override_type type, char* data_raw){
};
if(!new.target || !new.option || !new.value){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
goto bail;
}
overrides = realloc(overrides, (noverrides + 1) * sizeof(config_override));
if(!overrides){
noverrides = 0;
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
goto bail;
}
overrides[noverrides] = new;
diff --git a/core/core.c b/core/core.c
index cd097f8..f9874f7 100644
--- a/core/core.c
+++ b/core/core.c
@@ -37,7 +37,7 @@ static void core_timestamp(){
#else
struct timespec current;
if(clock_gettime(CLOCK_MONOTONIC_COARSE, &current)){
- fprintf(stderr, "Failed to update global timestamp, time-based processing for some backends may be impaired: %s\n", strerror(errno));
+ LOGPF("Failed to update global timestamp, time-based processing for some backends may be impaired: %s", strerror(errno));
return;
}
@@ -72,7 +72,7 @@ MM_API int mm_manage_fd(int new_fd, char* back, int manage, void* impl){
size_t u;
if(!b){
- fprintf(stderr, "Unknown backend %s registered for managed fd\n", back);
+ LOGPF("Unknown backend %s registered for managed fd", back);
return 1;
}
@@ -104,13 +104,13 @@ MM_API int mm_manage_fd(int new_fd, char* back, int manage, void* impl){
if(u == fds){
fd = realloc(fd, (fds + 1) * sizeof(managed_fd));
if(!fd){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
return 1;
}
signaled_fds = realloc(signaled_fds, (fds + 1) * sizeof(managed_fd));
if(!signaled_fds){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
return 1;
}
fds++;
@@ -188,11 +188,11 @@ int core_iteration(){
error = select(max_fd + 1, &read_fds, NULL, NULL, &tv);
if(error < 0){
#ifndef _WIN32
- fprintf(stderr, "select failed: %s\n", strerror(errno));
+ LOGPF("select failed: %s", strerror(errno));
#else
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, WSAGetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &error_message, 0, NULL);
- fprintf(stderr, "select failed: %s\n", error_message);
+ LOGPF("select failed: %s", error_message);
LocalFree(error_message);
error_message = NULL;
#endif
diff --git a/core/plugin.c b/core/plugin.c
index e7d8eba..ec32760 100644
--- a/core/plugin.c
+++ b/core/plugin.c
@@ -15,6 +15,8 @@
#include <dlfcn.h>
#endif
+#define BACKEND_NAME "core/pl"
+#include "midimonster.h"
#include "plugin.h"
static size_t plugins = 0;
@@ -31,13 +33,13 @@ static int plugin_attach(char* path, char* file){
#endif
if(!path || !file || !strlen(path)){
- fprintf(stderr, "Invalid plugin loader path\n");
+ LOG("Invalid plugin loader path");
return 1;
}
lib = calloc(strlen(path) + strlen(file) + 2, sizeof(char));
if(!lib){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
return 1;
}
snprintf(lib, strlen(path) + strlen(file) + 2, "%s%s%s",
@@ -51,10 +53,10 @@ static int plugin_attach(char* path, char* file){
char* error = NULL;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &error, 0, NULL);
- fprintf(stderr, "Failed to load plugin %s, check that all supporting libraries are present: %s\n", lib, error);
+ LOGPF("Failed to load plugin %s, check that all supporting libraries are present: %s", lib, error);
LocalFree(error);
#else
- fprintf(stderr, "Failed to load plugin %s: %s\n", lib, dlerror());
+ LOGPF("Failed to load plugin %s: %s", lib, dlerror());
#endif
free(lib);
return 0;
@@ -63,7 +65,7 @@ static int plugin_attach(char* path, char* file){
init = (plugin_init) dlsym(handle, "init");
if(init){
if(init()){
- fprintf(stderr, "Plugin %s failed to initialize\n", lib);
+ LOGPF("Plugin %s failed to initialize", lib);
dlclose(handle);
free(lib);
return 1;
@@ -78,7 +80,7 @@ static int plugin_attach(char* path, char* file){
plugin_handle = realloc(plugin_handle, (plugins + 1) * sizeof(void*));
if(!plugin_handle){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
dlclose(handle);
return 1;
}
@@ -95,7 +97,7 @@ int plugins_load(char* path){
#ifdef _WIN32
char* search_expression = calloc(strlen(path) + strlen("*.dll") + 1, sizeof(char));
if(!search_expression){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
return -1;
}
snprintf(search_expression, strlen(path) + strlen("*.dll"), "%s*.dll", path);
@@ -107,7 +109,7 @@ int plugins_load(char* path){
LPVOID lpMsgBuf = NULL;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL);
- fprintf(stderr, "Failed to search for backend plugin files in %s: %s\n", path, lpMsgBuf);
+ LOGPF("Failed to search for backend plugin files in %s: %s", path, lpMsgBuf);
LocalFree(lpMsgBuf);
return -1;
}
@@ -128,7 +130,7 @@ load_done:
struct stat file_stat;
DIR* directory = opendir(path);
if(!directory){
- fprintf(stderr, "Failed to open plugin search path %s: %s\n", path, strerror(errno));
+ LOGPF("Failed to open plugin search path %s: %s", path, strerror(errno));
return 1;
}
@@ -138,7 +140,7 @@ load_done:
}
if(fstatat(dirfd(directory), entry->d_name, &file_stat, 0) < 0){
- fprintf(stderr, "Failed to stat %s: %s\n", entry->d_name, strerror(errno));
+ LOGPF("Failed to stat %s: %s", entry->d_name, strerror(errno));
continue;
}
@@ -154,7 +156,7 @@ load_done:
load_done:
if(closedir(directory) < 0){
- fprintf(stderr, "Failed to close plugin directory %s: %s\n", path, strerror(errno));
+ LOGPF("Failed to close plugin directory %s: %s", path, strerror(errno));
return -1;
}
return rv;
@@ -171,12 +173,12 @@ int plugins_close(){
if(!FreeLibrary(plugin_handle[u])){
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &error, 0, NULL);
- fprintf(stderr, "Failed to unload plugin: %s\n", error);
+ LOGPF("Failed to unload plugin: %s", error);
LocalFree(error);
}
#else
if(dlclose(plugin_handle[u])){
- fprintf(stderr, "Failed to unload plugin: %s\n", dlerror());
+ LOGPF("Failed to unload plugin: %s", dlerror());
}
#endif
}
diff --git a/core/routing.c b/core/routing.c
index af93d0f..284569a 100644
--- a/core/routing.c
+++ b/core/routing.c
@@ -62,7 +62,7 @@ int mm_map_channel(channel* from, channel* to){
routing.map[bucket] = realloc(routing.map[bucket], (routing.entries[bucket] + 1) * sizeof(channel_mapping));
if(!routing.map[bucket]){
routing.entries[bucket] = 0;
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
return 1;
}
@@ -81,7 +81,7 @@ int mm_map_channel(channel* from, channel* to){
//add a mapping target
routing.map[bucket][u].to = realloc(routing.map[bucket][u].to, (routing.map[bucket][u].destinations + 1) * sizeof(channel*));
if(!routing.map[bucket][u].to){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
routing.map[bucket][u].destinations = 0;
return 1;
}
@@ -112,7 +112,7 @@ MM_API int mm_channel_event(channel* c, channel_value v){
routing.events->value = realloc(routing.events->value, (routing.events->alloc + routing.map[bucket][u].destinations) * sizeof(channel_value));
if(!routing.events->channel || !routing.events->value){
- fprintf(stderr, "Failed to allocate memory\n");
+ LOG("Failed to allocate memory");
routing.events->alloc = 0;
routing.events->n = 0;
return 1;
@@ -163,7 +163,7 @@ int routing_iteration(){
//push collected events to target backends
if(secondary->n && backends_notify(secondary->n, secondary->channel, secondary->value)){
- fprintf(stderr, "Backends failed to handle output\n");
+ LOG("Backends failed to handle output");
return 1;
}