lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [lucy-commits] [2/3] git commit: refs/heads/clean-up-cfish-wip1 - Remove Make() method from Obj.
Date Wed, 21 Aug 2013 00:11:37 GMT
Remove Make() method from Obj.

Make() was flawed and underused, so remove it.


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

Branch: refs/heads/clean-up-cfish-wip1
Commit: b5c62f6d1cf34b647a412621e10111dd060fc42c
Parents: f17beeb
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Tue Aug 20 16:13:48 2013 -0700
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Tue Aug 20 16:52:33 2013 -0700

----------------------------------------------------------------------
 clownfish/runtime/c/src/Clownfish/Err.c         |  6 +++---
 clownfish/runtime/core/Clownfish/Err.c          | 20 ++++++--------------
 clownfish/runtime/core/Clownfish/Err.cfh        |  3 ---
 clownfish/runtime/core/Clownfish/Obj.cfh        |  5 -----
 clownfish/runtime/core/Clownfish/Test/TestObj.c |  8 +-------
 clownfish/runtime/perl/xs/XSBind.c              |  5 ++---
 core/Lucy/Store/Lock.c                          |  7 -------
 core/Lucy/Store/Lock.cfh                        |  3 ---
 8 files changed, 12 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/b5c62f6d/clownfish/runtime/c/src/Clownfish/Err.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/c/src/Clownfish/Err.c b/clownfish/runtime/c/src/Clownfish/Err.c
index c455a17..5240a87 100644
--- a/clownfish/runtime/c/src/Clownfish/Err.c
+++ b/clownfish/runtime/c/src/Clownfish/Err.c
@@ -16,6 +16,7 @@
 
 #define CHY_USE_SHORT_NAMES
 #define CFISH_USE_SHORT_NAMES
+#define C_CFISH_ERR
 
 #include "charmony.h"
 
