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;
}
};
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
-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
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;
*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;
}