lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [44/50] [abbrv] git commit: refs/heads/master - Remove un-const-ing from method invocation funcs.
Date Fri, 11 Oct 2013 13:32:22 GMT
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/7dd4eeb7
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/7dd4eeb7
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/7dd4eeb7

Branch: refs/heads/master
Commit: 7dd4eeb7c3c53d8174d7af4f88885cc2efca2452
Parents: c36b887
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Mon Sep 30 11:56:50 2013 -0700
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Fri Oct 11 15:28:21 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/7dd4eeb7/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);


Mime
View raw message