WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxl: builtin list types should be pass-

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: builtin list types should be pass-by-reference
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 03 Sep 2010 09:50:30 -0700
Delivery-date: Fri, 03 Sep 2010 09:53:12 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1283278583 -3600
# Node ID 573ddf5cc145394cf54b7a068e72f2a60c1594e4
# Parent  e363e0a285f55942170c31418b6444545df65697
libxl: builtin list types should be pass-by-reference

This makes all _destroy functions consistent wrt freeing the actual
reference passed in. Previously we were relying on the reference
contained within the type itself which worked but was semantically a
little confusing.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.c       |    6 ++++--
 tools/libxl/libxl.h       |    4 ++--
 tools/libxl/libxl.idl     |    4 ++--
 tools/libxl/libxltypes.py |    2 ++
 4 files changed, 10 insertions(+), 6 deletions(-)

diff -r e363e0a285f5 -r 573ddf5cc145 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Tue Aug 31 19:15:42 2010 +0100
+++ b/tools/libxl/libxl.c       Tue Aug 31 19:16:23 2010 +0100
@@ -73,9 +73,10 @@ int libxl_ctx_free(libxl_ctx *ctx)
     return 0;
 }
 
-void libxl_string_list_destroy(libxl_string_list sl)
+void libxl_string_list_destroy(libxl_string_list *psl)
 {
     int i;
+    libxl_string_list sl = *psl;
 
     if (!sl)
         return;
@@ -85,9 +86,10 @@ void libxl_string_list_destroy(libxl_str
     free(sl);
 }
 
-void libxl_key_value_list_destroy(libxl_key_value_list kvl)
+void libxl_key_value_list_destroy(libxl_key_value_list *pkvl)
 {
     int i;
+    libxl_key_value_list kvl = *pkvl;
 
     if (!kvl)
         return;
diff -r e363e0a285f5 -r 573ddf5cc145 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Tue Aug 31 19:15:42 2010 +0100
+++ b/tools/libxl/libxl.h       Tue Aug 31 19:16:23 2010 +0100
@@ -234,8 +234,8 @@ int libxl_domain_preserve(libxl_ctx *ctx
 int libxl_domain_preserve(libxl_ctx *ctx, uint32_t domid, 
libxl_domain_create_info *info, const char *name_suffix, libxl_uuid new_uuid);
 
 /* destructors for builtin data types */
-void libxl_string_list_destroy(libxl_string_list sl);
-void libxl_key_value_list_destroy(libxl_key_value_list kvl);
+void libxl_string_list_destroy(libxl_string_list *sl);
+void libxl_key_value_list_destroy(libxl_key_value_list *kvl);
 void libxl_file_reference_destroy(libxl_file_reference *f);
 
 /*
diff -r e363e0a285f5 -r 573ddf5cc145 tools/libxl/libxl.idl
--- a/tools/libxl/libxl.idl     Tue Aug 31 19:15:42 2010 +0100
+++ b/tools/libxl/libxl.idl     Tue Aug 31 19:16:23 2010 +0100
@@ -12,8 +12,8 @@ libxl_disk_phystype = Builtin("disk_phys
 libxl_disk_phystype = Builtin("disk_phystype")
 libxl_nic_type = Builtin("nic_type")
 
-libxl_string_list = Builtin("string_list", 
destructor_fn="libxl_string_list_destroy")
-libxl_key_value_list = Builtin("key_value_list", 
destructor_fn="libxl_key_value_list_destroy")
+libxl_string_list = Builtin("string_list", 
destructor_fn="libxl_string_list_destroy", passby=PASS_BY_REFERENCE)
+libxl_key_value_list = Builtin("key_value_list", 
destructor_fn="libxl_key_value_list_destroy", passby=PASS_BY_REFERENCE)
 
 libxl_cpumap = Builtin("cpumap", destructor_fn="free")
 
diff -r e363e0a285f5 -r 573ddf5cc145 tools/libxl/libxltypes.py
--- a/tools/libxl/libxltypes.py Tue Aug 31 19:15:42 2010 +0100
+++ b/tools/libxl/libxltypes.py Tue Aug 31 19:16:23 2010 +0100
@@ -182,6 +182,8 @@ def parse(f):
             globs[n] = t
         elif isinstance(t,type(object)) and issubclass(t, Type):
             globs[n] = t
+        elif n in ['PASS_BY_REFERENCE', 'PASS_BY_VALUE']:
+            globs[n] = t
 
     try:
         execfile(f, globs, locs)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxl: builtin list types should be pass-by-reference, Xen patchbot-unstable <=