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 2013/09/30 23:15:37 UTC

[lucy-commits] [4/6] git commit: refs/heads/cfish-string-prep1 - Remove un-const-ing from method invocation funcs.

Remove un-const-ing from method invocation funcs.

Method invocation functions have been casting away const-ness by
accepting `const prefix_Foo *self` as the invocant but then invoking
the retrieved function pointer with `self` cast to `(prefix_Foo*)`.
This was necessary to avoid warnings from "const CharBuf" immutable
strings -- but now our String type is immutable without requiring
`const`, allowing us to improve type safety by removing the cast.


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

Branch: refs/heads/cfish-string-prep1
Commit: 8098c3ac33de2b871a84e507754a54f0ec5fe10e
Parents: 08974ea
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Mon Sep 30 11:56:50 2013 -0700
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon Sep 30 23:13:31 2013 +0200

----------------------------------------------------------------------
 clownfish/compiler/src/CFCBindMethod.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/8098c3ac/clownfish/compiler/src/CFCBindMethod.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindMethod.c b/clownfish/compiler/src/CFCBindMethod.c
index 0a2f7c9..3448e44 100644
--- a/clownfish/compiler/src/CFCBindMethod.c
+++ b/clownfish/compiler/src/CFCBindMethod.c
@@ -115,16 +115,15 @@ S_virtual_method_def(CFCMethod *method, CFCClass *klass) {
     const char pattern[] =
         "extern %sVISIBLE size_t %s;\n"
         "static CFISH_INLINE %s\n"
-        "%s(const %s *self%s) {\n"
+        "%s(%s *self%s) {\n"
         "    const %s method = (%s)cfish_obj_method(self, %s);\n"
-        "    %smethod((%s*)self%s);\n"
+        "    %smethod(self%s);\n"
         "}\n";
     char *method_def
         = CFCUtil_sprintf(pattern, PREFIX, full_offset_sym, ret_type_str,
                           full_meth_sym, invoker_struct, params_minus_invoker,
                           full_typedef, full_typedef, full_offset_sym,
-                          maybe_return, invoker_struct,
-                          arg_names_minus_invoker);
+                          maybe_return, arg_names_minus_invoker);
 
     FREEMEM(full_offset_sym);
     FREEMEM(full_meth_sym);