= T("The requested operation is unsupported"),
[WIMLIB_ERR_VOLUME_LACKS_FEATURES]
= T("The volume did not support a feature necessary to complete the operation"),
+ [WIMLIB_ERR_WIM_IS_MARKED_READONLY]
+ = T("The WIM is marked as read-only"),
[WIMLIB_ERR_WRITE]
= T("Failed to write data to a file"),
[WIMLIB_ERR_XML]
wimlib_calloc(size_t nmemb, size_t size)
{
size_t total_size = nmemb * size;
- void *p = (*wimlib_malloc_func)(total_size);
+ void *p = MALLOC(total_size);
if (p)
p = memset(p, 0, total_size);
return p;
char *p;
size = strlen(str);
- p = (*wimlib_malloc_func)(size + 1);
+ p = MALLOC(size + 1);
if (p)
- memcpy(p, str, size + 1);
+ p = memcpy(p, str, size + 1);
return p;
}
wchar_t *p;
size = wcslen(str);
- p = (*wimlib_malloc_func)((size + 1) * sizeof(wchar_t));
+ p = MALLOC((size + 1) * sizeof(wchar_t));
if (p)
p = wmemcpy(p, str, size + 1);
return p;
#endif /* ENABLE_CUSTOM_MEMORY_ALLOCATOR */
+void *
+memdup(const void *mem, size_t size)
+{
+ void *ptr = MALLOC(size);
+ if (ptr)
+ ptr = memcpy(ptr, mem, size);
+ return ptr;
+}
+
WIMLIBAPI int
wimlib_set_memory_allocator(void *(*malloc_func)(size_t),
void (*free_func)(void *),