X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-core%2Futil.c;h=a5e9f52e350436be00c7bac8f348cae92c7225be;hb=da75d1898a45c106a994cd87f8da5b6bcb2b6450;hp=4fe8737acf6c6aea2969db5131aba55a4f75aaba;hpb=6e35536bddb52c8e6bc201265c77a846d879b5a3;p=catta diff --git a/avahi-core/util.c b/avahi-core/util.c index 4fe8737..a5e9f52 100644 --- a/avahi-core/util.c +++ b/avahi-core/util.c @@ -29,15 +29,14 @@ #include #include -#include - +#include #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,26 +92,22 @@ char *avahi_format_mac_address(const uint8_t* mac, size_t size) { return r; } - - -char *avahi_strdown(char *s) { +char *avahi_strup(char *s) { char *c; - assert(s); for (c = s; *c; c++) - *c = (char) tolower(*c); + *c = (char) toupper(*c); return s; } -char *avahi_strup(char *s) { +char *avahi_strdown(char *s) { char *c; assert(s); for (c = s; *c; c++) - *c = (char) toupper(*c); + *c = (char) tolower(*c); return s; } -