xref: /haiku/src/add-ons/kernel/file_systems/ntfs/libntfs/misc.c (revision 508f54795f39c3e7552d87c95aae9dd8ec6f505b)
1 #ifdef HAVE_CONFIG_H
2 #include "config.h"
3 #endif
4 
5 #ifdef HAVE_STDLIB_H
6 #include <stdlib.h>
7 #endif
8 
9 #include "misc.h"
10 #include "logging.h"
11 
12 /**
13  * ntfs_calloc
14  *
15  * Return a pointer to the allocated memory or NULL if the request fails.
16  */
17 void *ntfs_calloc(size_t size)
18 {
19 	void *p;
20 
21 	p = calloc(1, size);
22 	if (!p)
23 		ntfs_log_perror("Failed to calloc %lld bytes", (long long)size);
24 	return p;
25 }
26 
27 void *ntfs_malloc(size_t size)
28 {
29 	void *p;
30 
31 	p = malloc(size);
32 	if (!p)
33 		ntfs_log_perror("Failed to malloc %lld bytes", (long long)size);
34 	return p;
35 }
36 
37