]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
status save
authormuench <muench>
Wed, 7 Apr 2004 08:43:55 +0000 (08:43 +0000)
committermuench <muench>
Wed, 7 Apr 2004 08:43:55 +0000 (08:43 +0000)
allParam/rpc/rpcParam.c
allParam/rpc/rpcpas.c

index b9e20252d6eca4dc2b380532922b3853f584bd74..6097d56614c866dfb0c9fa401421730b51704008 100644 (file)
@@ -1,5 +1,5 @@
 static const char rcsId[] =
-       "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/allParam/rpc/rpcParam.c,v 1.1 2004-04-07 07:46:36 muench Exp $";
+       "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/allParam/rpc/rpcParam.c,v 1.2 2004-04-07 08:43:55 muench Exp $";
 #define _POSIX_C_SOURCE 199509L
 
 #if HAVE_CONFIG_H
@@ -31,6 +31,7 @@ typedef struct RpcParamS {
 int conSetupParam(Param *my, const char *setup)
 {
        int retVal = 0;
+       RpcParam *rpcParam;
 
        my->strerror = NULL;
 
@@ -41,20 +42,22 @@ int conSetupParam(Param *my, const char *setup)
                my->setup = NULL;
        }
 
-       my->specParam = malloc(sizeof(RpcParam));
-       ((RpcParam *)my->specParam)->cl = clnt_create("localhost", RPCPARAMPROG, RPCPARAMVERS, "tcp");
-       if (((RpcParam *)my->specParam)->cl == NULL) {
+       rpcParam = malloc(sizeof(RpcParam));
+       rpcParam->cl = clnt_create("localhost", RPCPARAMPROG, RPCPARAMVERS, "tcp");
+       if (rpcParam->cl == NULL) {
                clnt_pcreateerror("localhost");
                retVal = -1;
        } else {
                char *arg;
 
-               arg = setup == NULL ? "" : setup;
-               ((RpcParam *)my->specParam)->remParam = *con_1(&arg, ((RpcParam *)my->specParam)->cl);
-               printf("%p\n", ((RpcParam *)my->specParam)->remParam);
+               arg = my->setup == NULL ? "" : my->setup;
+               rpcParam->remParam = *con_1(&arg, rpcParam->cl);
        }
 
+       my->specParam = rpcParam;
+
        return retVal;
+
 }
 
 int conParam(Param *my)
@@ -64,29 +67,32 @@ int conParam(Param *my)
 
 void desParam(Param *my)
 {
-       printf("%p\n", ((RpcParam *)my->specParam)->remParam);
-       des_1(&((RpcParam *)my->specParam)->remParam, ((RpcParam *)my->specParam)->cl);
-       if (((RpcParam *)my->specParam)->cl != NULL) {
-               clnt_destroy(((RpcParam *)my->specParam)->cl);
+       RpcParam *rpcParam = my->specParam;
+
+       if (rpcParam->cl != NULL) {
+               des_1(&rpcParam->remParam, rpcParam->cl);
+               clnt_destroy(rpcParam->cl);
        }
-       free((RpcParam *) (my->specParam));
+       free(rpcParam);
        free(my->setup);
 }
 
 int Param_getInt(const Param *my, const char *name, const char *idx,
                                 int *row, unsigned long int *val)
 {
-       Args argsS, *args = &argsS;
-       Res *res;
+       RpcParam *rpcParam = my->specParam;
+
+       Args args;
+       Res res;
 
-       args->param = ((RpcParam *)my->specParam)->remParam;
-       args->name = name;
-       args->idx = idx;
-       res = getint_1(args, ((RpcParam *)my->specParam)->cl);
-       *row = res->rows;
-       *val = res->value;
+       args.param = rpcParam->remParam;
+       args.name = name;
+       args.idx = idx;
+       res = *getint_1(&args, rpcParam->cl);
+       *row = res.rows;
+       *val = res.value;
 
-       return res->ret;
+       return res.ret;
 }
 
 int Param_getString(const Param *my, const char *name, const char *idx,
index 99f9e844d2f70139861655f05dfda4e90ea050a9..2d12bda0fba0d99ecb6560441bad3d13395fa41d 100644 (file)
@@ -14,7 +14,6 @@ unsigned long *con_1_svc(char **setup, struct svc_req *svcReq) {
                free(p);
                p = NULL;
        }
-       printf("%p\n", p);
        res = p;
 
        return &res;
@@ -23,7 +22,6 @@ unsigned long *con_1_svc(char **setup, struct svc_req *svcReq) {
 void *des_1_svc(unsigned long *arg, struct svc_req *svcReq) {
        Param *p = *arg;
 
-       printf("%p\n", p);
        desParam(p);
        free(p);