lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [8/8] lucy-clownfish git commit: Remove unneeded includes from callbacks.h
Date Sat, 10 Jan 2015 17:31:24 GMT
Remove unneeded includes from callbacks.h

Now that parameters are stripped from invalid callbacks, it isn't
necessary to include all the class headers.


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

Branch: refs/heads/master
Commit: 9e23ec51b84b51ca33eeb9ee4c38c09b5abca1e7
Parents: d9feac0
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Sun Jan 4 23:55:52 2015 +0100
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Mon Jan 5 00:30:47 2015 +0100

----------------------------------------------------------------------
 compiler/src/CFCPerl.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/9e23ec51/compiler/src/CFCPerl.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerl.c b/compiler/src/CFCPerl.c
index ca0af64..983eab6 100644
--- a/compiler/src/CFCPerl.c
+++ b/compiler/src/CFCPerl.c
@@ -515,18 +515,23 @@ CFCPerl_write_callbacks(CFCPerl *self) {
  */
 static void
 S_write_callbacks_h(CFCPerl *self) {
+    CFCParcel    **parcels   = CFCParcel_all_parcels();
     CFCHierarchy  *hierarchy = self->hierarchy;
     CFCClass     **ordered   = CFCHierarchy_ordered_classes(hierarchy);
     char          *includes  = CFCUtil_strdup("");
     char          *cb_decs   = CFCUtil_strdup("");
 
+    for (int i = 0; parcels[i]; ++i) {
+        CFCParcel *parcel = parcels[i];
+        if (!CFCParcel_included(parcel)) {
+            const char *prefix = CFCParcel_get_prefix(parcel);
+            includes = CFCUtil_cat(includes, "#include \"", prefix,
+                                   "parcel.h\"\n", NULL);
+        }
+    }
+
     for (int i = 0; ordered[i] != NULL; i++) {
         CFCClass *klass = ordered[i];
-
-        const char *include_h = CFCClass_include_h(klass);
-        includes = CFCUtil_cat(includes, "#include \"", include_h, "\"\n",
-                               NULL);
-
         if (CFCClass_included(klass)) { continue; }
 
         CFCMethod **fresh_methods = CFCClass_fresh_methods(klass);
@@ -589,6 +594,8 @@ S_write_callbacks_c(CFCPerl *self) {
         "\n"
         "#include \"XSBind.h\"\n"
         "#include \"callbacks.h\"\n"
+        "#include \"Clownfish/Err.h\"\n"
+        "#include \"Clownfish/Obj.h\"\n"
         "\n"
         "static void\n"
         "S_finish_callback_void(const char *meth_name) {\n"


Mime
View raw message