summaryrefslogtreecommitdiff
path: root/src/dbus/dlt-dbus.c
diff options
context:
space:
mode:
authorChristoph Lipka <clipka@de.adit-jv.com>2018-12-20 14:58:19 +0100
committerChristoph Lipka <clipka@de.adit-jv.com>2018-12-21 10:23:41 +0100
commitdca8ab254aa0a687c32009079d85e4d8f960b213 (patch)
treee63b6a552fd9f61873892110a56a89ef354864cd /src/dbus/dlt-dbus.c
parent0d0c74640c8b792db37cb9f884f89f7561ea551f (diff)
downloadDLT-daemon-dca8ab254aa0a687c32009079d85e4d8f960b213.tar.gz
Code beautification using uncrustify
Signed-off-by: Christoph Lipka <clipka@de.adit-jv.com>
Diffstat (limited to 'src/dbus/dlt-dbus.c')
-rw-r--r--src/dbus/dlt-dbus.c134
1 files changed, 67 insertions, 67 deletions
diff --git a/src/dbus/dlt-dbus.c b/src/dbus/dlt-dbus.c
index a42d02c..54dce33 100644
--- a/src/dbus/dlt-dbus.c
+++ b/src/dbus/dlt-dbus.c
@@ -45,40 +45,38 @@ filter_func (DBusConnection *con,
DBusMessage *message,
void *data)
{
- char **buf;
- int len_p;
- UNUSED(con);
- UNUSED(data);
-
- buf = (char**)&dbus_message_buffer;
- if (!dbus_message_marshal(message,
- buf,
- &len_p))
- {
- fprintf (stderr, "Failed to serialize DBus message!\n");
- return DBUS_HANDLER_RESULT_HANDLED;
- }
-
- DLT_TRACE_NETWORK_SEGMENTED(dbusContext,DLT_NW_TRACE_IPC,0,0,len_p,(void *)*buf);
+ char **buf;
+ int len_p;
+ UNUSED(con);
+ UNUSED(data);
+
+ buf = (char **)&dbus_message_buffer;
+
+ if (!dbus_message_marshal(message,
+ buf,
+ &len_p)) {
+ fprintf (stderr, "Failed to serialize DBus message!\n");
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
- free(*buf);
- *buf = NULL;
+ DLT_TRACE_NETWORK_SEGMENTED(dbusContext, DLT_NW_TRACE_IPC, 0, 0, len_p, (void *)*buf);
- if (dbus_message_is_signal (message,
- DBUS_INTERFACE_LOCAL,
- "Disconnected"))
- {
- DLT_UNREGISTER_CONTEXT (dbusContext);
- DLT_UNREGISTER_APP ();
- exit (0);
- }
+ free(*buf);
+ *buf = NULL;
+ if (dbus_message_is_signal (message,
+ DBUS_INTERFACE_LOCAL,
+ "Disconnected")) {
+ DLT_UNREGISTER_CONTEXT (dbusContext);
+ DLT_UNREGISTER_APP ();
+ exit (0);
+ }
- /* Conceptually we want this to be
- * DBUS_HANDLER_RESULT_NOT_YET_HANDLED, but this raises
- * some problems. See bug 1719.
- */
- return DBUS_HANDLER_RESULT_HANDLED;
+ /* Conceptually we want this to be
+ * DBUS_HANDLER_RESULT_NOT_YET_HANDLED, but this raises
+ * some problems. See bug 1719.
+ */
+ return DBUS_HANDLER_RESULT_HANDLED;
}
int main (int argc, char *argv[])
@@ -92,74 +90,76 @@ int main (int argc, char *argv[])
int num;
- if(read_command_line(&options, argc, argv) < 0)
- {
+ if (read_command_line(&options, argc, argv) < 0) {
fprintf(stderr, "Failed to read command line!\n");
return -1;
}
- if(read_configuration_file(&config, options.ConfigurationFileName) < 0)
- {
+ if (read_configuration_file(&config, options.ConfigurationFileName) < 0) {
fprintf(stderr, "Failed to read configuration file!\n");
return -1;
}
- // register application
- if(options.ApplicationId)
+ /* register application */
+ if (options.ApplicationId)
DLT_REGISTER_APP (options.ApplicationId, "DBus Logging");
else
DLT_REGISTER_APP (config.ApplicationId, "DBus Logging");
- // register context
- DLT_REGISTER_CONTEXT_LL_TS(dbusContext, config.DBus.ContextId, "DBus Context for Logging",DLT_LOG_INFO,DLT_TRACE_STATUS_ON);
+ /* register context */
+ DLT_REGISTER_CONTEXT_LL_TS(dbusContext,
+ config.DBus.ContextId,
+ "DBus Context for Logging",
+ DLT_LOG_INFO,
+ DLT_TRACE_STATUS_ON);
DLT_REGISTER_CONTEXT(dbusLog, "Log", "DBus Context for Logging Generic information");
- // initialise error handler
+ /* initialise error handler */
dbus_error_init (&error);
- // set DBus bus type
- if(options.BusType)
- type = (DBusBusType) atoi(options.BusType);
+ /* set DBus bus type */
+ if (options.BusType)
+ type = (DBusBusType)atoi(options.BusType);
else
- type = (DBusBusType) atoi(config.DBus.BusType);
+ type = (DBusBusType)atoi(config.DBus.BusType);
- // get connection
+ /* get connection */
connection = dbus_bus_get (type, &error);
- if(type==0)
- DLT_LOG(dbusLog,DLT_LOG_INFO,DLT_STRING("BusType"),DLT_STRING("Session Bus"));
- else if(type==1)
- DLT_LOG(dbusLog,DLT_LOG_INFO,DLT_STRING("BusType"),DLT_STRING("System Bus"));
+ if (type == 0)
+ DLT_LOG(dbusLog, DLT_LOG_INFO, DLT_STRING("BusType"), DLT_STRING("Session Bus"));
+ else if (type == 1)
+ DLT_LOG(dbusLog, DLT_LOG_INFO, DLT_STRING("BusType"), DLT_STRING("System Bus"));
else
- DLT_LOG(dbusLog,DLT_LOG_INFO,DLT_STRING("BusType"),DLT_INT(type));
-
- if (NULL == connection)
- {
- fprintf (stderr, "Failed to open connection to %d: %s\n",
- DBUS_BUS_SYSTEM,
- error.message);
- dbus_error_free (&error);
- exit (1);
+ DLT_LOG(dbusLog, DLT_LOG_INFO, DLT_STRING("BusType"), DLT_INT(type));
+
+ if (NULL == connection) {
+ fprintf (stderr, "Failed to open connection to %d: %s\n",
+ DBUS_BUS_SYSTEM,
+ error.message);
+ dbus_error_free (&error);
+ exit (1);
}
- for(num=0;num<config.DBus.FilterCount;num++)
- {
+ for (num = 0; num < config.DBus.FilterCount; num++) {
dbus_bus_add_match (connection,
- config.DBus.FilterMatch[num],
- &error);
- printf("Added FilterMatch: %s\n",config.DBus.FilterMatch[num]);
- DLT_LOG(dbusLog,DLT_LOG_INFO,DLT_STRING("FilterMatch"),DLT_UINT(num+1),DLT_STRING(config.DBus.FilterMatch[num]));
+ config.DBus.FilterMatch[num],
+ &error);
+ printf("Added FilterMatch: %s\n", config.DBus.FilterMatch[num]);
+ DLT_LOG(dbusLog, DLT_LOG_INFO, DLT_STRING("FilterMatch"), DLT_UINT(num + 1),
+ DLT_STRING(config.DBus.FilterMatch[num]));
+
if (dbus_error_is_set (&error))
- goto fail;
+ goto fail;
}
if (!dbus_connection_add_filter (connection, filter_func, NULL, NULL)) {
- fprintf (stderr, "Couldn't add filter!\n");
- exit (1);
+ fprintf (stderr, "Couldn't add filter!\n");
+ exit (1);
}
while (dbus_connection_read_write_dispatch(connection, -1))
- ;
+ ;
DLT_UNREGISTER_CONTEXT (dbusContext);
DLT_UNREGISTER_CONTEXT (dbusLog);