From 20011f4681754160c59725c066357d902e00102c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 6 Apr 2010 22:14:39 +0200 Subject: libwbclient: Make wbcGuidToString not use talloc --- nsswitch/libwbclient/wbc_guid.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'nsswitch') diff --git a/nsswitch/libwbclient/wbc_guid.c b/nsswitch/libwbclient/wbc_guid.c index d55a197973..52a64ca580 100644 --- a/nsswitch/libwbclient/wbc_guid.c +++ b/nsswitch/libwbclient/wbc_guid.c @@ -29,28 +29,24 @@ wbcErr wbcGuidToString(const struct wbcGuid *guid, char **guid_string) { - wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + char *result; - if (!guid) { - wbc_status = WBC_ERR_INVALID_PARAM; - BAIL_ON_WBC_ERROR(wbc_status); + result = (char *)wbcAllocateMemory(37, 1, NULL); + if (result == NULL) { + return WBC_ERR_NO_MEMORY; } - - *guid_string = talloc_asprintf(NULL, - "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - guid->time_low, guid->time_mid, - guid->time_hi_and_version, - guid->clock_seq[0], - guid->clock_seq[1], - guid->node[0], guid->node[1], - guid->node[2], guid->node[3], - guid->node[4], guid->node[5]); - BAIL_ON_PTR_ERROR((*guid_string), wbc_status); - - wbc_status = WBC_ERR_SUCCESS; - -done: - return wbc_status; + snprintf(result, 37, + "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + guid->time_low, guid->time_mid, + guid->time_hi_and_version, + guid->clock_seq[0], + guid->clock_seq[1], + guid->node[0], guid->node[1], + guid->node[2], guid->node[3], + guid->node[4], guid->node[5]); + *guid_string = result; + + return WBC_ERR_SUCCESS; } /* @brief Convert a character string to a binary GUID */ -- cgit