[Workman-devel] [PATCH] WorkmanPartition: add properties

Daniel P. Berrange berrange at redhat.com
Thu Mar 7 09:26:03 UTC 2013


On Wed, Mar 06, 2013 at 02:48:52PM -0600, Josh Poimboeuf wrote:
> Flesh out the WorkmanPartition class:
> 
> - Add properties for parent, children, consumers.
> - Since the concept of boxed lists of objects is now being used for 3
>   separate properties across 2 classes (and more to come in the future),
>   move all the boxed list code into workman-lists.[ch] so we can share
>   some code.
> - Rename "subpartitions" property to "children" (analagous to "parent"
>   property).
> ---
>  workman/Makefile.am                 |   2 +
>  workman/libworkman.sym              |   7 +-
>  workman/workman-lists.c             |  76 +++++++++++
>  workman/workman-lists.h             |  53 ++++++++
>  workman/workman-object.c            |  66 +++-------
>  workman/workman-object.h            |   3 -
>  workman/workman-partition-private.h |  57 +++++++++
>  workman/workman-partition.c         | 243 ++++++++++++++++++++++++++++++++----
>  workman/workman-partition.h         |  25 +---
>  workman/workman.h                   |   1 +
>  10 files changed, 432 insertions(+), 101 deletions(-)
>  create mode 100644 workman/workman-lists.c
>  create mode 100644 workman/workman-lists.h
>  create mode 100644 workman/workman-partition-private.h
> 
> diff --git a/workman/Makefile.am b/workman/Makefile.am
> index 9974901..063504d 100644
> --- a/workman/Makefile.am
> +++ b/workman/Makefile.am
> @@ -17,6 +17,7 @@ libworkman_1_0_la_HEADERS = \
>  			workman-consumer.h \
>  			workman-manager.h \
>  			workman-state.h \
> +			workman-lists.h \
>                          $(NULL)
>  libworkman_1_0_la_SOURCES = \
>  			$(libworkman_1_0_la_HEADERS) \
> @@ -28,6 +29,7 @@ libworkman_1_0_la_SOURCES = \
>  			workman-partition.c \
>  			workman-consumer.c \
>  			workman-manager.c \
> +			workman-lists.c \
>                          $(NULL)
>  libworkman_1_0_la_CFLAGS = \
>  			-DWORKMAN_BUILD \
> diff --git a/workman/libworkman.sym b/workman/libworkman.sym
> index bf477ea..394a7cc 100644
> --- a/workman/libworkman.sym
> +++ b/workman/libworkman.sym
> @@ -31,7 +31,7 @@ LIBworkman_0.0.1 {
>          workman_manager_remove_partition;
>  
>          workman_partition_get_consumers;
> -        workman_partition_get_subpartitions;
> +        workman_partition_get_children;
>          workman_partition_get_parent;
>          workman_partition_set_parent;
>          workman_partition_get_type;
> @@ -42,6 +42,11 @@ LIBworkman_0.0.1 {
>          workman_consumer_set_partition;
>  
>          workman_state_get_type;
> +
> +	workman_attribute_list_get_type;
> +	workman_partition_list_get_type;
> +	workman_consumer_list_get_type;

Got some <tab> characters creeping in there - 'make syntax-check'
should report them.

> +static GList *
> +list_copy(GList *list)
> +{
> +    GList *new_list, *l;
> +
> +    for (new_list = NULL, l = list; l; l = l->next) {
> +        g_object_ref(l->data);
> +        new_list = g_list_append(new_list, l->data);
> +    }
> +
> +    return new_list;
> +}

Could simplify this to

  g_list_foreach(list, (GFunc)g_object_ref, NULL);;
  return g_list_copy(list);

> +
> +
> +static void
> +list_free(GList *list)
> +{
> +    g_list_foreach(list, (GFunc)g_object_unref, NULL);
> +    g_list_free(list);
> +}


ACK overall


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the Workman-devel mailing list