aboutsummaryrefslogtreecommitdiffstats
path: root/version_info.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-11-22 06:02:49 +0000
committerGuy Harris <guy@alum.mit.edu>2012-11-22 06:02:49 +0000
commitbd976ae6c06b2111bd82df16b77739731dc17402 (patch)
tree406d65d00129abb45868150687f267a139bbf670 /version_info.c
parentb9e8e95ffe9f352cde5847d458081826523cf46f (diff)
On UN*X, if an interface has a description, use it as the "friendly
name". If it doesn't have a description, on OS X, use the System Configuration framework to attempt to get a "friendly name" for interfaces. If a loopback device doesn't have a friendly name, give it "Loopback" as the friendly name. Move the "turn a CFString into a mallocated C string" routine into common code, as it's used in more than one place. svn path=/trunk/; revision=46131
Diffstat (limited to 'version_info.c')
-rw-r--r--version_info.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/version_info.c b/version_info.c
index 0ecc6ebd6f..adcdce3a7f 100644
--- a/version_info.c
+++ b/version_info.c
@@ -51,6 +51,7 @@
#ifdef HAVE_OS_X_FRAMEWORKS
#include <CoreFoundation/CoreFoundation.h>
+#include "cfutils.h"
#endif
#ifdef HAVE_LIBCAP
@@ -190,8 +191,6 @@ static char *
get_string_from_dictionary(CFPropertyListRef dict, CFStringRef key)
{
CFStringRef cfstring;
- CFIndex string_len;
- char *string;
cfstring = CFDictionaryGetValue(dict, key);
if (cfstring == NULL)
@@ -200,15 +199,7 @@ get_string_from_dictionary(CFPropertyListRef dict, CFStringRef key)
/* It isn't a string. Punt. */
return NULL;
}
- string_len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstring),
- kCFStringEncodingUTF8);
- string = g_malloc(string_len + 1);
- if (!CFStringGetCString(cfstring, string, string_len + 1,
- kCFStringEncodingUTF8)) {
- g_free(string);
- return NULL;
- }
- return string;
+ return CFString_to_C_string(cfstring);
}
/*