diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-09-28 00:49:15 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-09-28 00:49:15 +0200 |
commit | 4c69a8a7b59e2607b5e198cd076739fbf45af0a5 (patch) | |
tree | 93afaca0b7b8bdea19c1f33f76be22338e88f32f /src/libmdsserver/macros.h | |
parent | mds-kbdc: we cannot remove unneeded whitespace, but comments can still be removed, we want to be able to print out the code (diff) | |
download | mds-4c69a8a7b59e2607b5e198cd076739fbf45af0a5.tar.gz mds-4c69a8a7b59e2607b5e198cd076739fbf45af0a5.tar.bz2 mds-4c69a8a7b59e2607b5e198cd076739fbf45af0a5.tar.xz |
m + make sure the code ends with a new line
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/libmdsserver/macros.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libmdsserver/macros.h b/src/libmdsserver/macros.h index 481d281..79d427f 100644 --- a/src/libmdsserver/macros.h +++ b/src/libmdsserver/macros.h @@ -331,6 +331,20 @@ /** + * `xremalloc` that stores the old variable + * + * @param old:type* The variable to which to store with the old variable that needs + * to be `free`:ed on failure, and set to `NULL` on success. + * @param var:type* The variable to which to assign the reallocation + * @param elements:size_t The number of elements to allocate + * @param type The data type of the elements for which to create an allocation + * @return :int Evaluates to true if an only if the allocation failed + */ +#define xxrealloc(old, var, elements, type) \ + (old = var, (xrealloc(var, elements, type) ? 1 : (old = NULL, 0))) + + +/** * Double to the size of an allocation on the heap * * @param old:type* Variable in which to store the old value temporarily |