Optimize S_html_create_fresh_methods

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

Branch: refs/heads/markdown_v2
Commit: fd139369e466befbfb18daa2271ff16810c21425
Parents: 402466d
Author: Nick Wellnhofer <[email protected]>
Authored: Fri Dec 12 18:13:58 2014 +0100
Committer: Nick Wellnhofer <[email protected]>
Committed: Wed Dec 24 14:56:51 2014 +0100

----------------------------------------------------------------------
 compiler/src/CFCCHtml.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/fd139369/compiler/src/CFCCHtml.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCCHtml.c b/compiler/src/CFCCHtml.c
index 3de712b..73b25cf 100644
--- a/compiler/src/CFCCHtml.c
+++ b/compiler/src/CFCCHtml.c
@@ -555,21 +555,20 @@ S_html_create_methods(CFCClass *klass) {
  */
 static char*
 S_html_create_fresh_methods(CFCClass *klass, CFCClass *ancestor) {
-    CFCMethod  **fresh_methods = CFCClass_fresh_methods(ancestor);
+    CFCMethod  **fresh_methods = CFCClass_fresh_methods(klass);
     const char  *ancestor_name = CFCClass_get_class_name(ancestor);
     char        *result        = CFCUtil_strdup("");
 
     for (int meth_num = 0; fresh_methods[meth_num] != NULL; meth_num++) {
-        CFCMethod *ancestor_method = fresh_methods[meth_num];
-        if (!CFCMethod_public(ancestor_method)) {
+        CFCMethod *method = fresh_methods[meth_num];
+        if (!CFCMethod_public(method)) {
             continue;
         }
 
-        const char *macro_sym = CFCMethod_get_macro_sym(ancestor_method);
-        CFCMethod *method = CFCClass_method(klass, macro_sym);
         const char *class_name = CFCMethod_get_class_name(method);
         if (strcmp(class_name, ancestor_name) != 0) {
-            // Overridden by a subclass.
+            // The method is implementated in a subclass and already
+            // documented.
             continue;
         }
 
@@ -577,6 +576,7 @@ S_html_create_fresh_methods(CFCClass *klass, CFCClass 
*ancestor) {
             result = CFCUtil_cat(result, "<dl>\n", NULL);
         }
 
+        const char *macro_sym = CFCMethod_get_macro_sym(method);
         result = CFCUtil_cat(result, "<dt id=\"func_", macro_sym, "\">",
                              macro_sym, NULL);
         if (CFCMethod_abstract(method)) {

Reply via email to