libwbclient: Make wbcGuidToString not use talloc
authorVolker Lendecke <vl@samba.org>
Tue, 6 Apr 2010 20:14:39 +0000 (22:14 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 19 Apr 2010 12:27:16 +0000 (14:27 +0200)
nsswitch/libwbclient/wbc_guid.c

index d55a19797360fc4b25a6994946729f4dc4b76eb6..52a64ca5801ce8daf87d135db2c68cb9f841d884 100644 (file)
 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 */