
Dan Smith wrote:
Adding these additional clauses to do_assoc() makes the function too long and confusing, IMHO. It was already rather long after recent additions. Lets take this opportunity to refine it a bit.
I think that we should be able to boil down the (ref_rslt == NULL) and (ref_rslt != NULL) cases into two small helper functions. Each should build a result list.
Thus, we can have two lists, one that is the result of the handler, and one that is to be returned. So, we can clean it up like this:
if (ref_rslt) ref_case(&handler_result, &to_return, info); else assoc_case(&handler_result, &to_return, info);
if (names_only) cu_return_instance_names(results, &to_return); else cu_return_instances(results, &to_return);
The filtering case of associators would be in assoc_case(), the make_ref() calls would be in ref_case().
This makes sense to me, and I think it's a good suggestion. This also makes it clearer which piece is collecting references and which is collecting associators. -- Kaitlin Rupert IBM Linux Technology Center karupert@us.ibm.com