Revision 145e21db
b/HACKING | ||
---|---|---|
77 | 77 |
|
78 | 78 |
Use of the malloc/free/realloc/calloc/valloc/memalign/posix_memalign |
79 | 79 |
APIs is not allowed in the QEMU codebase. Instead of these routines, |
80 |
use the replacement qemu_malloc/qemu_mallocz/qemu_realloc/qemu_free or
|
|
80 |
use the replacement g_malloc/g_malloc0/g_realloc/g_free or
|
|
81 | 81 |
qemu_vmalloc/qemu_memalign/qemu_vfree APIs. |
82 | 82 |
|
83 | 83 |
Please note that NULL check for the qemu_malloc result is redundant and |
84 |
that qemu_malloc() call with zero size is not allowed.
|
|
84 |
that g_malloc() call with zero size is not allowed.
|
|
85 | 85 |
|
86 | 86 |
Memory allocated by qemu_vmalloc or qemu_memalign must be freed with |
87 | 87 |
qemu_vfree, since breaking this will cause problems on Win32 and user |
... | ... | |
108 | 108 |
There are also replacement character processing macros for isxyz and toxyz, |
109 | 109 |
so instead of e.g. isalnum you should use qemu_isalnum. |
110 | 110 |
|
111 |
Because of the memory management rules, you must use qemu_strdup/qemu_strndup
|
|
111 |
Because of the memory management rules, you must use g_strdup/g_strndup
|
|
112 | 112 |
instead of plain strdup/strndup. |
113 | 113 |
|
114 | 114 |
5. Printf-style functions |
Also available in: Unified diff