From: hadaq Date: Thu, 13 May 2004 15:03:58 +0000 (+0000) Subject: some cosmetics, already tested X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=400479a86aa0d7642de20034c164030fe1a769d0;p=daqdata.git some cosmetics, already tested realized that getFilename does not work, since hostname of server is used --- diff --git a/allParam/rpc/pcache.c b/allParam/rpc/pcache.c index 8499939..b0cb705 100644 --- a/allParam/rpc/pcache.c +++ b/allParam/rpc/pcache.c @@ -101,26 +101,23 @@ static PData *find(const PCache *my, const char *name, const char *idx) return retVal; } -int PCache_storeInt(PCache **my, const char *name, const char *idx, unsigned long int value) +PCache *PCache_storeInt(PCache *my, const char *name, const char *idx, unsigned long int value) { - - *my = insert(*my, name, idx, value); - - return 0; + return insert(my, name, idx, value); } -int PCache_getInt(const PCache *my, const char *name, const char *idx, unsigned long int *value) +int PCache_getInt(const PCache *my, const char *name, const char *idx, int *row, unsigned long int *value) { - int retVal; const PData *data; data = find(my, name, idx); + if (data == NULL) { - *value = 0; - retVal = -1; + *row = 0; } else { + *row = 1; *value = data->value.PInt; - retVal = 0; } - return retVal; + + return 0; } diff --git a/allParam/rpc/pcache.h b/allParam/rpc/pcache.h index 82019cc..e2a346f 100644 --- a/allParam/rpc/pcache.h +++ b/allParam/rpc/pcache.h @@ -33,7 +33,7 @@ struct PCacheS { }; typedef struct PCacheS PCache; -int PCache_storeInt(PCache **my, const char *name, const char *idx, unsigned long int value); -int PCache_getInt(const PCache *my, const char *name, const char *idx, unsigned long int *value); +PCache *PCache_storeInt(PCache *my, const char *name, const char *idx, unsigned long int value); +int PCache_getInt(const PCache *my, const char *name, const char *idx, int *row, unsigned long int *value); #endif diff --git a/allParam/rpc/rpcParam.c b/allParam/rpc/rpcParam.c index 109fff7..01cc486 100644 --- a/allParam/rpc/rpcParam.c +++ b/allParam/rpc/rpcParam.c @@ -1,4 +1,4 @@ -static const char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/allParam/rpc/rpcParam.c,v 1.8 2004-05-10 11:20:30 hadaq Exp $"; +static const char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/allParam/rpc/rpcParam.c,v 1.9 2004-05-13 15:03:58 hadaq Exp $"; #define _POSIX_C_SOURCE 199509L #if HAVE_CONFIG_H @@ -92,8 +92,8 @@ int Param_getInt(const Param * my, const char *name, const char *idx, int *row, int retVal; RpcParam *rpcParam = my->specParam; - retVal = PCache_getInt(rpcParam->cache, name, idx, val); - if (retVal != 0) { + retVal = PCache_getInt(rpcParam->cache, name, idx, row, val); + if (retVal != 0 || *row == 0) { GetScalarArgs args; GetIntRes res; @@ -107,9 +107,9 @@ int Param_getInt(const Param * my, const char *name, const char *idx, int *row, *val = res.value; retVal = res.ret; - PCache_storeInt(&rpcParam->cache, name, idx, *val); - } else { - *row = 1; + if (retVal == 0) { + rpcParam->cache = PCache_storeInt(rpcParam->cache, name, idx, *val); + } } return retVal; }