From 2f00a0478ae6154c734856935eb9091dc072c5e6 Mon Sep 17 00:00:00 2001 From: tradke Date: Fri, 10 Dec 1999 14:02:40 +0000 Subject: Corrected return codes for CCTK_Reduce() and CCTK_ReduceArray(): 0 - successful -1 - wrong argument(s) Fixed BR#185 by that. git-svn-id: http://svn.cactuscode.org/flesh/trunk@1189 17b73243-c579-4c4c-a9d2-2d5706c11dac --- src/comm/Reduction.c | 124 ++++++++++++++++++++++++++------------------------- 1 file changed, 63 insertions(+), 61 deletions(-) (limited to 'src/comm') diff --git a/src/comm/Reduction.c b/src/comm/Reduction.c index 45c86e44..c38e863c 100644 --- a/src/comm/Reduction.c +++ b/src/comm/Reduction.c @@ -197,43 +197,41 @@ int CCTK_Reduce( cGH *GH, int num_in_fields, ... ) { - va_list indices; int i; - int *in_fields = malloc(num_in_fields*sizeof(int)); - void (*function)(REDUCTION_OPERATOR_REGISTER_ARGLIST)=NULL; + int *in_fields; + void (*function)(REDUCTION_OPERATOR_REGISTER_ARGLIST); - /* Get the pointer to the reduction operator */ + /* Get the pointer to the reduction operator */ if (operation_handle < 0) - + { CCTK_WARN(3,"Invalid handle passed to CCTK_Reduce"); + return (-1); + } - else - { - function = (void (*)(REDUCTION_OPERATOR_REGISTER_ARGLIST)) + function = (void (*)(REDUCTION_OPERATOR_REGISTER_ARGLIST)) Util_GetHandledData(ReductionOperators,operation_handle); - if (function) - { - - /* Fill in the array of variable indices from the variable argument list */ - va_start(indices, num_in_fields); - for (i=0; i