]> git.meshlink.io Git - catta/blobdiff - avahi-core/util.c
* Some minor cleanups in netlink code
[catta] / avahi-core / util.c
index 4fe8737acf6c6aea2969db5131aba55a4f75aaba..ef54be1c333a909574f094b1abdb4f5a5f198f06 100644 (file)
 #include <assert.h>
 #include <ctype.h>
 
-#include <glib.h>
-
+#include <avahi-common/malloc.h>
 #include "util.h"
 
 void avahi_hexdump(const void* p, size_t size) {
     const uint8_t *c = p;
     assert(p);
 
-    printf("Dumping %u bytes from %p:\n", size, p);
+    printf("Dumping %lu bytes from %p:\n", (unsigned long) size, p);
     
     while (size > 0) {
         unsigned i;
@@ -73,7 +72,8 @@ char *avahi_format_mac_address(const uint8_t* mac, size_t size) {
     unsigned i;
     static const char hex[] = "0123456789abcdef";
 
-    t = r = g_new(char, size > 0 ? size*3 : 1);
+    if (!(t = r = avahi_new(char, size > 0 ? size*3 : 1)))
+        return NULL;
 
     if (size <= 0) {
         *r = 0;
@@ -92,8 +92,6 @@ char *avahi_format_mac_address(const uint8_t* mac, size_t size) {
     return r;
 }
 
-
-
 char *avahi_strdown(char *s) {
     char *c;
     
@@ -114,4 +112,3 @@ char *avahi_strup(char *s) {
 
     return s;
 }
-