lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [3/3] git commit: refs/heads/master - Custom object head for C library
Date Sat, 18 May 2013 11:08:47 GMT
Custom object head for C library

Union with host object isn't needed.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/637d4e63
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/637d4e63
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/637d4e63

Branch: refs/heads/master
Commit: 637d4e63321cb489276da519c2ffe55c01a12b3c
Parents: 5ca26ba
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Sat May 18 00:11:47 2013 +0200
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Sat May 18 13:02:43 2013 +0200

----------------------------------------------------------------------
 c/src/Clownfish/Obj.c                |    8 ++++----
 c/src/Clownfish/VTable.c             |    4 ++--
 clownfish/compiler/src/CFCBindCore.c |    6 ------
 clownfish/compiler/src/CFCC.c        |    4 ++--
 clownfish/compiler/src/CFCPerl.c     |    6 ++++++
 clownfish/compiler/src/CFCRuby.c     |    6 ++++++
 6 files changed, 20 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/637d4e63/c/src/Clownfish/Obj.c
----------------------------------------------------------------------
diff --git a/c/src/Clownfish/Obj.c b/c/src/Clownfish/Obj.c
index 30d6b9e..cf344b1 100644
--- a/c/src/Clownfish/Obj.c
+++ b/c/src/Clownfish/Obj.c
@@ -23,19 +23,19 @@
 
 uint32_t
 Obj_get_refcount(Obj *self) {
-    return self->ref.count;
+    return self->refcount;
 }
 
 Obj*
 Obj_inc_refcount(Obj *self) {
-    self->ref.count++;
+    self->refcount++;
     return self;
 }
 
 uint32_t
 Obj_dec_refcount(Obj *self) {
     uint32_t modified_refcount = INT32_MAX;
-    switch (self->ref.count) {
+    switch (self->refcount) {
         case 0:
             THROW(ERR, "Illegal refcount of 0");
             break; // useless
@@ -44,7 +44,7 @@ Obj_dec_refcount(Obj *self) {
             Obj_Destroy(self);
             break;
         default:
-            modified_refcount = --self->ref.count;
+            modified_refcount = --self->refcount;
             break;
     }
     return modified_refcount;

http://git-wip-us.apache.org/repos/asf/lucy/blob/637d4e63/c/src/Clownfish/VTable.c
----------------------------------------------------------------------
diff --git a/c/src/Clownfish/VTable.c b/c/src/Clownfish/VTable.c
index cc51c6f..09fce4e 100644
--- a/c/src/Clownfish/VTable.c
+++ b/c/src/Clownfish/VTable.c
@@ -29,7 +29,7 @@ Obj*
 VTable_make_obj(VTable *self) {
     Obj *obj = (Obj*)Memory_wrapped_calloc(self->obj_alloc_size, 1);
     obj->vtable = self;
-    obj->ref.count = 1;
+    obj->refcount = 1;
     return obj;
 }
 
@@ -37,7 +37,7 @@ Obj*
 VTable_init_obj(VTable *self, void *allocation) {
     Obj *obj = (Obj*)allocation;
     obj->vtable = self;
-    obj->ref.count = 1;
+    obj->refcount = 1;
     return obj;
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/637d4e63/clownfish/compiler/src/CFCBindCore.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindCore.c b/clownfish/compiler/src/CFCBindCore.c
index a1e2348..662d20e 100644
--- a/clownfish/compiler/src/CFCBindCore.c
+++ b/clownfish/compiler/src/CFCBindCore.c
@@ -169,12 +169,6 @@ S_write_parcel_h(CFCBindCore *self) {
         "%s\n"
         "%s\n"
         "\n"
-        "/* Refcount / host object */\n"
-        "typedef union {\n"
-        "    size_t  count;\n"
-        "    void   *host_obj;\n"
-        "} cfish_ref_t;\n"
-        "\n"
         "/* Generic method pointer.\n"
         " */\n"
         "typedef void\n"

http://git-wip-us.apache.org/repos/asf/lucy/blob/637d4e63/clownfish/compiler/src/CFCC.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCC.c b/clownfish/compiler/src/CFCC.c
index fb61844..3e52374 100644
--- a/clownfish/compiler/src/CFCC.c
+++ b/clownfish/compiler/src/CFCC.c
@@ -175,8 +175,8 @@ CFCC_write_hostdefs(CFCC *self) {
         "#ifndef H_CFISH_HOSTDEFS\n"
         "#define H_CFISH_HOSTDEFS 1\n"
         "\n"
-        "#define CFISH_OBJ_HEAD\\\n"
-        "   cfish_ref_t ref;\n"
+        "#define CFISH_OBJ_HEAD \\\n"
+        "    size_t refcount;\n"
         "\n"
         "#endif /* H_CFISH_HOSTDEFS */\n"
         "\n"

http://git-wip-us.apache.org/repos/asf/lucy/blob/637d4e63/clownfish/compiler/src/CFCPerl.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerl.c b/clownfish/compiler/src/CFCPerl.c
index e26ea3e..d8e3ef6 100644
--- a/clownfish/compiler/src/CFCPerl.c
+++ b/clownfish/compiler/src/CFCPerl.c
@@ -322,6 +322,12 @@ CFCPerl_write_hostdefs(CFCPerl *self) {
         "#ifndef H_CFISH_HOSTDEFS\n"
         "#define H_CFISH_HOSTDEFS 1\n"
         "\n"
+        "/* Refcount / host object */\n"
+        "typedef union {\n"
+        "    size_t  count;\n"
+        "    void   *host_obj;\n"
+        "} cfish_ref_t;\n"
+        "\n"
         "#define CFISH_OBJ_HEAD\\\n"
         "   cfish_ref_t ref;\n"
         "\n"

http://git-wip-us.apache.org/repos/asf/lucy/blob/637d4e63/clownfish/compiler/src/CFCRuby.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCRuby.c b/clownfish/compiler/src/CFCRuby.c
index d3b9726..6921522 100644
--- a/clownfish/compiler/src/CFCRuby.c
+++ b/clownfish/compiler/src/CFCRuby.c
@@ -243,6 +243,12 @@ CFCRuby_write_hostdefs(CFCRuby *self) {
         "#ifndef H_CFISH_HOSTDEFS\n"
         "#define H_CFISH_HOSTDEFS 1\n"
         "\n"
+        "/* Refcount / host object */\n"
+        "typedef union {\n"
+        "    size_t  count;\n"
+        "    void   *host_obj;\n"
+        "} cfish_ref_t;\n"
+        "\n"
         "#define CFISH_OBJ_HEAD\\\n"
         "   cfish_ref_t ref;\n"
         "\n"


Mime
View raw message