]> xenbits.xensource.com Git - libvirt.git/commitdiff
wireshark: Drop glib dependency
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 1 Aug 2016 08:21:04 +0000 (10:21 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 1 Aug 2016 10:02:51 +0000 (12:02 +0200)
The only function that we currently use from glib is g_sprintf().
That's a very big gun for such small target. Not only that, but
we've silently relied on wireshark dragging in the glib. Replace
the g_sprintf() with plain sprinf() so that we can drop the glib
dependency.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
tools/wireshark/src/packet-libvirt.c

index 569a0a17293a42c74746b0dad4d81c337a16310e..260161e98de3c759d1fe13bf4dcf0981c9c936a3 100644 (file)
@@ -27,8 +27,6 @@
 #include <wireshark/epan/proto.h>
 #include <wireshark/epan/packet.h>
 #include <wireshark/epan/dissectors/packet-tcp.h>
-#include <glib.h>
-#include <glib/gprintf.h>
 #ifdef HAVE_RPC_TYPES_H
 # include <rpc/types.h>
 #endif
@@ -113,7 +111,7 @@ format_xdr_bytes(guint8 *bytes, guint32 length)
     for (i = 0; i < length; i++) {
         /* We know that buf has enough size to contain
            2 * length + '\0' characters. */
-        g_sprintf(buf, "%02x", bytes[i]);
+        snprintf(buf, 2*(length - i) + 1, "%02x", bytes[i]);
         buf += 2;
     }
     return buf - length*2;