[Libvirt-cim] [PATCH] Add association results filtering

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Thu Nov 8 18:28:48 UTC 2007


Dan Smith wrote:
> Instead of filling another list, and then copying it back, why not
> just make a copy of the incoming list and then copy matching instances
> back to the original?  Something like this:
>
>   struct inst_list tmp_list;
>
>   tmp_list = *list;
>   inst_list_init(list);
>
>   for (items in tmp_list) {
>     if (item is resultclass)
>       inst_list_add(list, item);
>   }
>
>   inst_list_free(tmp_list);
>
> That should work, and only copy the needed instance pointers once,
> instead of running through the list twice.
>   
Excellent suggestion!  Thanks, this works.  Will generate another patch.

-- 
Kaitlin Rupert
IBM Linux Technology Center
karupert at us.ibm.com





More information about the Libvirt-cim mailing list