summaryrefslogtreecommitdiff
path: root/source3/aparser/templates/prs_array.tpl
diff options
context:
space:
mode:
Diffstat (limited to 'source3/aparser/templates/prs_array.tpl')
-rw-r--r--source3/aparser/templates/prs_array.tpl13
1 files changed, 7 insertions, 6 deletions
diff --git a/source3/aparser/templates/prs_array.tpl b/source3/aparser/templates/prs_array.tpl
index ca707148db..1bf3fa4b04 100644
--- a/source3/aparser/templates/prs_array.tpl
+++ b/source3/aparser/templates/prs_array.tpl
@@ -1,7 +1,8 @@
- if (il->@ARRAYLEN@ > 0) {
- il->@ELEM@ = (@TYPE@ *)malloc(sizeof(@TYPE@)*il->@ARRAYLEN@);
- if (!il->@ELEM@) goto fail;
- if (!prs_@TYPE@s(True, "@ELEM@", ps, depth+1, il->@ELEM@, il->@ARRAYLEN@)) goto fail;
- } else {
- il->@ELEM@ = NULL;
+ if ((@FLAGS@ & PARSE_SCALARS) &&
+ !io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@))*il->@ARRAY_LEN@)) goto fail;
+ {
+ int i;
+ for (i=0;i<il->@ARRAY_LEN@;i++) {
+ if (!io_@TYPE@("@ELEM@...", ps, depth+1, &il->@ELEM@[i], @FLAGS@)) goto fail;
+ }
}