You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/06/29 03:15:41 UTC

[lucy-commits] svn commit: r1140930 - /incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c

Author: marvin
Date: Wed Jun 29 01:15:41 2011
New Revision: 1140930

URL: http://svn.apache.org/viewvc?rev=1140930&view=rev
Log:
LUCY-169 Consolidate litterbug code away.

Refactor a routine in Charmonizer's Compiler module to eliminate code which
was spewing extra debris.

Modified:
    incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c

Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c?rev=1140930&r1=1140929&r2=1140930&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c Wed Jun 29 01:15:41 2011
@@ -60,6 +60,8 @@ S_do_test_compile(void);
 
 void
 CC_init(const char *compiler_command, const char *compiler_flags) {
+    const char *code = "int main() { return 0; }\n";
+
     if (Util_verbosity) { printf("Creating compiler object...\n"); }
 
     /* Assign. */
@@ -81,7 +83,12 @@ CC_init(const char *compiler_command, co
     }
 
     /* If we can't compile anything, game over. */
-    S_do_test_compile();
+    if (Util_verbosity) {
+        printf("Trying to compile a small test file...\n");
+    }
+    if (!CC_test_compile(code, strlen(code))) {
+         Util_die("Failed to compile a small test file");
+    }
 }
 
 void
@@ -262,25 +269,6 @@ S_clean_up_try(void) {
     remove(TARGET_PATH);
 }
 
-static void
-S_do_test_compile(void) {
-    const char *code = "int main() { return 0; }\n";
-    chaz_bool_t success;
-
-    if (Util_verbosity) {
-        printf("Trying to compile a small test file...\n");
-    }
-
-    /* Attempt compilation. */
-    success = CC_compile_exe("_charm_try.c", "_charm_try",
-                             code, strlen(code));
-    if (!success) { Util_die("Failed to compile a small test file"); }
-
-    /* Clean up. */
-    remove("_charm_try.c");
-    OS_remove_exe("_charm_try");
-}
-
 void
 CC_add_inc_dir(const char *dir) {
     size_t num_dirs = 0;