diff options
author | Volker Lendecke <vl@samba.org> | 2014-03-24 14:36:34 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-03-27 06:06:12 +0100 |
commit | c35fec883cf344a269e65670521e2580a91c24aa (patch) | |
tree | 17fbb77f4671ea8aaa94399de88471592ba6e436 /source3/lib/asys/tests.c | |
parent | c5d07df6abe657ff196266bbfbb376ca7db0968b (diff) | |
download | samba-c35fec883cf344a269e65670521e2580a91c24aa.tar.gz samba-c35fec883cf344a269e65670521e2580a91c24aa.tar.xz samba-c35fec883cf344a269e65670521e2580a91c24aa.zip |
asys: Allow multiple results to be received
This makes use of C99 dynamic arrays. In this performance-sensitive code, I
would like to avoid malloc/free, and I think 15 years after the standard we
might be able to use this feature. Alternatively, we could use the "results"
memory area and store the jobids in the upper range, playing some cast-tricks.
Should work as well.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/lib/asys/tests.c')
-rw-r--r-- | source3/lib/asys/tests.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/source3/lib/asys/tests.c b/source3/lib/asys/tests.c index 354f1bfbdb..e54e3ea2d2 100644 --- a/source3/lib/asys/tests.c +++ b/source3/lib/asys/tests.c @@ -64,20 +64,18 @@ int main(int argc, const char *argv[]) } for (i=0; i<ntasks; i++) { - void *priv; - ssize_t retval; - int err; + struct asys_result result; int *pidx; - ret = asys_result(ctx, &retval, &err, &priv); - if (ret == -1) { - errno = ret; + ret = asys_results(ctx, &result, 1); + if (ret < 0) { + errno = -ret; perror("asys_result failed"); return 1; } - pidx = (int *)priv; + pidx = (int *)result.private_data; - printf("%d returned %d\n", *pidx, (int)retval); + printf("%d returned %d\n", *pidx, (int)result.ret); } ret = asys_context_destroy(ctx); |