You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2012/07/14 15:49:36 UTC

[lucy-commits] svn commit: r1361547 - in /lucy/trunk/core/Lucy/Object: Method.c Method.cfh

Author: nwellnhof
Date: Sat Jul 14 13:49:35 2012
New Revision: 1361547

URL: http://svn.apache.org/viewvc?rev=1361547&view=rev
Log:
LUCY-233 Disable ref counting of Methods

Don't memory-manage Methods. They're persistent like VTables.

Modified:
    lucy/trunk/core/Lucy/Object/Method.c
    lucy/trunk/core/Lucy/Object/Method.cfh

Modified: lucy/trunk/core/Lucy/Object/Method.c
URL: http://svn.apache.org/viewvc/lucy/trunk/core/Lucy/Object/Method.c?rev=1361547&r1=1361546&r2=1361547&view=diff
==============================================================================
--- lucy/trunk/core/Lucy/Object/Method.c (original)
+++ lucy/trunk/core/Lucy/Object/Method.c Sat Jul 14 13:49:35 2012
@@ -18,9 +18,10 @@
 #define LUCY_USE_SHORT_NAMES
 #define CHY_USE_SHORT_NAMES
 
-#include "Lucy/Object/VTable.h"
 #include "Lucy/Object/Method.h"
 #include "Lucy/Object/CharBuf.h"
+#include "Lucy/Object/Err.h"
+#include "Lucy/Object/VTable.h"
 
 Method*
 Method_new(const CharBuf *name, lucy_method_t callback_func, size_t offset) {
@@ -39,6 +40,25 @@ Method_init(Method *self, const CharBuf 
 
 void
 Method_destroy(Method *self) {
-    DECREF(self->name);
+    THROW(ERR, "Insane attempt to destroy Method '%o'", self->name);
 }
 
+Obj*
+Method_inc_refcount(Method *self) {
+    return (Obj*)self;
+}
+
+uint32_t
+Method_dec_refcount(Method *self) {
+    UNUSED_VAR(self);
+    return 1;
+}
+
+uint32_t
+Method_get_refcount(Method *self) {
+    UNUSED_VAR(self);
+    // See comments in VTable.c
+    return 1;
+}
+
+

Modified: lucy/trunk/core/Lucy/Object/Method.cfh
URL: http://svn.apache.org/viewvc/lucy/trunk/core/Lucy/Object/Method.cfh?rev=1361547&r1=1361546&r2=1361547&view=diff
==============================================================================
--- lucy/trunk/core/Lucy/Object/Method.cfh (original)
+++ lucy/trunk/core/Lucy/Object/Method.cfh Sat Jul 14 13:49:35 2012
@@ -32,6 +32,15 @@ class Lucy::Object::Method inherits Lucy
     init(Method *self, const CharBuf *name, lucy_method_t callback_func,
          size_t offset);
 
+    incremented Obj*
+    Inc_RefCount(Method *self);
+
+    uint32_t
+    Dec_RefCount(Method *self);
+
+    uint32_t
+    Get_RefCount(Method *self);
+
     public void
     Destroy(Method *self);
 }