rename log macros

pull/1/head
Nedko Arnaudov 14 years ago
parent d38f42ffef
commit 5f832c8668

@ -40,7 +40,7 @@ char * catdup(const char * s1, const char * s2)
buffer = malloc(s1_len + s2_len + 1);
if (buffer == NULL)
{
lash_error("malloc() failed.");
log_error("malloc() failed.");
return NULL;
}
@ -65,7 +65,7 @@ char * catdup3(const char * s1, const char * s2, const char * s3)
buffer = malloc(s1_len + s2_len + s3_len + 1);
if (buffer == NULL)
{
lash_error("malloc() failed.");
log_error("malloc() failed.");
return NULL;
}

@ -59,7 +59,7 @@ lash_strset(char **property,
}
}
#ifndef LASH_DEBUG
#ifndef LADISH_DEBUG
void *
lash_malloc(size_t nmemb,
@ -72,13 +72,13 @@ lash_malloc(size_t nmemb,
if ((ptr = malloc(nmemb * size))) {
return ptr;
} else {
lash_error("malloc returned NULL");
log_error("malloc returned NULL");
}
} else {
lash_error("Arguments would overflow");
log_error("Arguments would overflow");
}
} else {
lash_error("Can't allocate zero bytes");
log_error("Can't allocate zero bytes");
}
abort();
@ -95,13 +95,13 @@ lash_calloc(size_t nmemb,
if ((ptr = calloc(nmemb, size))) {
return ptr;
} else {
lash_error("calloc returned NULL");
log_error("calloc returned NULL");
}
} else {
lash_error("Arguments would overflow");
log_error("Arguments would overflow");
}
} else {
lash_error("Can't allocate zero bytes");
log_error("Can't allocate zero bytes");
}
abort();
@ -119,13 +119,13 @@ lash_realloc(void *ptr,
if ((ptr2 = realloc(ptr, nmemb * size))) {
return ptr2;
} else {
lash_error("realloc returned NULL");
log_error("realloc returned NULL");
}
} else {
lash_error("Arguments would overflow");
log_error("Arguments would overflow");
}
} else {
lash_error("Can't allocate zero bytes");
log_error("Can't allocate zero bytes");
}
abort();
@ -139,12 +139,12 @@ lash_strdup(const char *s)
if (ptr)
return ptr;
lash_error("strdup returned NULL");
log_error("strdup returned NULL");
abort();
}
#else /* LASH_DEBUG */
#else /* LADISH_DEBUG */
void *
lash_malloc_dbg(size_t nmemb,
@ -162,20 +162,20 @@ lash_malloc_dbg(size_t nmemb,
if ((ptr = malloc(nmemb * size))) {
return ptr;
} else {
lash_error_plain("%s:%d:%s: "
log_error_plain("%s:%d:%s: "
"lash_malloc(%s,%s) failed: "
"malloc returned NULL",
file, line, function,
arg1, arg2);
}
} else {
lash_error_plain("%s:%d:%s: "
log_error_plain("%s:%d:%s: "
"lash_malloc(%s,%s) failed: "
"Arguments would overflow",
file, line, function, arg1, arg2);
}
} else {
lash_error_plain("%s:%d:%s: "
log_error_plain("%s:%d:%s: "
"lash_malloc(%s,%s) failed: "
"Can't allocate zero bytes",
file, line, function, arg1, arg2);
@ -200,20 +200,20 @@ lash_calloc_dbg(size_t nmemb,
if ((ptr = calloc(nmemb, size))) {
return ptr;
} else {
lash_error_plain("%s:%d:%s: "
log_error_plain("%s:%d:%s: "
"lash_calloc(%s,%s) failed: "
"calloc returned NULL",
file, line, function,
arg1, arg2);
}
} else {
lash_error_plain("%s:%d:%s: "
log_error_plain("%s:%d:%s: "
"lash_calloc(%s,%s) failed: "
"Arguments would overflow",
file, line, function, arg1, arg2);
}
} else {
lash_error_plain("%s:%d:%s: "
log_error_plain("%s:%d:%s: "
"lash_calloc(%s,%s) failed: "
"Can't allocate zero bytes",
file, line, function, arg1, arg2);
@ -240,20 +240,20 @@ lash_realloc_dbg(void *ptr,
if ((ptr2 = realloc(ptr, nmemb * size))) {
return ptr2;
} else {
lash_error_plain("%s:%d:%s: "
log_error_plain("%s:%d:%s: "
"lash_realloc(%s,%s,%s) failed: "
"calloc returned NULL",
file, line, function,
arg1, arg2, arg3);
}
} else {
lash_error_plain("%s:%d:%s: "
log_error_plain("%s:%d:%s: "
"lash_realloc(%s,%s,%s) failed: "
"Arguments would overflow",
file, line, function, arg1, arg2, arg3);
}
} else {
lash_error_plain("%s:%d:%s: "
log_error_plain("%s:%d:%s: "
"lash_realloc(%s,%s,%s) failed: "
"Can't allocate zero bytes",
file, line, function, arg1, arg2, arg3);
@ -274,7 +274,7 @@ lash_strdup_dbg(const char *s,
if (s) {
ptr = strdup(s);
} else {
lash_error_plain("%s:%d:%s: lash_strdup(%s) failed: "
log_error_plain("%s:%d:%s: lash_strdup(%s) failed: "
"Argument is NULL",
file, line, function, arg1);
ptr = strdup("");
@ -283,13 +283,13 @@ lash_strdup_dbg(const char *s,
if (ptr)
return ptr;
lash_error_plain("%s:%d:%s: lash_strdup(%s) failed: "
log_error_plain("%s:%d:%s: lash_strdup(%s) failed: "
"strdup returned NULL",
file, line, function, arg1);
abort();
}
#endif /* LASH_DEBUG */
#endif /* LADISH_DEBUG */
/* EOF */

@ -29,7 +29,7 @@
* for reliable error handling and increased debugging verbosity.
*
* Some of the provided methods can be either macros or function definitions
* depending on whether or not LASH_DEBUG is enabled. The programmer needn't
* depending on whether or not LADISH_DEBUG is enabled. The programmer needn't
* worry, however, as the syntax is the same for both debug and normal builds.
*/
@ -70,12 +70,12 @@ void
lash_strset(char **property,
const char *value);
#ifndef LASH_DEBUG
#ifndef LADISH_DEBUG
/**
* This is a wrapper around malloc which checks whether nmemb * size
* would overflow, and whether malloc returns NULL. It prints an error
* using \ref lash_error if anything fails.
* using \ref log_error if anything fails.
*
* TODO: We currently call abort on failure,
* this probably needs to be changed.
@ -92,7 +92,7 @@ lash_malloc(size_t nmemb,
/**
* This is a wrapper around calloc which checks whether nmemb * size
* would overflow, and whether calloc) returns NULL. It prints an error
* using \ref lash_error if anything fails.
* using \ref log_error if anything fails.
*
* TODO: We currently call abort on failure,
* this probably needs to be changed.
@ -109,7 +109,7 @@ lash_calloc(size_t nmemb,
/**
* This is a wrapper around realloc which checks whether nmemb * size
* would overflow, and whether realloc returns NULL. It prints an error
* using \ref lash_error if anything fails.
* using \ref log_error if anything fails.
*
* TODO: We currently call abort on failure,
* this probably needs to be changed.
@ -127,7 +127,7 @@ lash_realloc(void *ptr,
/**
* This is a wrapper around strdup which checks for a NULL return value.
* It prints an error using \ref lash_error if strdup fails.
* It prints an error using \ref log_error if strdup fails.
*
* TODO: We currently call abort on failure,
* this probably needs to be changed.
@ -140,7 +140,7 @@ char *
lash_strdup(const char *s);
/** TODO: Document this */
#else /* LASH_DEBUG */
#else /* LADISH_DEBUG */
/**
* This macro is a wrapper around \ref lash_malloc_dbg.
@ -189,7 +189,7 @@ lash_strdup(const char *s);
/**
* This is a wrapper around malloc which checks whether nmemb * size
* would overflow, and whether malloc returns NULL. It prints an error
* using \ref lash_error if anything fails.
* using \ref log_error if anything fails.
*
* This function is the 'debugging edition' of the LASH malloc wrapper and
* has extra parameters for printing more detailed debugging messages. It
@ -221,7 +221,7 @@ lash_malloc_dbg(size_t nmemb,
/**
* This is a wrapper around calloc which checks whether nmemb * size
* would overflow, and whether calloc returns NULL. It prints an error
* using \ref lash_error if anything fails.
* using \ref log_error if anything fails.
*
* This function is the 'debugging edition' of the LASH calloc wrapper and
* has extra parameters for printing more detailed debugging messages. It
@ -253,7 +253,7 @@ lash_calloc_dbg(size_t nmemb,
/**
* This is a wrapper around realloc which checks whether nmemb * size
* would overflow, and whether realloc returns NULL. It prints an error
* using \ref lash_error if anything fails.
* using \ref log_error if anything fails.
*
* This function is the 'debugging edition' of the LASH realloc wrapper and
* has extra parameters for printing more detailed debugging messages. It
@ -287,7 +287,7 @@ lash_realloc_dbg(void *ptr,
/**
* This is a wrapper around strdup which checks for a NULL return value.
* It prints an error using \ref lash_error if strdup fails.
* It prints an error using \ref log_error if strdup fails.
*
* This function is the 'debugging edition' of the LASH strdup wrapper and
* has extra parameters for printing more detailed debugging messages. It
@ -312,6 +312,6 @@ lash_strdup_dbg(const char *s,
const char *function,
const char *arg1);
#endif /* LASH_DEBUG */
#endif /* LADISH_DEBUG */
#endif /* __LASH_SAFETY_H__ */

@ -160,40 +160,40 @@ load_file_data(
file = fopen(file_path, "r");
if (file == NULL)
{
lash_error("Failed to open '%s' for reading", file_path);
log_error("Failed to open '%s' for reading", file_path);
goto exit;
}
if (fseek(file, 0, SEEK_END) == -1)
{
lash_error("fseek('%s') failed", file_path);
log_error("fseek('%s') failed", file_path);
goto exit_close;
}
size = ftell(file);
if (size == -1)
{
lash_error("ftell('%s') failed", file_path);
log_error("ftell('%s') failed", file_path);
goto exit_close;
}
data_ptr = malloc(size + 1);
if (data_ptr == NULL)
{
lash_error("Failed to allocate %ld bytes for data of file '%s'", size + 1, file_path);
log_error("Failed to allocate %ld bytes for data of file '%s'", size + 1, file_path);
ret = false;
goto exit_close;
}
if (fseek(file, 0, SEEK_SET) == -1)
{
lash_error("fseek('%s') failed", file_path);
log_error("fseek('%s') failed", file_path);
goto exit_close;
}
if (fread(data_ptr, size, 1, file) != 1)
{
lash_error("Failed to read %ld bytes of data from file '%s'", size, file_path);
log_error("Failed to read %ld bytes of data from file '%s'", size, file_path);
goto exit_free_data;
}
@ -263,12 +263,12 @@ lash_appdb_parse_file_data(
next_line = strchr(line, '\n');
if (next_line != NULL)
{
//lash_info("there is next line");
//log_info("there is next line");
*next_line = 0;
next_line++;
}
//lash_info("Line '%s'", line);
//log_info("Line '%s'", line);
/* skip comments (and empty lines) */
if (*line == 0 || *line == '#')
@ -301,12 +301,12 @@ lash_appdb_parse_file_data(
strrstrip(line);
value = strlstrip(value);
//lash_info("Key=%s", line);
//lash_info("Value=%s", value);
//log_info("Key=%s", line);
//log_info("Value=%s", value);
if (count + 1 == max_count)
{
lash_error("failed to parse desktop entry with more than %u keys", (unsigned int)max_count);
log_error("failed to parse desktop entry with more than %u keys", (unsigned int)max_count);
return false;
}
@ -360,7 +360,7 @@ lash_appdb_load_file(
char ** str_ptr_ptr;
bool * bool_ptr;
//lash_info("Desktop entry '%s'", file_path);
//log_info("Desktop entry '%s'", file_path);
ret = true;
@ -380,7 +380,7 @@ lash_appdb_load_file(
goto exit_free_data;
}
//lash_info("%llu entries", (unsigned long long)entries_count);
//log_info("%llu entries", (unsigned long long)entries_count);
/* check whether entry is of "Application" type */
value = lash_appdb_find_key(entries, entries_count, "Type");
@ -414,13 +414,13 @@ lash_appdb_load_file(
}
}
//lash_info("Application '%s' found", name);
//log_info("Application '%s' found", name);
/* allocate new entry */
entry_ptr = malloc(sizeof(struct lash_appdb_entry));
if (entry_ptr == NULL)
{
lash_error("malloc() failed");
log_error("malloc() failed");
goto fail_free_data;
}
@ -438,7 +438,7 @@ lash_appdb_load_file(
continue;
}
//lash_info("mapping key '%s' to '%s'", map_ptr->key, value);
//log_info("mapping key '%s' to '%s'", map_ptr->key, value);
if (map_ptr->type == MAP_TYPE_STRING)
{
@ -446,7 +446,7 @@ lash_appdb_load_file(
*str_ptr_ptr = strdup(value);
if (*str_ptr_ptr == NULL)
{
lash_error("strdup() failed");
log_error("strdup() failed");
goto fail_free_entry;
}
}
@ -463,7 +463,7 @@ lash_appdb_load_file(
}
else
{
lash_error("Ignoring %s:%s bool with wrong value '%s'", name, map_ptr->key, value);
log_error("Ignoring %s:%s bool with wrong value '%s'", name, map_ptr->key, value);
}
}
else
@ -504,18 +504,18 @@ lash_appdb_load_dir(
struct dirent * dentry_ptr;
char * file_path;
//lash_info("lash_appdb_load_dir() called for '%s'.", base_directory);
//log_info("lash_appdb_load_dir() called for '%s'.", base_directory);
ret = false;
directory_path = catdup(base_directory, "/applications/");
if (directory_path == NULL)
{
lash_error("catdup() failed to compose the appdb dir path");
log_error("catdup() failed to compose the appdb dir path");
goto fail;
}
//lash_info("Scanning directory '%s'", directory_path);
//log_info("Scanning directory '%s'", directory_path);
dir = opendir(directory_path);
if (dir != NULL)
@ -535,7 +535,7 @@ lash_appdb_load_dir(
file_path = catdup(directory_path, dentry_ptr->d_name);
if (file_path == NULL)
{
lash_error("catdup() failed to compose the appdb dir file");
log_error("catdup() failed to compose the appdb dir file");
}
else
{
@ -553,7 +553,7 @@ lash_appdb_load_dir(
}
else
{
//lash_info("failed to open directory '%s'", directory_path);
//log_info("failed to open directory '%s'", directory_path);
}
ret = true;
@ -577,7 +577,7 @@ lash_appdb_load_dirs(
directories = strdup(base_directories);
if (directories == NULL)
{
lash_error("strdup() failed");
log_error("strdup() failed");
return false;
}
@ -620,19 +620,19 @@ lash_appdb_load(
INIT_LIST_HEAD(appdb);
//lash_info("lash_appdb_load() called.");
//log_info("lash_appdb_load() called.");
home_dir = getenv("HOME");
if (home_dir == NULL)
{
lash_error("HOME environment variable is not set.");
log_error("HOME environment variable is not set.");
goto fail;
}
data_home_default = catdup(home_dir, "/.local/share");
if (data_home_default == NULL)
{
lash_error("catdup failed to compose data_home_default");
log_error("catdup failed to compose data_home_default");
goto fail;
}
@ -668,7 +668,7 @@ void
lash_appdb_free_entry(
struct lash_appdb_entry * entry_ptr)
{
//lash_info("lash_appdb_free_entry() called.");
//log_info("lash_appdb_free_entry() called.");
if (entry_ptr->name != NULL)
{
@ -710,7 +710,7 @@ lash_appdb_free(
struct list_head * node_ptr;
struct lash_appdb_entry * entry_ptr;
//lash_info("lash_appdb_free() called.");
//log_info("lash_appdb_free() called.");
while (!list_empty(appdb))
{
@ -719,7 +719,7 @@ lash_appdb_free(
list_del(node_ptr);
//lash_info("Destroying appdb entry '%s'", entry_ptr->name);
//log_info("Destroying appdb entry '%s'", entry_ptr->name);
lash_appdb_free_entry(entry_ptr);
}

@ -56,13 +56,13 @@ ladish_client_create(
client_ptr = malloc(sizeof(struct ladish_client));
if (client_ptr == NULL)
{
lash_error("malloc() failed to allocate struct ladish_client");
log_error("malloc() failed to allocate struct ladish_client");
return false;
}
if (!ladish_dict_create(&client_ptr->dict))
{
lash_error("ladish_dict_create() failed for client");
log_error("ladish_dict_create() failed for client");
free(client_ptr);
return false;
}
@ -90,7 +90,7 @@ ladish_client_create(
{
char str[37];
uuid_unparse(client_ptr->uuid, str);
lash_info("Created client %s", str);
log_info("Created client %s", str);
}
*client_handle_ptr = (ladish_client_handle)client_ptr;

@ -60,7 +60,7 @@ fail_unref:
call_ptr->reply = NULL;
fail:
lash_error("Ran out of memory trying to construct method return");
log_error("Ran out of memory trying to construct method return");
}
#define array_iter_ptr ((DBusMessageIter *)context)
@ -141,7 +141,7 @@ fail_unref:
call_ptr->reply = NULL;
fail:
lash_error("Ran out of memory trying to construct method return");
log_error("Ran out of memory trying to construct method return");
}
static void ladish_load_studio(struct dbus_method_call * call_ptr)
@ -212,7 +212,7 @@ static void ladish_get_application_list(struct dbus_method_call * call_ptr)
struct lash_appdb_entry * entry_ptr;
#endif
lash_info("Getting applications list");
log_info("Getting applications list");
call_ptr->reply = dbus_message_new_method_return(call_ptr->message);
if (call_ptr->reply == NULL)
@ -277,7 +277,7 @@ fail:
static void ladish_exit(struct dbus_method_call * call_ptr)
{
lash_info("Exit command received through D-Bus");
log_info("Exit command received through D-Bus");
g_quit = true;
}

@ -45,7 +45,7 @@ bool ladish_dict_create(ladish_dict_handle * dict_handle_ptr)
dict_ptr = malloc(sizeof(struct ladish_dict));
if (dict_ptr == NULL)
{
lash_error("malloc() failed to allocate struct ladish_dict");
log_error("malloc() failed to allocate struct ladish_dict");
return false;
}
@ -100,7 +100,7 @@ bool ladish_dict_set(ladish_dict_handle dict_handle, const char * key, const cha
new_value = strdup(value);
if (new_value == NULL)
{
lash_error("strdup() failed to duplicate dict value");
log_error("strdup() failed to duplicate dict value");
return false;
}
@ -112,14 +112,14 @@ bool ladish_dict_set(ladish_dict_handle dict_handle, const char * key, const cha
entry_ptr = malloc(sizeof(struct ladish_dict_entry));
if (entry_ptr == NULL)
{
lash_error("malloc() failed to allocate struct ladish_dict_entry");
log_error("malloc() failed to allocate struct ladish_dict_entry");
return false;
}
entry_ptr->key = strdup(key);
if (entry_ptr->key == NULL)
{
lash_error("strdup() failed to duplicate dict key");
log_error("strdup() failed to duplicate dict key");
free(entry_ptr);
return false;
}
@ -127,7 +127,7 @@ bool ladish_dict_set(ladish_dict_handle dict_handle, const char * key, const cha
entry_ptr->value = strdup(value);
if (entry_ptr->value == NULL)
{
lash_error("strdup() failed to duplicate dict value");
log_error("strdup() failed to duplicate dict value");
free(entry_ptr->key);
free(entry_ptr);
return false;

@ -40,16 +40,16 @@ ensure_dir_exist(
{
if (errno == ENOENT)
{
lash_info("Directory \"%s\" does not exist. Creating...", dirname);
log_info("Directory \"%s\" does not exist. Creating...", dirname);
if (mkdir(dirname, mode) != 0)
{
lash_error("Failed to create \"%s\" directory: %d (%s)", dirname, errno, strerror(errno));
log_error("Failed to create \"%s\" directory: %d (%s)", dirname, errno, strerror(errno));
return false;
}
}
else
{
lash_error("Failed to stat \"%s\": %d (%s)", dirname, errno, strerror(errno));
log_error("Failed to stat \"%s\": %d (%s)", dirname, errno, strerror(errno));
return false;
}
}
@ -57,7 +57,7 @@ ensure_dir_exist(
{
if (!S_ISDIR(st.st_mode))
{
lash_error("\"%s\" exists but is not directory.", dirname);
log_error("\"%s\" exists but is not directory.", dirname);
return false;
}
}

@ -94,7 +94,7 @@ fail_unref:
call_ptr->reply = NULL;
fail:
lash_error("Ran out of memory trying to construct method return");
log_error("Ran out of memory trying to construct method return");
}
static void get_graph(struct dbus_method_call * call_ptr)
@ -113,7 +113,7 @@ static void get_graph(struct dbus_method_call * call_ptr)
DBusMessageIter port_struct_iter;
//DBusMessageIter connection_struct_iter;
//lash_info("get_graph() called");
//log_info("get_graph() called");
if (!dbus_message_get_args(call_ptr->message, &g_dbus_error, DBUS_TYPE_UINT64, &known_version, DBUS_TYPE_INVALID))
{
@ -122,12 +122,12 @@ static void get_graph(struct dbus_method_call * call_ptr)
return;
}
//lash_info("Getting graph, known version is %" PRIu64, known_version);
//log_info("Getting graph, known version is %" PRIu64, known_version);
call_ptr->reply = dbus_message_new_method_return(call_ptr->message);
if (call_ptr->reply == NULL)
{
lash_error("Ran out of memory trying to construct method return");
log_error("Ran out of memory trying to construct method return");
goto exit;
}
@ -171,7 +171,7 @@ static void get_graph(struct dbus_method_call * call_ptr)
goto nomem_close_client_struct;
}
lash_info("client '%s' (%llu)", client_ptr->name, (unsigned long long)client_ptr->id);
log_info("client '%s' (%llu)", client_ptr->name, (unsigned long long)client_ptr->id);
if (!dbus_message_iter_append_basic(&client_struct_iter, DBUS_TYPE_STRING, &client_ptr->name))
{
goto nomem_close_client_struct;
@ -335,7 +335,7 @@ nomem_close_clients_array:
nomem:
dbus_message_unref(call_ptr->reply);
call_ptr->reply = NULL;
lash_error("Ran out of memory trying to construct method return");
log_error("Ran out of memory trying to construct method return");
exit:
return;
@ -381,7 +381,7 @@ bool ladish_graph_create(ladish_graph_handle * graph_handle_ptr, const char * op
graph_ptr = malloc(sizeof(struct ladish_graph));
if (graph_ptr == NULL)
{
lash_error("malloc() failed to allocate struct graph_implementator");
log_error("malloc() failed to allocate struct graph_implementator");
return false;
}
@ -390,7 +390,7 @@ bool ladish_graph_create(ladish_graph_handle * graph_handle_ptr, const char * op
graph_ptr->opath = strdup(opath);
if (graph_ptr->opath == NULL)
{
lash_error("strdup() failed for graph opath");
log_error("strdup() failed for graph opath");
free(graph_ptr);
return false;
}
@ -402,7 +402,7 @@ bool ladish_graph_create(ladish_graph_handle * graph_handle_ptr, const char * op
if (!ladish_dict_create(&graph_ptr->dict))
{
lash_error("ladish_dict_create() failed for graph");
log_error("ladish_dict_create() failed for graph");
if (graph_ptr->opath != NULL)
{
free(graph_ptr->opath);
@ -459,7 +459,7 @@ ladish_graph_remove_port_internal(
list_del(&port_ptr->siblings_client);
list_del(&port_ptr->siblings_graph);
lash_info("removing port '%s':'%s' (%"PRIu64":%"PRIu64") from graph %s", client_ptr->name, port_ptr->name, client_ptr->id, port_ptr->id, graph_ptr->opath != NULL ? graph_ptr->opath : "JACK");
log_info("removing port '%s':'%s' (%"PRIu64":%"PRIu64") from graph %s", client_ptr->name, port_ptr->name, client_ptr->id, port_ptr->id, graph_ptr->opath != NULL ? graph_ptr->opath : "JACK");
if (graph_ptr->opath != NULL)
{
dbus_signal_emit(
@ -495,7 +495,7 @@ ladish_graph_remove_client_internal(
graph_ptr->graph_version++;
list_del(&client_ptr->siblings);
lash_info("removing client '%s' (%"PRIu64") from graph %s", client_ptr->name, client_ptr->id, graph_ptr->opath != NULL ? graph_ptr->opath : "JACK");
log_info("removing client '%s' (%"PRIu64") from graph %s", client_ptr->name, client_ptr->id, graph_ptr->opath != NULL ? graph_ptr->opath : "JACK");
if (graph_ptr->opath != NULL)
{
dbus_signal_emit(
@ -530,7 +530,7 @@ void ladish_graph_clear(ladish_graph_handle graph_handle)
{
struct ladish_graph_client * client_ptr;
lash_info("ladish_graph_clear() called.");
log_info("ladish_graph_clear() called.");
while (!list_empty(&graph_ptr->clients))
{
@ -553,19 +553,19 @@ bool ladish_graph_add_client(ladish_graph_handle graph_handle, ladish_client_han
{
struct ladish_graph_client * client_ptr;
lash_info("adding client '%s' (%p) to graph %s", name, client_handle, graph_ptr->opath != NULL ? graph_ptr->opath : "JACK");
log_info("adding client '%s' (%p) to graph %s", name, client_handle, graph_ptr->opath != NULL ? graph_ptr->opath : "JACK");
client_ptr = malloc(sizeof(struct ladish_graph_client));
if (client_ptr == NULL)
{
lash_error("malloc() failed for struct ladish_graph_client");
log_error("malloc() failed for struct ladish_graph_client");
return false;
}
client_ptr->name = strdup(name);
if (client_ptr->name == NULL)
{
lash_error("strdup() failed for graph client name");
log_error("strdup() failed for graph client name");
free(client_ptr);
return false;
}
@ -602,7 +602,7 @@ ladish_graph_remove_client(
{
struct ladish_graph_client * client_ptr;
lash_info("ladish_graph_remove_client() called.");
log_info("ladish_graph_remove_client() called.");
client_ptr = ladish_graph_find_client(graph_ptr, client_handle);
if (client_ptr != NULL)
@ -630,24 +630,24 @@ ladish_graph_add_port(
client_ptr = ladish_graph_find_client(graph_ptr, client_handle);
if (client_ptr == NULL)
{
lash_error("cannot find client to add port to");
log_error("cannot find client to add port to");
assert(false);
return false;
}
lash_info("adding port '%s':'%s' (%p) to graph %s", client_ptr->name, name, port_handle, graph_ptr->opath != NULL ? graph_ptr->opath : "JACK");
log_info("adding port '%s':'%s' (%p) to graph %s", client_ptr->name, name, port_handle, graph_ptr->opath != NULL ? graph_ptr->opath : "JACK");
port_ptr = malloc(sizeof(struct ladish_graph_port));
if (port_ptr == NULL)
{
lash_error("malloc() failed for struct ladish_graph_port");
log_error("malloc() failed for struct ladish_graph_port");
return false;
}
port_ptr->name = strdup(name);
if (port_ptr->name == NULL)
{
lash_error("strdup() failed for graph port name");
log_error("strdup() failed for graph port name");
free(port_ptr);
return false;
}

@ -98,7 +98,7 @@ void ladish_dict_set_dbus(struct dbus_method_call * call_ptr)
return;
}
lash_info("%s <- %s", key, value);
log_info("%s <- %s", key, value);
if (!ladish_dict_set(dict, key, value))
{

@ -48,18 +48,18 @@ UUID_DEFINE(g_system_playback_guid,0xB2,0xA0,0xBB,0x06,0x28,0xD8,0x4B,0xFE,0x95,
static void clear(void * context)
{
lash_info("clear");
log_info("clear");
}
static void client_appeared(void * context, uint64_t id, const char * name)
{
ladish_client_handle client;
lash_info("client_appeared(%"PRIu64", %s)", id, name);
log_info("client_appeared(%"PRIu64", %s)", id, name);
if (!ladish_client_create(NULL, true, false, false, &client))
{
lash_error("ladish_client_create() failed. Ignoring client %"PRIu64" (%s)", id, name);
log_error("ladish_client_create() failed. Ignoring client %"PRIu64" (%s)", id, name);
return;
}
@ -67,7 +67,7 @@ static void client_appeared(void * context, uint64_t id, const char * name)
if (!ladish_graph_add_client(dispatcher_ptr->jack_graph, client, name))
{
lash_error("ladish_graph_add_client() failed to add client %"PRIu64" (%s) to JACK graph", id, name);
log_error("ladish_graph_add_client() failed to add client %"PRIu64" (%s) to JACK graph", id, name);
ladish_client_destroy(client);
return;
}
@ -82,12 +82,12 @@ static void client_disappeared(void * context, uint64_t id)
{
ladish_client_handle client;
lash_info("client_disappeared(%"PRIu64")", id);
log_info("client_disappeared(%"PRIu64")", id);
client = ladish_graph_find_client_by_jack_id(dispatcher_ptr->jack_graph, id);
if (client == NULL)
{
lash_error("Unknown JACK client with id %"PRIu64" disappeared", id);
log_error("Unknown JACK client with id %"PRIu64" disappeared", id);
return;
}
@ -108,12 +108,12 @@ static void port_appeared(void * context, uint64_t client_id, uint64_t port_id,
uint32_t flags;
const char * jack_client_name;
lash_info("port_appeared(%"PRIu64", %"PRIu64", %s (%s, %s))", client_id, port_id, port_name, is_input ? "in" : "out", is_midi ? "midi" : "audio");
log_info("port_appeared(%"PRIu64", %"PRIu64", %s (%s, %s))", client_id, port_id, port_name, is_input ? "in" : "out", is_midi ? "midi" : "audio");
client = ladish_graph_find_client_by_jack_id(dispatcher_ptr->jack_graph, client_id);
if (client == NULL)
{
lash_error("Port of unknown JACK client with id %"PRIu64" appeared", client_id);
log_error("Port of unknown JACK client with id %"PRIu64" appeared", client_id);
return;
}
@ -128,7 +128,7 @@ static void port_appeared(void * context, uint64_t client_id, uint64_t port_id,
if (!ladish_port_create(NULL, &port))
{
lash_error("ladish_port_create() failed.");
log_error("ladish_port_create() failed.");
return;
}
@ -136,7 +136,7 @@ static void port_appeared(void * context, uint64_t client_id, uint64_t port_id,
if (!ladish_graph_add_port(dispatcher_ptr->jack_graph, client, port, port_name, type, flags))
{
lash_error("ladish_graph_add_port() failed.");
log_error("ladish_graph_add_port() failed.");
ladish_port_destroy(port);
return;
}
@ -149,13 +149,13 @@ static void port_appeared(void * context, uint64_t client_id, uint64_t port_id,
{
if (!ladish_client_create(g_system_capture_guid, true, false, true, &dispatcher_ptr->system_capture_client))
{
lash_error("ladish_client_create() failed.");
log_error("ladish_client_create() failed.");
return;
}
if (!ladish_graph_add_client(dispatcher_ptr->studio_graph, dispatcher_ptr->system_capture_client, "Hardware Capture"))
{
lash_error("ladish_graph_add_client() failed.");
log_error("ladish_graph_add_client() failed.");
ladish_graph_remove_client(dispatcher_ptr->studio_graph, dispatcher_ptr->system_capture_client, true);
dispatcher_ptr->system_capture_client = NULL;
return;
@ -170,7 +170,7 @@ static void port_appeared(void * context, uint64_t client_id, uint64_t port_id,
{
if (!ladish_client_create(g_system_playback_guid, true, false, true, &dispatcher_ptr->system_playback_client))
{
lash_error("ladish_client_create() failed.");
log_error("ladish_client_create() failed.");
return;
}
@ -192,7 +192,7 @@ static void port_appeared(void * context, uint64_t client_id, uint64_t port_id,
{
if (!ladish_client_create(NULL, false, false, false, &client))
{
lash_error("ladish_client_create() failed.");
log_error("ladish_client_create() failed.");
return;
}
@ -200,7 +200,7 @@ static void port_appeared(void * context, uint64_t client_id, uint64_t port_id,
if (!ladish_graph_add_client(dispatcher_ptr->studio_graph, client, jack_client_name))
{
lash_error("ladish_graph_add_client() failed to add client '%s' to studio graph", jack_client_name);
log_error("ladish_graph_add_client() failed to add client '%s' to studio graph", jack_client_name);
ladish_client_destroy(client);
return;
}
@ -209,7 +209,7 @@ static void port_appeared(void * context, uint64_t client_id, uint64_t port_id,
if (!ladish_graph_add_port(dispatcher_ptr->studio_graph, client, port, port_name, type, flags))
{
lash_error("ladish_graph_add_port() failed.");
log_error("ladish_graph_add_port() failed.");
return;
}
}
@ -219,19 +219,19 @@ static void port_disappeared(void * context, uint64_t client_id, uint64_t port_i
ladish_client_handle client;
ladish_port_handle port;
lash_info("port_disappeared(%"PRIu64")", port_id);
log_info("port_disappeared(%"PRIu64")", port_id);
client = ladish_graph_find_client_by_jack_id(dispatcher_ptr->jack_graph, client_id);
if (client == NULL)
{
lash_error("Port of unknown JACK client with id %"PRIu64" disappeared", client_id);
log_error("Port of unknown JACK client with id %"PRIu64" disappeared", client_id);
return;
}
port = ladish_graph_find_port_by_jack_id(dispatcher_ptr->jack_graph, port_id);
if (client == NULL)
{
lash_error("Unknown JACK port with id %"PRIu64" disappeared", port_id);
log_error("Unknown JACK port with id %"PRIu64" disappeared", port_id);
return;
}
@ -249,12 +249,12 @@ static void port_disappeared(void * context, uint64_t client_id, uint64_t port_i
static void ports_connected(void * context, uint64_t client1_id, uint64_t port1_id, uint64_t client2_id, uint64_t port2_id)
{
lash_info("ports_connected");
log_info("ports_connected");
}
static void ports_disconnected(void * context, uint64_t client1_id, uint64_t port1_id, uint64_t client2_id, uint64_t port2_id)
{
lash_info("ports_disconnected");
log_info("ports_disconnected");
}
#undef dispatcher_ptr
@ -271,7 +271,7 @@ ladish_jack_dispatcher_create(
dispatcher_ptr = malloc(sizeof(struct jack_dispatcher));
if (dispatcher_ptr == NULL)
{
lash_error("malloc() failed for struct jack_dispatcher");
log_error("malloc() failed for struct jack_dispatcher");
return false;
}

@ -98,11 +98,11 @@ loader_check_line_repeat_end(
{
if (error)
{
lash_error_plain("%s:%s: stderr line repeated %u times", project, argv0, last_line_repeat_count);
log_error_plain("%s:%s: stderr line repeated %u times", project, argv0, last_line_repeat_count);
}
else
{
lash_info("%s:%s: stdout line repeated %u times", project, argv0, last_line_repeat_count);
log_info("%s:%s: stdout line repeated %u times", project, argv0, last_line_repeat_count);
}
}
}
@ -131,7 +131,7 @@ loader_childs_bury(void)
true,
child_ptr->stderr_last_line_repeat_count);
lash_debug("Bury child '%s' with PID %llu", child_ptr->argv0, (unsigned long long)child_ptr->pid);
log_debug("Bury child '%s' with PID %llu", child_ptr->argv0, (unsigned long long)child_ptr->pid);
list_del(&child_ptr->siblings);
@ -162,24 +162,24 @@ static void loader_sigchld_handler(int signum)
if (!child_ptr)
{
lash_error("LASH loader detected termination of unknown child process with PID %llu", (unsigned long long)pid);
log_error("LASH loader detected termination of unknown child process with PID %llu", (unsigned long long)pid);
}
else
{
lash_info("LASH loader detected termination of child process '%s' with PID %llu", child_ptr->argv0, (unsigned long long)pid);
log_info("LASH loader detected termination of child process '%s' with PID %llu", child_ptr->argv0, (unsigned long long)pid);
}
if (WIFEXITED(status))
{
lash_info("Child exited, status=%d", WEXITSTATUS(status));
log_info("Child exited, status=%d", WEXITSTATUS(status));
}
else if (WIFSIGNALED(status))
{
lash_info("Child was killed by signal %d", WTERMSIG(status));
log_info("Child was killed by signal %d", WTERMSIG(status));
}
else if (WIFSTOPPED(status))
{
lash_info("Child was stopped by signal %d", WSTOPSIG(status));
log_info("Child was stopped by signal %d", WSTOPSIG(status));
}
}
}
@ -201,7 +201,7 @@ static void loader_exec_program_in_xterm(const char * const * argv)
const char * const * src_ptr_ptr;
size_t len;
lash_debug("Executing program '%s' with PID %llu in terminal", argv[0], (unsigned long long)getpid());
log_debug("Executing program '%s' with PID %llu in terminal", argv[0], (unsigned long long)getpid());
/* Calculate the command string length */
len = strlen(XTERM_COMMAND_EXTENSION) + 1;
@ -231,7 +231,7 @@ static void loader_exec_program_in_xterm(const char * const * argv)
/* Execute the command */
execlp("xterm", "xterm", "-e", "/bin/sh", "-c", buf, NULL);
lash_error("Failed to execute command '%s' in terminal: %s", buf, strerror(errno));
log_error("Failed to execute command '%s' in terminal: %s", buf, strerror(errno));
exit(1);
}
@ -245,14 +245,14 @@ static void loader_exec_program(const char * const * argv, const char * working_
/* no longer anything to do with lashd */
if (setsid() == -1)
{
lash_error("Could not create new process group: %s", strerror(errno));
log_error("Could not create new process group: %s", strerror(errno));
}
}
/* change the working dir */
if (chdir(working_dir) == -1)
{
lash_error("Could not change directory to working dir '%s' for program '%s': %s", working_dir, argv[0], strerror(errno));
log_error("Could not change directory to working dir '%s' for program '%s': %s", working_dir, argv[0], strerror(errno));
}
#ifdef LASH_DEBUG
@ -277,10 +277,10 @@ static void loader_exec_program(const char * const * argv, const char * working_
}
*ptr = '\0';
lash_debug("Running command: %s", buf);
log_debug("Running command: %s", buf);
#endif
lash_info("Executing program '%s' with PID %llu", argv[0], (unsigned long long)getpid());
log_info("Executing program '%s' with PID %llu", argv[0], (unsigned long long)getpid());
if (run_in_terminal)
{
@ -291,7 +291,7 @@ static void loader_exec_program(const char * const * argv, const char * working_
/* Execute it */
execvp(argv[0], (char **)argv);
lash_error("Executing program '%s' failed: %s", argv[0], strerror(errno));
log_error("Executing program '%s' failed: %s", argv[0], strerror(errno));
}
exit(1);
@ -334,11 +334,11 @@ loader_read_child_output(
{
if (error)
{
lash_error_plain("%s:%s: last stderr line repeating..", project, argv0);
log_error_plain("%s:%s: last stderr line repeating..", project, argv0);
}
else
{
lash_info("%s:%s: last stdout line repeating...", project, argv0);
log_info("%s:%s: last stdout line repeating...", project, argv0);
}
}
@ -353,11 +353,11 @@ loader_read_child_output(
if (error)
{
lash_error_plain("%s:%s: %s", project, argv0, char_ptr);
log_error_plain("%s:%s: %s", project, argv0, char_ptr);
}
else
{
lash_info("%s:%s: %s", project, argv0, char_ptr);
log_info("%s:%s: %s", project, argv0, char_ptr);
}
}
@ -376,11 +376,11 @@ loader_read_child_output(
if (error)
{
lash_error_plain("%s:%s: %s " ANSI_RESET ANSI_COLOR_RED "(truncated) " ANSI_RESET, project, argv0, char_ptr);
log_error_plain("%s:%s: %s " ANSI_RESET ANSI_COLOR_RED "(truncated) " ANSI_RESET, project, argv0, char_ptr);
}
else
{
lash_info("%s:%s: %s " ANSI_RESET ANSI_COLOR_RED "(truncated) " ANSI_RESET, project, argv0, char_ptr);
log_info("%s:%s: %s " ANSI_RESET ANSI_COLOR_RED "(truncated) " ANSI_RESET, project, argv0, char_ptr);
}
left = 0;
@ -454,21 +454,21 @@ loader_execute(
child_ptr = malloc(sizeof(struct loader_child));
if (child_ptr == NULL)
{
lash_error("malloc() failed to allocate struct loader_child");
log_error("malloc() failed to allocate struct loader_child");
goto fail;
}
child_ptr->project_name = strdup(project_name);
if (child_ptr->project_name == NULL)
{
lash_error("strdup() failed to duplicate project name '%s'", project_name);
log_error("strdup() failed to duplicate project name '%s'", project_name);
goto free_struct;
}
child_ptr->argv0 = strdup(argv[0]);
if (child_ptr->project_name == NULL)
{
lash_error("strdup() failed to duplicate argv[0] '%s'", argv[0]);
log_error("strdup() failed to duplicate argv[0] '%s'", argv[0]);
goto free_project_name;
}
@ -482,7 +482,7 @@ loader_execute(
{
if (pipe(stderr_pipe) == -1)
{
lash_error("Failed to create stderr pipe");
log_error("Failed to create stderr pipe");
}
else
{
@ -490,7 +490,7 @@ loader_execute(
if (fcntl(child_ptr->stderr, F_SETFL, O_NONBLOCK) == -1)
{
lash_error("Failed to set nonblocking mode on "
log_error("Failed to set nonblocking mode on "
"stderr reading end: %s",
strerror(errno));
close(stderr_pipe[0]);
@ -513,7 +513,7 @@ loader_execute(
if (pid == -1)
{
lash_error("Could not fork to exec program '%s': %s", argv[0], strerror(errno));
log_error("Could not fork to exec program '%s': %s", argv[0], strerror(errno));
list_del(&child_ptr->siblings); /* fork failed so it is not really a child process to watch for. */
return false;
}
@ -551,14 +551,14 @@ loader_execute(
if (fcntl(child_ptr->stdout, F_SETFL, O_NONBLOCK) == -1)
{
lash_error("Could not set noblocking mode on stdout "
log_error("Could not set noblocking mode on stdout "