Update of /cvsroot/sblim/indication_helper
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32265
Modified Files:
ind_helper.c
Log Message:
added _releaseDataValue() function; necessary to reset values for checking
mechanism in _worker
Index: ind_helper.c
===================================================================
RCS file: /cvsroot/sblim/indication_helper/ind_helper.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ind_helper.c 3 Feb 2005 22:45:50 -0000 1.3
+++ ind_helper.c 17 Mar 2005 08:52:03 -0000 1.4
@@ -160,6 +160,7 @@
static IndErrorT _cloneData(CMPIData *dst, const CMPIData *sc);
static IndErrorT _releaseData(CMPIData *data);
+static IndErrorT _releaseDataValue(CMPIData *data);
static int _compareProperty (void * , void * );
static int _compareCIMValue(CMPIData , CMPIData );
@@ -898,8 +899,8 @@
the filter on it */
#ifdef DEBUG
- fprintf(stderr,"Trying filter: %p from %s:%s\n",
- p->filter, p->namespace, p->cn);
+ fprintf(stderr,"Trying filter: %p from %s:%s on instance %s\n",
+ p->filter, p->namespace, p->cn, CMGetCharPtr(CDToString(broker,instance,&status)) );
#endif
if (p->filter != NULL)
{
@@ -1144,6 +1145,7 @@
/* Call the routine */
data.type = CMPI_null;
data.state = CMPI_nullValue;
+ _releaseDataValue(&p->data);
IND_HLP_DEBUG("Calling the monitor function");
if (p->check(&data) != IND_OK) {
@@ -1155,11 +1157,11 @@
_releaseData(&data);
break;
}
-
- if (_compareCIMValue(data,
- p->data) != 0)
+
+ if (_compareCIMValue(data,p->data) != 0)
{ /* Yeey, data changed! */
/* Copy the data */
+
_releaseData(&p->data);
_cloneData(&p->data, &data);
@@ -1742,7 +1744,7 @@
value1.state, value2.state);
*/
/* Check that the type of the two CIM values is the same */
- if (value1.type != value2.type) return 0;
+ if (value1.type != value2.type) return 0;
/* Check that the value of the two CIM values is the same */
switch (value1.type) {
@@ -2090,3 +2092,84 @@
return IND_OK;
}
+
+static IndErrorT _releaseDataValue(CMPIData *data)
+{
+ IND_HLP_DEBUG("_releaseDataValue called.");
+ if (data == NULL)
+ return IND_INVALID_ARGS;
+
+ switch (data->type)
+ {
+ case CMPI_uint16:
+ data->value.uint16=0;
+ break;
+
+ case CMPI_instance:
+ CMRelease(data->value.inst);
+ break;
+
+ case CMPI_ref:
+ CMRelease(data->value.ref);
+ break;
+
+ case CMPI_args:
+ CMRelease(data->value.args);
+ break;
+
+ case CMPI_filter:
+ CMRelease(data->value.filter);
+ break;
+
+ case CMPI_enumeration:
+ CMRelease(data->value.Enum);
+ break;
+
+ case CMPI_chars:
+ free(data->value.chars);
+ break;
+
+ case CMPI_dateTime:
+ CMRelease(data->value.dateTime);
+ break;
+
+ case CMPI_ptr:
+
+ data->value.dataPtr.length = 0;
+ free(data->value.dataPtr.ptr);
+ break;
+
+ }
+
+ if ((data->type & CMPI_ARRAY) == CMPI_ARRAY)
+ {
+ IND_HLP_DEBUG("Array released.");
+ /* Should we go through each element on the list? */
+ /*
+ count = CMGetArrayCount(data->value.array, &status);
+ for (i = 0; i < count; i++)
+ {
+ temp=CMGetArrayElementAt(data->value.array,
+ i, &status);
+ _releaseData(&temp);
+ }
+ */
+ if (data->value.array)
+ CMRelease(data->value.array);
+
+ }
+
+ if (((data->type & CMPI_string) == CMPI_string) &&
+ (data->type != CMPI_chars) &&
+ ((data->type & CMPI_ARRAY) != CMPI_ARRAY))
+
+ {
+ IND_HLP_DEBUG("String released.");
+ if (data->value.string)
+ CMRelease(data->value.string);
+ }
+
+ IND_HLP_DEBUG("_releaseDataValue exited.");
+ return IND_OK;
+}
+
|