aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-kbdc/builtin-functions.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-12-10 02:21:00 +0100
committerMattias Andrée <maandree@operamail.com>2014-12-10 02:21:00 +0100
commit7179f51176e1f3af53694e09d7ea2ca602403cf1 (patch)
treedb24424529090c7ac819e2ec9724c855dbb2d53e /src/mds-kbdc/builtin-functions.c
parenttypo (diff)
downloadmds-7179f51176e1f3af53694e09d7ea2ca602403cf1.tar.gz
mds-7179f51176e1f3af53694e09d7ea2ca602403cf1.tar.bz2
mds-7179f51176e1f3af53694e09d7ea2ca602403cf1.tar.xz
no more direct allocations, always use macros, unless using alloca
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/mds-kbdc/builtin-functions.c')
-rw-r--r--src/mds-kbdc/builtin-functions.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/mds-kbdc/builtin-functions.c b/src/mds-kbdc/builtin-functions.c
index fbff16f..7cd13b7 100644
--- a/src/mds-kbdc/builtin-functions.c
+++ b/src/mds-kbdc/builtin-functions.c
@@ -29,24 +29,24 @@
/**
* Define useful data for built-in function with 2 parameters
*/
-#define define_2 \
- const char32_t* restrict a = *args++; \
- const char32_t* restrict b = *args++; \
- size_t an = string_length(a); \
- size_t bn = string_length(b); \
- size_t i, n = an > bn ? an : bn; \
- char32_t* restrict rc = malloc((n + 1) * sizeof(char32_t)); \
- fail_if (rc == NULL); \
+#define define_2 \
+ const char32_t* restrict a = *args++; \
+ const char32_t* restrict b = *args++; \
+ size_t an = string_length(a); \
+ size_t bn = string_length(b); \
+ size_t i, n = an > bn ? an : bn; \
+ char32_t* restrict rc; \
+ fail_if (xmalloc(rc, n + 1, char32_t)); \
rc[n] = -1
/**
* Define useful data for built-in function with 1 parameter
*/
-#define define_1 \
- const char32_t* restrict a = *args++; \
- size_t i, n = string_length(a); \
- char32_t* restrict rc = malloc((n + 1) * sizeof(char32_t)); \
- fail_if (rc == NULL); \
+#define define_1 \
+ const char32_t* restrict a = *args++; \
+ size_t i, n = string_length(a); \
+ char32_t* restrict rc; \
+ fail_if (xmalloc(rc, n + 1, char32_t)); \
rc[n] = -1
/**