# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1194638786 28800
# Node ID 9e90c48e77195c9b1f7f7f892ba6f43f3d7a027d
# Parent 5f84fd6c5cdefb2dfe41e4d8ec6ca750d3e69faa
Some minor std_association fixes.
Change result_list to tmp_list since the list is freed before filter_results() returns.
Initialize CMPIStatus s in do_assoc(). If match class fails, then s is never properly
set. This is assuming that it's *not* an error if a user queries an association with
a result class that isn't handled by the provider.
The CU_DEBUG() call before the match_class() call on info->assoc_class has a typo. The
string text prints info->assoc_class, but the value passed in for info->assoc_class
is info->result_class.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 5f84fd6c5cde -r 9e90c48e7719 std_association.c
--- a/std_association.c Thu Nov 08 11:21:50 2007 -0800
+++ b/std_association.c Fri Nov 09 12:06:26 2007 -0800
@@ -80,16 +80,16 @@ static CMPIStatus filter_results(struct
const char *filter_class,
const CMPIBroker *broker)
{
- struct inst_list result_list;
+ struct inst_list tmp_list;
CMPIStatus s = {CMPI_RC_OK, NULL};
CMPIObjectPath *op;
int i;
- result_list = *list;
+ tmp_list = *list;
inst_list_init(list);
- for (i = 0; result_list.list[i] != NULL; i++) {
- op = CMGetObjectPath(result_list.list[i], &s);
+ for (i = 0; tmp_list.list[i] != NULL; i++) {
+ op = CMGetObjectPath(tmp_list.list[i], &s);
if ((s.rc != CMPI_RC_OK) || CMIsNullObject(op))
goto out;
@@ -100,11 +100,11 @@ static CMPIStatus filter_results(struct
if (!match_op(broker, op, filter_class))
continue;
- inst_list_add(list, result_list.list[i]);
+ inst_list_add(list, tmp_list.list[i]);
}
out:
- inst_list_free(&result_list);
+ inst_list_free(&tmp_list);
return s;
}
@@ -133,7 +133,7 @@ static CMPIStatus do_assoc(struct std_as
bool names_only)
{
struct inst_list list;
- CMPIStatus s;
+ CMPIStatus s = {CMPI_RC_OK, NULL};
struct std_assoc *handler;
bool rc;
@@ -168,7 +168,7 @@ static CMPIStatus do_assoc(struct std_as
CU_DEBUG("Match_class succeeded.\n");
CU_DEBUG("Calling match_class: \n\tinfo->assoc_class:
'%s'\n",
- info->result_class);
+ info->assoc_class);
rc = match_class(ctx->brkr,
NAMESPACE(ref),
info->assoc_class,