*(void **)ptrptr = g_malloc0(alloc_size);
return 0;
}
-
-
-/**
- * virDisposeString:
- * @ptrptr: pointer to pointer for a string which should be sanitized and cleared
- *
- * See virDispose.
- */
-void
-virDisposeString(char **strptr)
-{
- if (!*strptr)
- return;
-
- memset(*strptr, 0, strlen(*strptr));
- g_clear_pointer(strptr, g_free);
-}
int virAllocVar(void *ptrptr, size_t struct_size, size_t element_size, size_t count)
G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NONNULL(1);
-void virDisposeString(char **strptr)
- ATTRIBUTE_NONNULL(1);
-
/**
* VIR_REALLOC_N:
* @ptr: pointer to hold address of allocated memory
* This macro is safe to use on arguments with side effects.
*/
#define VIR_FREE(ptr) g_clear_pointer(&(ptr), g_free)
-
-
-/**
- * VIR_DISPOSE_STRING:
- * @ptr: pointer to a string to be cleared and freed
- *
- * Clears the string and frees the corresponding memory.
- *
- * This macro is not safe to be used on arguments with side effects.
- */
-#define VIR_DISPOSE_STRING(ptr) virDisposeString(&(ptr))