@@ -71,9 +72,8 @@ Err_To_Host_IMP(Err *self) {
 
 void
 Err_throw_mess(VTable *vtable, CharBuf *message) {
-    Err_Make_t make
-        = METHOD_PTR(CERTIFY(vtable, VTABLE), Cfish_Err_Make);
-    Err *err = (Err*)CERTIFY(make(NULL), ERR);
+    Err *err = (Err*)VTable_Make_Obj(vtable);
+    Err_init(err, CB_new(0));
     Err_Cat_Mess(err, message);
     DECREF(message);
     Err_do_throw(err);

http://git-wip-us.apache.org/repos/asf/lucy/blob/b5c62f6d/clownfish/runtime/core/Clownfish/Err.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Err.c b/clownfish/runtime/core/Clownfish/Err.c
index 6f853d4..fbf883f 100644
--- a/clownfish/runtime/core/Clownfish/Err.c
+++ b/clownfish/runtime/core/Clownfish/Err.c
@@ -49,12 +49,6 @@ Err_Destroy_IMP(Err *self) {
     SUPER_DESTROY(self, ERR);
 }
 
-Err*
-Err_Make_IMP(Err *self) {
-    UNUSED_VAR(self);
-    return Err_new(CB_new(0));
-}
-
 CharBuf*
 Err_To_String_IMP(Err *self) {
     return (CharBuf*)INCREF(self->mess);
@@ -70,12 +64,11 @@ Err_Cat_Mess_IMP(Err *self, const CharBuf *mess) {
 void
 THROW(VTable *vtable, char *pattern, ...) {
     va_list args;
-    Err_Make_t make = METHOD_PTR(CERTIFY(vtable, VTABLE), Cfish_Err_Make);
-    Err *err = (Err*)CERTIFY(make(NULL), ERR);
-    CharBuf *mess = Err_Get_Mess(err);
+    Err *err = (Err*)VTable_Make_Obj(vtable);
+    err = Err_init(err, CB_new(0));
 
     va_start(args, pattern);
-    CB_VCatF(mess, pattern, args);
+    CB_VCatF(err->mess, pattern, args);
     va_end(args);
 
     Err_do_throw(err);
@@ -173,12 +166,11 @@ void
 Err_throw_at(VTable *vtable, const char *file, int line,
              const char *func, const char *pattern, ...) {
     va_list args;
-    Err_Make_t make = METHOD_PTR(CERTIFY(vtable, VTABLE), Cfish_Err_Make);
-    Err *err = (Err*)CERTIFY(make(NULL), ERR);
-    CharBuf *mess = Err_Get_Mess(err);
+    Err *err = (Err*)VTable_Make_Obj(vtable);
+    err = Err_init(err, CB_new(0));
 
     va_start(args, pattern);
-    S_vcat_mess(mess, file, line, func, pattern, args);
+    S_vcat_mess(err->mess, file, line, func, pattern, args);
     va_end(args);
 
     Err_do_throw(err);

http://git-wip-us.apache.org/repos/asf/lucy/blob/b5c62f6d/clownfish/runtime/core/Clownfish/Err.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Err.cfh b/clownfish/runtime/core/Clownfish/Err.cfh
index 00c53d4..470f08f 100644
--- a/clownfish/runtime/core/Clownfish/Err.cfh
+++ b/clownfish/runtime/core/Clownfish/Err.cfh
@@ -71,9 +71,6 @@ public class Clownfish::Err inherits Clownfish::Obj {
     void
     Add_Frame(Err *self, const char *file, int line, const char *func);
 
-    public incremented Err*
-    Make(Err *self);
-
     /** Set the value of "error", a per-thread Err shared variable.
      */
     public inert void

http://git-wip-us.apache.org/repos/asf/lucy/blob/b5c62f6d/clownfish/runtime/core/Clownfish/Obj.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Obj.cfh b/clownfish/runtime/core/Clownfish/Obj.cfh
index 09818bf..88e9055 100644
--- a/clownfish/runtime/core/Clownfish/Obj.cfh
+++ b/clownfish/runtime/core/Clownfish/Obj.cfh
@@ -28,11 +28,6 @@ public class Clownfish::Obj {
     public inert Obj*
     init(Obj* self);
 
-    /** Zero argument factory constructor.
-     */
-    public abstract incremented Obj*
-    Make(Obj *self);
-
     /** Return an object's refcount.
      */
     uint32_t

http://git-wip-us.apache.org/repos/asf/lucy/blob/b5c62f6d/clownfish/runtime/core/Clownfish/Test/TestObj.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestObj.c b/clownfish/runtime/core/Clownfish/Test/TestObj.c
index fb915f2..83f154b 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestObj.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestObj.c
@@ -127,11 +127,6 @@ S_attempt_Clone(void *context) {
 }
 
 static void
-S_attempt_Make(void *context) {
-    Obj_Make((Obj*)context);
-}
-
-static void
 S_attempt_Compare_To(void *context) {
     Obj_Compare_To((Obj*)context, (Obj*)context);
 }
@@ -171,7 +166,6 @@ test_abstract_routines(TestBatchRunner *runner) {
 
     Obj *obj = S_new_testobj();
     S_verify_abstract_error(runner, S_attempt_Clone,      obj, "Clone");
-    S_verify_abstract_error(runner, S_attempt_Make,       obj, "Make");
     S_verify_abstract_error(runner, S_attempt_Compare_To, obj, "Compare_To");
     S_verify_abstract_error(runner, S_attempt_To_I64,     obj, "To_I64");
     S_verify_abstract_error(runner, S_attempt_To_F64,     obj, "To_F64");
@@ -181,7 +175,7 @@ test_abstract_routines(TestBatchRunner *runner) {
 
 void
 TestObj_Run_IMP(TestObj *self, TestBatchRunner *runner) {
-    TestBatchRunner_Plan(runner, (TestBatch*)self, 18);
+    TestBatchRunner_Plan(runner, (TestBatch*)self, 17);
     test_refcounts(runner);
     test_To_String(runner);
     test_Equals(runner);

http://git-wip-us.apache.org/repos/asf/lucy/blob/b5c62f6d/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index e60524b..3ab80e0 100644
--- a/clownfish/runtime/perl/xs/XSBind.c
+++ b/clownfish/runtime/perl/xs/XSBind.c
@@ -858,9 +858,8 @@ Cfish_Err_To_Host_IMP(cfish_Err *self) {
 
 void
 cfish_Err_throw_mess(cfish_VTable *vtable, cfish_CharBuf *message) {
-    Cfish_Err_Make_t make
-        = CFISH_METHOD_PTR(CFISH_CERTIFY(vtable, CFISH_VTABLE), Cfish_Err_Make);
-    cfish_Err *err = (cfish_Err*)CFISH_CERTIFY(make(NULL), CFISH_ERR);
+    cfish_Err *err = (cfish_Err*)Cfish_VTable_Make_Obj(vtable);
+    cfish_Err_init(err, cfish_CB_new(0));
     Cfish_Err_Cat_Mess(err, message);
     CFISH_DECREF(message);
     cfish_Err_do_throw(err);

http://git-wip-us.apache.org/repos/asf/lucy/blob/b5c62f6d/core/Lucy/Store/Lock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Lock.c b/core/Lucy/Store/Lock.c
index e0675af..9d56377 100644
--- a/core/Lucy/Store/Lock.c
+++ b/core/Lucy/Store/Lock.c
@@ -302,10 +302,3 @@ LockErr_init(LockErr *self, CharBuf *message) {
     return self;
 }
 
-LockErr*
-LockErr_Make_IMP(LockErr *self) {
-    UNUSED_VAR(self);
-    return LockErr_new(CB_new(0));
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/b5c62f6d/core/Lucy/Store/Lock.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Lock.cfh b/core/Lucy/Store/Lock.cfh
index b9187d8..0c95617 100644
--- a/core/Lucy/Store/Lock.cfh
+++ b/core/Lucy/Store/Lock.cfh
@@ -167,9 +167,6 @@ public class Lucy::Store::LockErr inherits Clownfish::Err {
 
     public inert LockErr*
     init(LockErr *self, CharBuf *message);
-
-    public incremented LockErr*
-    Make(LockErr *self);
 }
 
 


Mime
View raw message