diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2015-02-04 14:18:39 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2015-02-04 14:18:39 +0000 |
commit | 9806240b783c52432871a6a1116d483cb70df0ed (patch) | |
tree | 606b19925495a05152aa3861517e54b1983cf6d1 | |
parent | ca63ef7133e3072ebbe35b13dd2c437f41e53333 (diff) | |
download | dbus-9806240b783c52432871a6a1116d483cb70df0ed.tar.gz dbus-9806240b783c52432871a6a1116d483cb70df0ed.tar.bz2 dbus-9806240b783c52432871a6a1116d483cb70df0ed.zip |
dbus-monitor: use common code from dbus-test-tool
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46787
Reviewed-by: Philip Withnall
[also sync up the cmake build system -smcv]
-rw-r--r-- | cmake/tools/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tools/Makefile.am | 11 | ||||
-rw-r--r-- | tools/dbus-monitor.c | 12 |
3 files changed, 12 insertions, 13 deletions
diff --git a/cmake/tools/CMakeLists.txt b/cmake/tools/CMakeLists.txt index 9f363b7a..e406daa7 100644 --- a/cmake/tools/CMakeLists.txt +++ b/cmake/tools/CMakeLists.txt @@ -8,6 +8,8 @@ set (dbus_monitor_SOURCES ../../tools/dbus-monitor.c ../../tools/dbus-print-message.c ../../tools/dbus-print-message.h + ../../tools/tool-common.c + ../../tools/tool-common.h ) if (WIN32) diff --git a/tools/Makefile.am b/tools/Makefile.am index 05d1dcb5..294bbc63 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -31,10 +31,13 @@ dbus_send_SOURCES= \ dbus-print-message.h \ dbus-send.c -dbus_monitor_SOURCES= \ - dbus-monitor.c \ - dbus-print-message.c \ - dbus-print-message.h +dbus_monitor_SOURCES = \ + dbus-monitor.c \ + dbus-print-message.c \ + dbus-print-message.h \ + tool-common.c \ + tool-common.h \ + $(NULL) if DBUS_WIN dbus_launch_SOURCES= \ diff --git a/tools/dbus-monitor.c b/tools/dbus-monitor.c index ff8390d7..c15589a4 100644 --- a/tools/dbus-monitor.c +++ b/tools/dbus-monitor.c @@ -34,6 +34,7 @@ #include <time.h> #include "dbus-print-message.h" +#include "tool-common.h" #define EAVESDROPPING_RULE "eavesdrop=true" @@ -78,13 +79,6 @@ gettimeofday (struct timeval *__p, } #endif -inline static void -oom (const char *doing) -{ - fprintf (stderr, "OOM while %s\n", doing); - exit (1); -} - static DBusHandlerResult monitor_filter_func (DBusConnection *connection, DBusMessage *message, @@ -312,10 +306,10 @@ main (int argc, char *argv[]) filters = (char **) realloc (filters, numFilters * sizeof (char *)); if (filters == NULL) - oom ("adding a new filter slot"); + tool_oom ("adding a new filter slot"); filters[j] = (char *) malloc (filter_len); if (filters[j] == NULL) - oom ("adding a new filter"); + tool_oom ("adding a new filter"); snprintf (filters[j], filter_len, "%s,%s", EAVESDROPPING_RULE, arg); j++; } |