X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-core%2Futil.c;h=ef54be1c333a909574f094b1abdb4f5a5f198f06;hb=0e203251414d56b3f6b8d4dafde19a1d27b18caf;hp=514f0d9a07f3de6cedf80a2cf652c5e4dfdeac61;hpb=5ebf655c85076f200955458673a8bbf0dd927407;p=catta diff --git a/avahi-core/util.c b/avahi-core/util.c index 514f0d9..ef54be1 100644 --- a/avahi-core/util.c +++ b/avahi-core/util.c @@ -27,16 +27,16 @@ #include #include #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; @@ -72,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; @@ -91,3 +92,23 @@ char *avahi_format_mac_address(const uint8_t* mac, size_t size) { return r; } +char *avahi_strdown(char *s) { + char *c; + + assert(s); + + for (c = s; *c; c++) + *c = (char) tolower(*c); + + return s; +} + +char *avahi_strup(char *s) { + char *c; + assert(s); + + for (c = s; *c; c++) + *c = (char) toupper(*c); + + return s; +}