lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [lucy-commits] [8/16] git commit: refs/heads/master - Namespace static vars.
Date Sat, 03 Nov 2012 18:21:54 GMT
Namespace static vars.

Make sure that every Charmonizer module uses only static vars that are
namespaced, by either eliminating static vars, moving them inside
functions, adding prefixes, or making them members of a namespaced
struct.  Refactor some functions to break them into chunks, when those
chunks may sensibly swallow static vars.


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

Branch: refs/heads/master
Commit: 8b60c97dd7a4f059cc009d0c4823411ea06a1fbf
Parents: 54a5afd
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Sat Nov 3 11:19:42 2012 -0700
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Sat Nov 3 11:19:42 2012 -0700

----------------------------------------------------------------------
 charmonizer/src/Charmonizer/Core/Compiler.c        |  186 ++++++------
 charmonizer/src/Charmonizer/Core/ConfWriter.c      |   40 ++--
 charmonizer/src/Charmonizer/Core/ConfWriterC.c     |  138 +++++----
 charmonizer/src/Charmonizer/Core/ConfWriterPerl.c  |   20 +-
 charmonizer/src/Charmonizer/Core/ConfWriterRuby.c  |   20 +-
 charmonizer/src/Charmonizer/Core/HeaderChecker.c   |   86 +++---
 charmonizer/src/Charmonizer/Core/OperatingSystem.c |   66 +++--
 charmonizer/src/Charmonizer/Probe.c                |   13 +-
 charmonizer/src/Charmonizer/Probe/DirManip.c       |   53 ++--
 charmonizer/src/Charmonizer/Probe/FuncMacro.c      |  122 +++++---
 charmonizer/src/Charmonizer/Probe/Headers.c        |  236 ++++++++-------
 charmonizer/src/Charmonizer/Probe/Integers.c       |   20 +-
 charmonizer/src/Charmonizer/Probe/LargeFiles.c     |  229 +++++++-------
 charmonizer/src/Charmonizer/Probe/Memory.c         |   28 ++-
 .../src/Charmonizer/Probe/SymbolVisibility.c       |   10 +-
 charmonizer/src/Charmonizer/Probe/VariadicMacros.c |    8 +-
 16 files changed, 690 insertions(+), 585 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/8b60c97d/charmonizer/src/Charmonizer/Core/Compiler.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Compiler.c b/charmonizer/src/Charmonizer/Core/Compiler.c
index a419135..062c42f 100644
--- a/charmonizer/src/Charmonizer/Core/Compiler.c
+++ b/charmonizer/src/Charmonizer/Core/Compiler.c
@@ -27,38 +27,44 @@ static void
 S_detect_known_compilers(void);
 
 /* Temporary files. */
-#define TRY_SOURCE_PATH  "_charmonizer_try.c"
-#define TRY_BASENAME     "_charmonizer_try"
-#define TARGET_PATH      "_charmonizer_target"
+#define CHAZ_CC_TRY_SOURCE_PATH  "_charmonizer_try.c"
+#define CHAZ_CC_TRY_BASENAME     "_charmonizer_try"
+#define CHAZ_CC_TARGET_PATH      "_charmonizer_target"
 
 /* Static vars. */
-static char     *cc_command   = NULL;
-static char     *cc_flags     = NULL;
-static char    **inc_dirs     = NULL;
-static char     *try_exe_name = NULL;
-static char     *try_obj_name = NULL;
-static char      include_flag[10] = "";
-static char      object_flag[10]  = "";
-static char      exe_flag[10]     = "";
-static char      no_link_flag[10] = "";
-static char      error_flag[10]   = "";
-static int       defines___GNUC__  = 0;
-static int       defines__MSC_VER  = 0;
-static int       defines___clang__ = 0;
-static int       warnings_as_errors = 0;    
+static struct {
+    char     *cc_command;
+    char     *cc_flags;
+    char    **inc_dirs;
+    char     *try_exe_name;
+    char     *try_obj_name;
+    char      include_flag[10];
+    char      object_flag[10];
+    char      exe_flag[10];
+    char      no_link_flag[10];
+    char      error_flag[10];
+    int       defines___GNUC__;
+    int       defines__MSC_VER;
+    int       defines___clang__;
+    int       warnings_as_errors;
+} chaz_CC = {
+    NULL, NULL, NULL, NULL, NULL,
+    "", "", "", "", "",
+    0, 0, 0, 0
+};
 
 void
 chaz_CC_set_warnings_as_errors(const int flag) {
-    warnings_as_errors = flag;
-    if (warnings_as_errors) {
-        if (defines__MSC_VER)  {
-            strcpy(error_flag, "/WX");
+    chaz_CC.warnings_as_errors = flag;
+    if (chaz_CC.warnings_as_errors) {
+        if (chaz_CC.defines__MSC_VER)  {
+            strcpy(chaz_CC.error_flag, "/WX");
         } else {
-            strcpy(error_flag, "-Werror");
+            strcpy(chaz_CC.error_flag, "-Werror");
         }
     }
     else {
-        strcpy(error_flag, "");
+        strcpy(chaz_CC.error_flag, "");
     }
 }
 
@@ -70,11 +76,11 @@ chaz_CC_init(const char *compiler_command, const char *compiler_flags) {
     if (chaz_Util_verbosity) { printf("Creating compiler object...\n"); }
 
     /* Assign. */
-    cc_command      = chaz_Util_strdup(compiler_command);
-    cc_flags        = chaz_Util_strdup(compiler_flags);
+    chaz_CC.cc_command      = chaz_Util_strdup(compiler_command);
+    chaz_CC.cc_flags        = chaz_Util_strdup(compiler_flags);
 
     /* Init. */
-    inc_dirs              = (char**)calloc(sizeof(char*), 1);
+    chaz_CC.inc_dirs              = (char**)calloc(sizeof(char*), 1);
 
     /* Add the current directory as an include dir. */
     chaz_CC_add_inc_dir(".");
@@ -83,12 +89,12 @@ chaz_CC_init(const char *compiler_command, const char *compiler_flags) {
     {
         const char *exe_ext = chaz_OS_exe_ext();
         const char *obj_ext = chaz_OS_obj_ext();
-        size_t exe_len = strlen(TRY_BASENAME) + strlen(exe_ext) + 1;
-        size_t obj_len = strlen(TRY_BASENAME) + strlen(obj_ext) + 1;
-        try_exe_name = (char*)malloc(exe_len);
-        try_obj_name = (char*)malloc(obj_len);
-        sprintf(try_exe_name, "%s%s", TRY_BASENAME, exe_ext);
-        sprintf(try_obj_name, "%s%s", TRY_BASENAME, obj_ext);
+        size_t exe_len = strlen(CHAZ_CC_TRY_BASENAME) + strlen(exe_ext) + 1;
+        size_t obj_len = strlen(CHAZ_CC_TRY_BASENAME) + strlen(obj_ext) + 1;
+        chaz_CC.try_exe_name = (char*)malloc(exe_len);
+        chaz_CC.try_obj_name = (char*)malloc(obj_len);
+        sprintf(chaz_CC.try_exe_name, "%s%s", CHAZ_CC_TRY_BASENAME, exe_ext);
+        sprintf(chaz_CC.try_obj_name, "%s%s", CHAZ_CC_TRY_BASENAME, obj_ext);
     }
 
     /* If we can't compile anything, game over. */
@@ -96,17 +102,17 @@ chaz_CC_init(const char *compiler_command, const char *compiler_flags) {
         printf("Trying to compile a small test file...\n");
     }
     /* Try POSIX argument style. */
-    strcpy(include_flag, "-I ");
-    strcpy(object_flag,  "-o ");
-    strcpy(exe_flag,     "-o ");
-    strcpy(no_link_flag, "-c ");
+    strcpy(chaz_CC.include_flag, "-I ");
+    strcpy(chaz_CC.object_flag,  "-o ");
+    strcpy(chaz_CC.exe_flag,     "-o ");
+    strcpy(chaz_CC.no_link_flag, "-c ");
     compile_succeeded = chaz_CC_test_compile(code);
     if (!compile_succeeded) {
         /* Try MSVC argument style. */
-        strcpy(include_flag, "/I");
-        strcpy(object_flag,  "/Fo");
-        strcpy(exe_flag,     "/Fe");
-        strcpy(no_link_flag, "/c");
+        strcpy(chaz_CC.include_flag, "/I");
+        strcpy(chaz_CC.object_flag,  "/Fo");
+        strcpy(chaz_CC.exe_flag,     "/Fe");
+        strcpy(chaz_CC.no_link_flag, "/c");
         compile_succeeded = chaz_CC_test_compile(code);
     }
     if (!compile_succeeded) {
@@ -137,25 +143,25 @@ S_detect_macro(const char *macro) {
 
 static void
 S_detect_known_compilers(void) {
-    defines___GNUC__  = S_detect_macro("__GNUC__");
-    defines__MSC_VER  = S_detect_macro("_MSC_VER");
-    defines___clang__ = S_detect_macro("__clang__");
+    chaz_CC.defines___GNUC__  = S_detect_macro("__GNUC__");
+    chaz_CC.defines__MSC_VER  = S_detect_macro("_MSC_VER");
+    chaz_CC.defines___clang__ = S_detect_macro("__clang__");
 }
 
 void
 chaz_CC_clean_up(void) {
     char **dirs;
 
-    for (dirs = inc_dirs; *dirs != NULL; dirs++) {
+    for (dirs = chaz_CC.inc_dirs; *dirs != NULL; dirs++) {
         free(*dirs);
     }
-    free(inc_dirs);
+    free(chaz_CC.inc_dirs);
 
-    free(cc_command);
-    free(cc_flags);
+    free(chaz_CC.cc_command);
+    free(chaz_CC.cc_flags);
 
-    free(try_obj_name);
-    free(try_exe_name);
+    free(chaz_CC.try_obj_name);
+    free(chaz_CC.try_exe_name);
 }
 
 static char*
@@ -163,14 +169,14 @@ S_inc_dir_string(void) {
     size_t needed = 0;
     char  *inc_dir_string;
     char **dirs;
-    for (dirs = inc_dirs; *dirs != NULL; dirs++) {
-        needed += strlen(include_flag) + 2;
+    for (dirs = chaz_CC.inc_dirs; *dirs != NULL; dirs++) {
+        needed += strlen(chaz_CC.include_flag) + 2;
         needed += strlen(*dirs);
     }
     inc_dir_string = (char*)malloc(needed + 1);
     inc_dir_string[0] = '\0';
-    for (dirs = inc_dirs; *dirs != NULL; dirs++) {
-        strcat(inc_dir_string, include_flag);
+    for (dirs = chaz_CC.inc_dirs; *dirs != NULL; dirs++) {
+        strcat(inc_dir_string, chaz_CC.include_flag);
         strcat(inc_dir_string, *dirs);
         strcat(inc_dir_string, " ");
     }
@@ -187,13 +193,13 @@ chaz_CC_compile_exe(const char *source_path, const char *exe_name,
     char    *junk              = (char*)malloc(junk_buf_size);
     size_t   exe_file_buf_len  = sprintf(exe_file, "%s%s", exe_name, exe_ext);
     char    *inc_dir_string    = S_inc_dir_string();
-    size_t   command_max_size  = strlen(cc_command)
-                                 + strlen(error_flag)
+    size_t   command_max_size  = strlen(chaz_CC.cc_command)
+                                 + strlen(chaz_CC.error_flag)
                                  + strlen(source_path)
-                                 + strlen(exe_flag)
+                                 + strlen(chaz_CC.exe_flag)
                                  + exe_file_buf_len
                                  + strlen(inc_dir_string)
-                                 + strlen(cc_flags)
+                                 + strlen(chaz_CC.cc_flags)
                                  + 200; /* command start, _charm_run, etc.  */
     char *command = (char*)malloc(command_max_size);
     int result;
@@ -203,10 +209,10 @@ chaz_CC_compile_exe(const char *source_path, const char *exe_name,
 
     /* Prepare and run the compiler command. */
     sprintf(command, "%s %s %s %s%s %s %s",
-            cc_command, error_flag, 
-            source_path, exe_flag, 
+            chaz_CC.cc_command, chaz_CC.error_flag, 
+            source_path, chaz_CC.exe_flag, 
             exe_file, inc_dir_string, 
-            cc_flags);
+            chaz_CC.cc_flags);
     if (chaz_Util_verbosity < 2) {
         chaz_OS_run_quietly(command);
     }
@@ -214,7 +220,7 @@ chaz_CC_compile_exe(const char *source_path, const char *exe_name,
         system(command);
     }
 
-    if (defines__MSC_VER) {
+    if (chaz_CC.defines__MSC_VER) {
         /* Zap MSVC junk. */
         sprintf(junk, "%s.obj", exe_name);
         chaz_Util_remove_and_verify(junk);
@@ -245,14 +251,14 @@ chaz_CC_compile_obj(const char *source_path, const char *obj_name,
     char    *obj_file          = (char*)malloc(obj_file_buf_size);
     size_t   obj_file_buf_len  = sprintf(obj_file, "%s%s", obj_name, obj_ext);
     char    *inc_dir_string    = S_inc_dir_string();
-    size_t   command_max_size  = strlen(cc_command)
-                                 + strlen(no_link_flag)
-                                 + strlen(error_flag)
+    size_t   command_max_size  = strlen(chaz_CC.cc_command)
+                                 + strlen(chaz_CC.no_link_flag)
+                                 + strlen(chaz_CC.error_flag)
                                  + strlen(source_path)
-                                 + strlen(object_flag)
+                                 + strlen(chaz_CC.object_flag)
                                  + obj_file_buf_len
                                  + strlen(inc_dir_string)
-                                 + strlen(cc_flags)
+                                 + strlen(chaz_CC.cc_flags)
                                  + 200; /* command start, _charm_run, etc.  */
     char *command = (char*)malloc(command_max_size);
     int result;
@@ -262,10 +268,10 @@ chaz_CC_compile_obj(const char *source_path, const char *obj_name,
 
     /* Prepare and run the compiler command. */
     sprintf(command, "%s %s %s %s %s%s %s %s",
-            cc_command, no_link_flag, error_flag,
-            source_path, object_flag, 
+            chaz_CC.cc_command, chaz_CC.no_link_flag, chaz_CC.error_flag,
+            source_path, chaz_CC.object_flag, 
             obj_file, inc_dir_string,
-            cc_flags);
+            chaz_CC.cc_flags);
     if (chaz_Util_verbosity < 2) {
         chaz_OS_run_quietly(command);
     }
@@ -288,12 +294,12 @@ chaz_CC_compile_obj(const char *source_path, const char *obj_name,
 int
 chaz_CC_test_compile(const char *source) {
     int compile_succeeded;
-    if (!chaz_Util_remove_and_verify(try_obj_name)) {
-        chaz_Util_die("Failed to delete file '%s'", try_obj_name);
+    if (!chaz_Util_remove_and_verify(chaz_CC.try_obj_name)) {
+        chaz_Util_die("Failed to delete file '%s'", chaz_CC.try_obj_name);
     }
-    compile_succeeded = chaz_CC_compile_obj(TRY_SOURCE_PATH, TRY_BASENAME,
-                                            source);
-    chaz_Util_remove_and_verify(try_obj_name);
+    compile_succeeded = chaz_CC_compile_obj(CHAZ_CC_TRY_SOURCE_PATH,
+                                            CHAZ_CC_TRY_BASENAME, source);
+    chaz_Util_remove_and_verify(chaz_CC.try_obj_name);
     return compile_succeeded;
 }
 
@@ -303,28 +309,29 @@ chaz_CC_capture_output(const char *source, size_t *output_len) {
     int compile_succeeded;
 
     /* Clear out previous versions and test to make sure removal worked. */
-    if (!chaz_Util_remove_and_verify(try_exe_name)) {
-        chaz_Util_die("Failed to delete file '%s'", try_exe_name);
+    if (!chaz_Util_remove_and_verify(chaz_CC.try_exe_name)) {
+        chaz_Util_die("Failed to delete file '%s'", chaz_CC.try_exe_name);
     }
-    if (!chaz_Util_remove_and_verify(TARGET_PATH)) {
-        chaz_Util_die("Failed to delete file '%s'", TARGET_PATH);
+    if (!chaz_Util_remove_and_verify(CHAZ_CC_TARGET_PATH)) {
+        chaz_Util_die("Failed to delete file '%s'", CHAZ_CC_TARGET_PATH);
     }
 
     /* Attempt compilation; if successful, run app and slurp output. */
-    compile_succeeded = chaz_CC_compile_exe(TRY_SOURCE_PATH, TRY_BASENAME,
-                                            source);
+    compile_succeeded = chaz_CC_compile_exe(CHAZ_CC_TRY_SOURCE_PATH,
+                                            CHAZ_CC_TRY_BASENAME, source);
     if (compile_succeeded) {
-        chaz_OS_run_local(try_exe_name, NULL);
-        captured_output = chaz_Util_slurp_file(TARGET_PATH, output_len);
+        chaz_OS_run_local(chaz_CC.try_exe_name, NULL);
+        captured_output
+            = chaz_Util_slurp_file(CHAZ_CC_TARGET_PATH, output_len);
     }
     else {
         *output_len = 0;
     }
 
     /* Remove all the files we just created. */
-    chaz_Util_remove_and_verify(TRY_SOURCE_PATH);
-    chaz_Util_remove_and_verify(try_exe_name);
-    chaz_Util_remove_and_verify(TARGET_PATH);
+    chaz_Util_remove_and_verify(CHAZ_CC_TRY_SOURCE_PATH);
+    chaz_Util_remove_and_verify(chaz_CC.try_exe_name);
+    chaz_Util_remove_and_verify(CHAZ_CC_TARGET_PATH);
 
     return captured_output;
 }
@@ -332,15 +339,16 @@ chaz_CC_capture_output(const char *source, size_t *output_len) {
 void
 chaz_CC_add_inc_dir(const char *dir) {
     size_t num_dirs = 0;
-    char **dirs = inc_dirs;
+    char **dirs = chaz_CC.inc_dirs;
 
     /* Count up the present number of dirs, reallocate. */
     while (*dirs++ != NULL) { num_dirs++; }
     num_dirs += 1; /* Passed-in dir. */
-    inc_dirs = (char**)realloc(inc_dirs, (num_dirs + 1) * sizeof(char*));
+    chaz_CC.inc_dirs = (char**)realloc(chaz_CC.inc_dirs,
+                                       (num_dirs + 1) * sizeof(char*));
 
     /* Put the passed-in dir at the end of the list. */
-    inc_dirs[num_dirs - 1] = chaz_Util_strdup(dir);
-    inc_dirs[num_dirs] = NULL;
+    chaz_CC.inc_dirs[num_dirs - 1] = chaz_Util_strdup(dir);
+    chaz_CC.inc_dirs[num_dirs] = NULL;
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/8b60c97d/charmonizer/src/Charmonizer/Core/ConfWriter.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/ConfWriter.c b/charmonizer/src/Charmonizer/Core/ConfWriter.c
index 25b226d..e7977b1 100644
--- a/charmonizer/src/Charmonizer/Core/ConfWriter.c
+++ b/charmonizer/src/Charmonizer/Core/ConfWriter.c
@@ -23,19 +23,19 @@
 static struct {
     chaz_ConfWriter *writers[CW_MAX_WRITERS];
     size_t num_writers;
-} CW;
+} chaz_CW;
 
 void
 chaz_ConfWriter_init(void) {
-    CW.num_writers = 0;
+    chaz_CW.num_writers = 0;
     return;
 }
 
 void
 chaz_ConfWriter_clean_up(void) {
     size_t i;
-    for (i = 0; i < CW.num_writers; i++) {
-        CW.writers[i]->clean_up();
+    for (i = 0; i < chaz_CW.num_writers; i++) {
+        chaz_CW.writers[i]->clean_up();
     }
 }
 
@@ -44,9 +44,9 @@ chaz_ConfWriter_append_conf(const char *fmt, ...) {
     va_list args;
     size_t i;
     
-    for (i = 0; i < CW.num_writers; i++) {
+    for (i = 0; i < chaz_CW.num_writers; i++) {
         va_start(args, fmt);
-        CW.writers[i]->vappend_conf(fmt, args);
+        chaz_CW.writers[i]->vappend_conf(fmt, args);
         va_end(args);
     }
 }
@@ -54,32 +54,32 @@ chaz_ConfWriter_append_conf(const char *fmt, ...) {
 void
 chaz_ConfWriter_add_def(const char *sym, const char *value) {
     size_t i;
-    for (i = 0; i < CW.num_writers; i++) {
-        CW.writers[i]->add_def(sym, value);
+    for (i = 0; i < chaz_CW.num_writers; i++) {
+        chaz_CW.writers[i]->add_def(sym, value);
     }
 }
 
 void
 chaz_ConfWriter_add_typedef(const char *type, const char *alias) {
     size_t i;
-    for (i = 0; i < CW.num_writers; i++) {
-        CW.writers[i]->add_typedef(type, alias);
+    for (i = 0; i < chaz_CW.num_writers; i++) {
+        chaz_CW.writers[i]->add_typedef(type, alias);
     }
 }
 
 void
 chaz_ConfWriter_add_sys_include(const char *header) {
     size_t i;
-    for (i = 0; i < CW.num_writers; i++) {
-        CW.writers[i]->add_sys_include(header);
+    for (i = 0; i < chaz_CW.num_writers; i++) {
+        chaz_CW.writers[i]->add_sys_include(header);
     }
 }
 
 void
 chaz_ConfWriter_add_local_include(const char *header) {
     size_t i;
-    for (i = 0; i < CW.num_writers; i++) {
-        CW.writers[i]->add_local_include(header);
+    for (i = 0; i < chaz_CW.num_writers; i++) {
+        chaz_CW.writers[i]->add_local_include(header);
     }
 }
 
@@ -89,22 +89,22 @@ chaz_ConfWriter_start_module(const char *module_name) {
     if (chaz_Util_verbosity > 0) {
         printf("Running %s module...\n", module_name);
     }
-    for (i = 0; i < CW.num_writers; i++) {
-        CW.writers[i]->start_module(module_name);
+    for (i = 0; i < chaz_CW.num_writers; i++) {
+        chaz_CW.writers[i]->start_module(module_name);
     }
 }
 
 void
 chaz_ConfWriter_end_module(void) {
     size_t i;
-    for (i = 0; i < CW.num_writers; i++) {
-        CW.writers[i]->end_module();
+    for (i = 0; i < chaz_CW.num_writers; i++) {
+        chaz_CW.writers[i]->end_module();
     }
 }
 
 void
 chaz_ConfWriter_add_writer(chaz_ConfWriter *writer) {
-    CW.writers[CW.num_writers] = writer;
-    CW.num_writers++;
+    chaz_CW.writers[chaz_CW.num_writers] = writer;
+    chaz_CW.num_writers++;
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/8b60c97d/charmonizer/src/Charmonizer/Core/ConfWriterC.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/ConfWriterC.c b/charmonizer/src/Charmonizer/Core/ConfWriterC.c
index 372766c..c098b9a 100644
--- a/charmonizer/src/Charmonizer/Core/ConfWriterC.c
+++ b/charmonizer/src/Charmonizer/Core/ConfWriterC.c
@@ -26,24 +26,26 @@
 #include <stdlib.h>
 #include <string.h>
 
-typedef enum ConfElemType {
-    CONFELEM_DEF,
-    CONFELEM_TYPEDEF,
-    CONFELEM_SYS_INCLUDE,
-    CONFELEM_LOCAL_INCLUDE
-} ConfElemType;
+typedef enum chaz_ConfElemType {
+    CHAZ_CONFELEM_DEF,
+    CHAZ_CONFELEM_TYPEDEF,
+    CHAZ_CONFELEM_SYS_INCLUDE,
+    CHAZ_CONFELEM_LOCAL_INCLUDE
+} chaz_ConfElemType;
 
-typedef struct ConfElem {
+typedef struct chaz_ConfElem {
     char *str1;
     char *str2;
-    ConfElemType type;
-} ConfElem;
+    chaz_ConfElemType type;
+} chaz_ConfElem;
 
 /* Static vars. */
-static FILE *charmony_fh  = NULL;
-static ConfElem *defs      = NULL;
-static size_t    def_cap   = 0;
-static size_t    def_count = 0;
+static struct {
+    FILE          *fh;
+    chaz_ConfElem *defs;
+    size_t         def_cap;
+    size_t         def_count;
+} chaz_ConfWriterC = { NULL, NULL, 0, 0 };
 static chaz_ConfWriter CWC_conf_writer;
 
 /* Open the charmony.h file handle.  Print supplied text to it, if non-null.
@@ -54,7 +56,8 @@ S_open_charmony_h(const char *charmony_start);
 
 /* Push a new elem onto the def list. */
 static void
-S_push_def_list_item(const char *str1, const char *str2, ConfElemType type);
+S_push_def_list_item(const char *str1, const char *str2,
+                     chaz_ConfElemType type);
 
 /* Free the def list. */
 static void
@@ -95,17 +98,17 @@ chaz_ConfWriterC_enable(void) {
 static void
 S_open_charmony_h(const char *charmony_start) {
     /* Open the filehandle. */
-    charmony_fh = fopen("charmony.h", "w+");
-    if (charmony_fh == NULL) {
+    chaz_ConfWriterC.fh = fopen("charmony.h", "w+");
+    if (chaz_ConfWriterC.fh == NULL) {
         chaz_Util_die("Can't open 'charmony.h': %s", strerror(errno));
     }
 
     /* Print supplied text (if any) along with warning, open include guard. */
     if (charmony_start != NULL) {
         fwrite(charmony_start, sizeof(char), strlen(charmony_start),
-               charmony_fh);
+               chaz_ConfWriterC.fh);
     }
-    fprintf(charmony_fh,
+    fprintf(chaz_ConfWriterC.fh,
             "/* Header file auto-generated by Charmonizer. \n"
             " * DO NOT EDIT THIS FILE!!\n"
             " */\n\n"
@@ -117,15 +120,15 @@ S_open_charmony_h(const char *charmony_start) {
 static void
 S_ConfWriterC_clean_up(void) {
     /* Write the last bit of charmony.h and close. */
-    fprintf(charmony_fh, "#endif /* H_CHARMONY */\n\n");
-    if (fclose(charmony_fh)) {
+    fprintf(chaz_ConfWriterC.fh, "#endif /* H_CHARMONY */\n\n");
+    if (fclose(chaz_ConfWriterC.fh)) {
         chaz_Util_die("Couldn't close 'charmony.h': %s", strerror(errno));
     }
 }
 
 static void
 S_ConfWriterC_vappend_conf(const char *fmt, va_list args) {
-    vfprintf(charmony_fh, fmt, args);
+    vfprintf(chaz_ConfWriterC.fh, fmt, args);
 }
 
 static int
@@ -146,84 +149,85 @@ S_sym_is_uppercase(const char *sym) {
 
 static void
 S_ConfWriterC_add_def(const char *sym, const char *value) {
-    S_push_def_list_item(sym, value, CONFELEM_DEF);
+    S_push_def_list_item(sym, value, CHAZ_CONFELEM_DEF);
 }
 
 static void
 S_append_def_to_conf(const char *sym, const char *value) {
     if (value) {
         if (S_sym_is_uppercase(sym)) {
-            fprintf(charmony_fh, "#define CHY_%s %s\n", sym, value);
+            fprintf(chaz_ConfWriterC.fh, "#define CHY_%s %s\n", sym, value);
         }
         else {
-            fprintf(charmony_fh, "#define chy_%s %s\n", sym, value);
+            fprintf(chaz_ConfWriterC.fh, "#define chy_%s %s\n", sym, value);
         }
     }
     else {
         if (S_sym_is_uppercase(sym)) {
-            fprintf(charmony_fh, "#define CHY_%s\n", sym);
+            fprintf(chaz_ConfWriterC.fh, "#define CHY_%s\n", sym);
         }
         else {
-            fprintf(charmony_fh, "#define chy_%s\n", sym);
+            fprintf(chaz_ConfWriterC.fh, "#define chy_%s\n", sym);
         }
     }
 }
 
 static void
 S_ConfWriterC_add_typedef(const char *type, const char *alias) {
-    S_push_def_list_item(alias, type, CONFELEM_TYPEDEF);
+    S_push_def_list_item(alias, type, CHAZ_CONFELEM_TYPEDEF);
 }
 
 static void
 S_append_typedef_to_conf(const char *type, const char *alias) {
     if (S_sym_is_uppercase(alias)) {
-        fprintf(charmony_fh, "typedef %s CHY_%s;\n", type, alias);
+        fprintf(chaz_ConfWriterC.fh, "typedef %s CHY_%s;\n", type, alias);
     }
     else {
-        fprintf(charmony_fh, "typedef %s chy_%s;\n", type, alias);
+        fprintf(chaz_ConfWriterC.fh, "typedef %s chy_%s;\n", type, alias);
     }
 }
 
 static void
 S_ConfWriterC_add_sys_include(const char *header) {
-    S_push_def_list_item(header, NULL, CONFELEM_SYS_INCLUDE);
+    S_push_def_list_item(header, NULL, CHAZ_CONFELEM_SYS_INCLUDE);
 }
 
 static void
 S_append_sys_include_to_conf(const char *header) {
-    fprintf(charmony_fh, "#include <%s>\n", header);
+    fprintf(chaz_ConfWriterC.fh, "#include <%s>\n", header);
 }
 
 static void
 S_ConfWriterC_add_local_include(const char *header) {
-    S_push_def_list_item(header, NULL, CONFELEM_LOCAL_INCLUDE);
+    S_push_def_list_item(header, NULL, CHAZ_CONFELEM_LOCAL_INCLUDE);
 }
 
 static void
 S_append_local_include_to_conf(const char *header) {
-    fprintf(charmony_fh, "#include \"%s\"\n", header);
+    fprintf(chaz_ConfWriterC.fh, "#include \"%s\"\n", header);
 }
 
 static void
 S_ConfWriterC_start_module(const char *module_name) {
-    fprintf(charmony_fh, "\n/* %s */\n", module_name);
+    fprintf(chaz_ConfWriterC.fh, "\n/* %s */\n", module_name);
 }
 
 static void
 S_ConfWriterC_end_module(void) {
     size_t i;
-    for (i = 0; i < def_count; i++) {
+    chaz_ConfElem *defs = chaz_ConfWriterC.defs;
+    for (i = 0; i < chaz_ConfWriterC.def_count; i++) {
         switch (defs[i].type) {
-            case CONFELEM_DEF:
+            case CHAZ_CONFELEM_DEF:
                 S_append_def_to_conf(defs[i].str1, defs[i].str2);
                 break;
-            case CONFELEM_TYPEDEF:
+            case CHAZ_CONFELEM_TYPEDEF:
                 S_append_typedef_to_conf(defs[i].str2, defs[i].str1);
                 break;
-            case CONFELEM_SYS_INCLUDE:
+            case CHAZ_CONFELEM_SYS_INCLUDE:
                 S_append_sys_include_to_conf(defs[i].str1);
                 break;
-            case CONFELEM_LOCAL_INCLUDE:
+            case CHAZ_CONFELEM_LOCAL_INCLUDE:
                 S_append_local_include_to_conf(defs[i].str1);
                 break;
             default:
@@ -233,27 +237,27 @@ S_ConfWriterC_end_module(void) {
     }
 
     /* Write out short names. */
-    fprintf(charmony_fh,
+    fprintf(chaz_ConfWriterC.fh,
         "\n#if defined(CHY_USE_SHORT_NAMES) "
         "|| defined(CHAZ_USE_SHORT_NAMES)\n"
     );
-    for (i = 0; i < def_count; i++) {
+    for (i = 0; i < chaz_ConfWriterC.def_count; i++) {
         switch (defs[i].type) {
-            case CONFELEM_DEF: 
-            case CONFELEM_TYPEDEF:
+            case CHAZ_CONFELEM_DEF: 
+            case CHAZ_CONFELEM_TYPEDEF:
                 {
                     const char *sym = defs[i].str1;
                     const char *value = defs[i].str2;
                     if (!value || strcmp(sym, value) != 0) {
                         const char *prefix = S_sym_is_uppercase(sym)
                                              ? "CHY_" : "chy_";
-                        fprintf(charmony_fh, "  #define %s %s%s\n", sym,
-                                prefix, sym);
+                        fprintf(chaz_ConfWriterC.fh, "  #define %s %s%s\n",
+                                sym, prefix, sym);
                     }
                 }
                 break;
-            case CONFELEM_SYS_INCLUDE:
-            case CONFELEM_LOCAL_INCLUDE:
+            case CHAZ_CONFELEM_SYS_INCLUDE:
+            case CHAZ_CONFELEM_LOCAL_INCLUDE:
                 /* no-op */
                 break;
             default:
@@ -262,34 +266,40 @@ S_ConfWriterC_end_module(void) {
         }
     }
 
-    fprintf(charmony_fh, "#endif /* USE_SHORT_NAMES */\n");
-    fprintf(charmony_fh, "\n");
+    fprintf(chaz_ConfWriterC.fh, "#endif /* USE_SHORT_NAMES */\n");
+    fprintf(chaz_ConfWriterC.fh, "\n");
 
     S_clear_def_list();
 }
 
 static void
-S_push_def_list_item(const char *str1, const char *str2, ConfElemType type) {
-    if (def_count >= def_cap) {
-        def_cap += 10;
-        defs = (ConfElem*)realloc(defs, def_cap * sizeof(ConfElem));
+S_push_def_list_item(const char *str1, const char *str2,
+                     chaz_ConfElemType type) {
+    if (chaz_ConfWriterC.def_count >= chaz_ConfWriterC.def_cap) { 
+        size_t amount;
+        chaz_ConfWriterC.def_cap += 10;
+        amount = chaz_ConfWriterC.def_cap * sizeof(chaz_ConfElem);
+        chaz_ConfWriterC.defs
+            = (chaz_ConfElem*)realloc(chaz_ConfWriterC.defs, amount);
     }
-    defs[def_count].str1 = str1 ? chaz_Util_strdup(str1) : NULL;
-    defs[def_count].str2 = str2 ? chaz_Util_strdup(str2) : NULL;
-    defs[def_count].type = type;
-    def_count++;
+    chaz_ConfWriterC.defs[chaz_ConfWriterC.def_count].str1
+        = str1 ? chaz_Util_strdup(str1) : NULL;
+    chaz_ConfWriterC.defs[chaz_ConfWriterC.def_count].str2
+        = str2 ? chaz_Util_strdup(str2) : NULL;
+    chaz_ConfWriterC.defs[chaz_ConfWriterC.def_count].type = type;
+    chaz_ConfWriterC.def_count++;
 }
 
 static void
 S_clear_def_list(void) {
     size_t i;
-    for (i = 0; i < def_count; i++) {
-        free(defs[i].str1);
-        free(defs[i].str2);
+    for (i = 0; i < chaz_ConfWriterC.def_count; i++) {
+        free(chaz_ConfWriterC.defs[i].str1);
+        free(chaz_ConfWriterC.defs[i].str2);
     }
-    free(defs);
-    defs      = NULL;
-    def_cap   = 0;
-    def_count = 0;
+    free(chaz_ConfWriterC.defs);
+    chaz_ConfWriterC.defs      = NULL;
+    chaz_ConfWriterC.def_cap   = 0;
+    chaz_ConfWriterC.def_count = 0;
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/8b60c97d/charmonizer/src/Charmonizer/Core/ConfWriterPerl.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/ConfWriterPerl.c b/charmonizer/src/Charmonizer/Core/ConfWriterPerl.c
index d12d433..0e5914c 100644
--- a/charmonizer/src/Charmonizer/Core/ConfWriterPerl.c
+++ b/charmonizer/src/Charmonizer/Core/ConfWriterPerl.c
@@ -24,7 +24,9 @@
 #include <string.h>
 
 /* Static vars. */
-static FILE *config_pm_fh  = NULL;
+static struct {
+    FILE *fh;
+} chaz_CWPerl = { NULL };
 static chaz_ConfWriter CWPerl_conf_writer;
 
 /* Open the Charmony.pm file handle.
@@ -67,13 +69,13 @@ chaz_ConfWriterPerl_enable(void) {
 static void
 S_open_config_pm(void) {
     /* Open the filehandle. */
-    config_pm_fh = fopen("Charmony.pm", "w+");
-    if (config_pm_fh == NULL) {
+    chaz_CWPerl.fh = fopen("Charmony.pm", "w+");
+    if (chaz_CWPerl.fh == NULL) {
         chaz_Util_die("Can't open 'Charmony.pm': %s", strerror(errno));
     }
 
     /* Start the module. */
-    fprintf(config_pm_fh,
+    fprintf(chaz_CWPerl.fh,
             "# Auto-generated by Charmonizer. \n"
             "# DO NOT EDIT THIS FILE!!\n"
             "\n"
@@ -91,8 +93,8 @@ S_open_config_pm(void) {
 static void
 S_ConfWriterPerl_clean_up(void) {
     /* Write the last bit of Charmony.pm and close. */
-    fprintf(config_pm_fh, "\n1;\n\n");
-    if (fclose(config_pm_fh)) {
+    fprintf(chaz_CWPerl.fh, "\n1;\n\n");
+    if (fclose(chaz_CWPerl.fh)) {
         chaz_Util_die("Couldn't close 'Charmony.pm': %s", strerror(errno));
     }
 }
@@ -171,7 +173,7 @@ S_ConfWriterPerl_add_def(const char *sym, const char *value) {
                                                 CFPERL_MAX_BUF);
     }
 
-    fprintf(config_pm_fh, "$defs{%s} = %s;\n", quoted_sym, quoted_value);
+    fprintf(chaz_CWPerl.fh, "$defs{%s} = %s;\n", quoted_sym, quoted_value);
 
     if (quoted_sym   != sym_buf)   { free(quoted_sym);   }
     if (quoted_value != value_buf) { free(quoted_value); }
@@ -195,11 +197,11 @@ S_ConfWriterPerl_add_local_include(const char *header) {
 
 static void
 S_ConfWriterPerl_start_module(const char *module_name) {
-    fprintf(config_pm_fh, "# %s\n", module_name);
+    fprintf(chaz_CWPerl.fh, "# %s\n", module_name);
 }
 
 static void
 S_ConfWriterPerl_end_module(void) {
-    fprintf(config_pm_fh, "\n");
+    fprintf(chaz_CWPerl.fh, "\n");
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/8b60c97d/charmonizer/src/Charmonizer/Core/ConfWriterRuby.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/ConfWriterRuby.c b/charmonizer/src/Charmonizer/Core/ConfWriterRuby.c
index 99486f1..040b53a 100644
--- a/charmonizer/src/Charmonizer/Core/ConfWriterRuby.c
+++ b/charmonizer/src/Charmonizer/Core/ConfWriterRuby.c
@@ -24,7 +24,9 @@
 #include <string.h>
 
 /* Static vars. */
-static FILE *config_rb_fh  = NULL;
+static struct {
+    FILE *fh;
+} chaz_CWRuby = { NULL };
 static chaz_ConfWriter CWRuby_conf_writer;
 
 /* Open the Charmony.rb file handle.
@@ -67,13 +69,13 @@ chaz_ConfWriterRuby_enable(void) {
 static void
 S_open_config_rb(void) {
     /* Open the filehandle. */
-    config_rb_fh = fopen("Charmony.rb", "w+");
-    if (config_rb_fh == NULL) {
+    chaz_CWRuby.fh = fopen("Charmony.rb", "w+");
+    if (chaz_CWRuby.fh == NULL) {
         chaz_Util_die("Can't open 'Charmony.rb': %s", strerror(errno));
     }
 
     /* Start the module. */
-    fprintf(config_rb_fh,
+    fprintf(chaz_CWRuby.fh,
             "# Auto-generated by Charmonizer. \n"
             "# DO NOT EDIT THIS FILE!!\n"
             "\n"
@@ -89,8 +91,8 @@ S_open_config_rb(void) {
 static void
 S_ConfWriterRuby_clean_up(void) {
     /* Write the last bit of Charmony.rb and close. */
-    fprintf(config_rb_fh, "\nend\n\n");
-    if (fclose(config_rb_fh)) {
+    fprintf(chaz_CWRuby.fh, "\nend\n\n");
+    if (fclose(chaz_CWRuby.fh)) {
         chaz_Util_die("Couldn't close 'Charmony.rb': %s", strerror(errno));
     }
 }
@@ -169,7 +171,7 @@ S_ConfWriterRuby_add_def(const char *sym, const char *value) {
                                                 CFRUBY_MAX_BUF);
     }
 
-    fprintf(config_rb_fh, "defs[%s] = %s\n", quoted_sym, quoted_value);
+    fprintf(chaz_CWRuby.fh, "defs[%s] = %s\n", quoted_sym, quoted_value);
 
     if (quoted_sym   != sym_buf)   { free(quoted_sym);   }
     if (quoted_value != value_buf) { free(quoted_value); }
@@ -193,11 +195,11 @@ S_ConfWriterRuby_add_local_include(const char *header) {
 
 static void
 S_ConfWriterRuby_start_module(const char *module_name) {
-    fprintf(config_rb_fh, "# %s\n", module_name);
+    fprintf(chaz_CWRuby.fh, "# %s\n", module_name);
 }
 
 static void
 S_ConfWriterRuby_end_module(void) {
-    fprintf(config_rb_fh, "\n");
+    fprintf(chaz_CWRuby.fh, "\n");
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/8b60c97d/charmonizer/src/Charmonizer/Core/HeaderChecker.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/HeaderChecker.c b/charmonizer/src/Charmonizer/Core/HeaderChecker.c
index 148943b..1e4c675 100644
--- a/charmonizer/src/Charmonizer/Core/HeaderChecker.c
+++ b/charmonizer/src/Charmonizer/Core/HeaderChecker.c
@@ -21,63 +21,67 @@
 #include <string.h>
 #include <stdlib.h>
 
-typedef struct Header {
+typedef struct chaz_CHeader {
     const char  *name;
-    int  exists;
-} Header;
+    int          exists;
+} chaz_CHeader;
 
 /* Keep a sorted, dynamically-sized array of names of all headers we've
  * checked for so far.
  */
-static int      cache_size   = 0;
-static Header **header_cache = NULL;
+static struct {
+    int            cache_size;
+    chaz_CHeader **header_cache;
+} chaz_HeadCheck = { 0, NULL };
 
 /* Comparison function to feed to qsort, bsearch, etc.
  */
 static int
 S_compare_headers(const void *vptr_a, const void *vptr_b);
 
-/* Run a test compilation and return a new Header object encapsulating the
- * results.
+/* Run a test compilation and return a new chaz_CHeader object encapsulating
+ * the results.
  */
-static Header*
+static chaz_CHeader*
 S_discover_header(const char *header_name);
 
-/* Extend the cache, add this Header object to it, and sort.
+/* Extend the cache, add this chaz_CHeader object to it, and sort.
  */
 static void
-S_add_to_cache(Header *header);
+S_add_to_cache(chaz_CHeader *header);
 
-/* Like add_to_cache, but takes a individual elements instead of a Header* and
- * checks if header exists in array first.
+/* Like add_to_cache, but takes a individual elements instead of a
+ * chaz_CHeader* and checks if header exists in array first.
  */
 static void
 S_maybe_add_to_cache(const char *header_name, int exists);
 
 void
 chaz_HeadCheck_init(void) {
-    Header *null_header = (Header*)malloc(sizeof(Header));
+    chaz_CHeader *null_header = (chaz_CHeader*)malloc(sizeof(chaz_CHeader));
 
-    /* Create terminating record for the dynamic array of Header objects. */
+    /* Create terminating record for the dynamic array of chaz_CHeader
+     * objects. */
     null_header->name   = NULL;
     null_header->exists = false;
-    header_cache = (Header**)malloc(sizeof(void*));
-    *header_cache = null_header;
-    cache_size = 1;
+    chaz_HeadCheck.header_cache    = (chaz_CHeader**)malloc(sizeof(void*));
+    *(chaz_HeadCheck.header_cache) = null_header;
+    chaz_HeadCheck.cache_size = 1;
 }
 
 int
 chaz_HeadCheck_check_header(const char *header_name) {
-    Header  *header;
-    Header   key;
-    Header  *fake = &key;
-    Header **header_ptr;
+    chaz_CHeader  *header;
+    chaz_CHeader   key;
+    chaz_CHeader  *fake = &key;
+    chaz_CHeader **header_ptr;
 
     /* Fake up a key to feed to bsearch; see if the header's already there. */
     key.name = header_name;
     key.exists = false;
-    header_ptr = (Header**)bsearch(&fake, header_cache, cache_size,
-                                   sizeof(void*), S_compare_headers);
+    header_ptr = (chaz_CHeader**)bsearch(&fake, chaz_HeadCheck.header_cache,
+                                         chaz_HeadCheck.cache_size,
+                                         sizeof(void*), S_compare_headers);
 
     /* If it's not there, go try a test compile. */
     if (header_ptr == NULL) {
@@ -147,8 +151,8 @@ chaz_HeadCheck_contains_member(const char *struct_name, const char *member,
 
 static int
 S_compare_headers(const void *vptr_a, const void *vptr_b) {
-    Header *const *const a = (Header*const*)vptr_a;
-    Header *const *const b = (Header*const*)vptr_b;
+    chaz_CHeader *const *const a = (chaz_CHeader*const*)vptr_a;
+    chaz_CHeader *const *const b = (chaz_CHeader*const*)vptr_b;
 
     /* (NULL is "greater than" any string.) */
     if ((*a)->name == NULL)      { return 1; }
@@ -156,10 +160,10 @@ S_compare_headers(const void *vptr_a, const void *vptr_b) {
     else                         { return strcmp((*a)->name, (*b)->name); }
 }
 
-static Header*
+static chaz_CHeader*
 S_discover_header(const char *header_name) {
     static const char test_code[] = "int main() { return 0; }\n";
-    Header* header = (Header*)malloc(sizeof(Header));
+    chaz_CHeader* header = (chaz_CHeader*)malloc(sizeof(chaz_CHeader));
     size_t  needed = strlen(header_name) + sizeof(test_code) + 50;
     char *include_test = (char*)malloc(needed);
 
@@ -175,32 +179,36 @@ S_discover_header(const char *header_name) {
 }
 
 static void
-S_add_to_cache(Header *header) {
+S_add_to_cache(chaz_CHeader *header) {
+    size_t amount;
+
     /* Realloc array -- inefficient, but this isn't a bottleneck. */
-    cache_size++;
-    header_cache = (Header**)realloc(header_cache,
-                                     (cache_size * sizeof(void*)));
-    header_cache[cache_size - 1] = header;
+    amount = ++chaz_HeadCheck.cache_size * sizeof(void*);
+    chaz_HeadCheck.header_cache
+        = (chaz_CHeader**)realloc(chaz_HeadCheck.header_cache, amount);
+    chaz_HeadCheck.header_cache[chaz_HeadCheck.cache_size - 1] = header;
 
     /* Keep the list of headers sorted. */
-    qsort(header_cache, cache_size, sizeof(*header_cache), S_compare_headers);
+    qsort(chaz_HeadCheck.header_cache, chaz_HeadCheck.cache_size,
+          sizeof(*(chaz_HeadCheck.header_cache)), S_compare_headers);
 }
 
 static void
 S_maybe_add_to_cache(const char *header_name, int exists) {
-    Header *header;
-    Header  key;
-    Header *fake = &key;
+    chaz_CHeader *header;
+    chaz_CHeader  key;
+    chaz_CHeader *fake = &key;
 
     /* Fake up a key and bsearch for it. */
     key.name   = header_name;
     key.exists = exists;
-    header = (Header*)bsearch(&fake, header_cache, cache_size,
-                              sizeof(void*), S_compare_headers);
+    header = (chaz_CHeader*)bsearch(&fake, chaz_HeadCheck.header_cache,
+                                    chaz_HeadCheck.cache_size, sizeof(void*),
+                                    S_compare_headers);
 
     /* We've already done the test compile, so skip that step and add it. */
     if (header == NULL) {
-        header = (Header*)malloc(sizeof(Header));
+        header = (chaz_CHeader*)malloc(sizeof(chaz_CHeader));
         header->name   = chaz_Util_strdup(header_name);
         header->exists = exists;
         S_add_to_cache(header);

http://git-wip-us.apache.org/repos/asf/lucy/blob/8b60c97d/charmonizer/src/Charmonizer/Core/OperatingSystem.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/OperatingSystem.c b/charmonizer/src/Charmonizer/Core/OperatingSystem.c
index 0523b9b..fb9ad9b 100644
--- a/charmonizer/src/Charmonizer/Core/OperatingSystem.c
+++ b/charmonizer/src/Charmonizer/Core/OperatingSystem.c
@@ -23,13 +23,15 @@
 #include "Charmonizer/Core/ConfWriter.h"
 #include "Charmonizer/Core/OperatingSystem.h"
 
-static char dev_null[20] = "";
-static char exe_ext[5]   = "";
-static char obj_ext[5]   = "";
-static char local_command_start[3] = "";
-static int  shell_type = 0;
-#define SHELL_TYPE_POSIX    1
-#define SHELL_TYPE_CMD_EXE  2
+static struct {
+    char dev_null[20];
+    char exe_ext[5];
+    char obj_ext[5];
+    char local_command_start[3];
+    int  shell_type;
+} chaz_OS = { "", "", "", "", 0 };
+#define CHAZ_OS_POSIX    1
+#define CHAZ_OS_CMD_EXE  2
 
 void
 chaz_OS_init(void) {
@@ -43,18 +45,18 @@ chaz_OS_init(void) {
 
     /* Detect shell based on whether the bitbucket is "/dev/null" or "nul". */
     if (chaz_Util_can_open_file("/dev/null")) {
-        strcpy(dev_null, "/dev/null");
-        strcpy(exe_ext, "");
-        strcpy(obj_ext, "");
-        strcpy(local_command_start, "./");
-        shell_type = SHELL_TYPE_POSIX;
+        strcpy(chaz_OS.dev_null, "/dev/null");
+        strcpy(chaz_OS.exe_ext, "");
+        strcpy(chaz_OS.obj_ext, "");
+        strcpy(chaz_OS.local_command_start, "./");
+        chaz_OS.shell_type = CHAZ_OS_POSIX;
     }
     else if (chaz_Util_can_open_file("nul")) {
-        strcpy(dev_null, "nul");
-        strcpy(exe_ext, ".exe");
-        strcpy(obj_ext, ".obj");
-        strcpy(local_command_start, ".\\");
-        shell_type = SHELL_TYPE_CMD_EXE;
+        strcpy(chaz_OS.dev_null, "nul");
+        strcpy(chaz_OS.exe_ext, ".exe");
+        strcpy(chaz_OS.obj_ext, ".obj");
+        strcpy(chaz_OS.local_command_start, ".\\");
+        chaz_OS.shell_type = CHAZ_OS_CMD_EXE;
     }
     else {
         /* Bail out because we couldn't find anything like /dev/null. */
@@ -64,17 +66,17 @@ chaz_OS_init(void) {
 
 const char*
 chaz_OS_exe_ext(void) {
-    return exe_ext;
+    return chaz_OS.exe_ext;
 }
 
 const char*
 chaz_OS_obj_ext(void) {
-    return obj_ext;
+    return chaz_OS.obj_ext;
 }
 
 const char*
 chaz_OS_dev_null(void) {
-    return dev_null;
+    return chaz_OS.dev_null;
 }
 
 int
@@ -115,13 +117,13 @@ chaz_OS_remove(const char *name) {
 int
 chaz_OS_run_local(const char *arg1, ...) {
     va_list  args;
-    size_t   len     = strlen(local_command_start) + strlen(arg1);
+    size_t   len     = strlen(chaz_OS.local_command_start) + strlen(arg1);
     char    *command = (char*)malloc(len + 1);
     int      retval;
     char    *arg;
 
     /* Append all supplied texts. */
-    sprintf(command, "%s%s", local_command_start, arg1);
+    sprintf(command, "%s%s", chaz_OS.local_command_start, arg1);
     va_start(args, arg1);
     while (NULL != (arg = va_arg(args, char*))) {
         len += strlen(arg);
@@ -140,14 +142,16 @@ int
 chaz_OS_run_quietly(const char *command) {
     int retval = 1;
     char *quiet_command = NULL;
-    if (shell_type == SHELL_TYPE_POSIX) {
+    if (chaz_OS.shell_type == CHAZ_OS_POSIX) {
         char pattern[] = "%s > %s 2>&1";
-        size_t size
-            = sizeof(pattern) + strlen(command) + strlen(dev_null) + 10;
+        size_t size = sizeof(pattern)
+                      + strlen(command)
+                      + strlen(chaz_OS.dev_null)
+                      + 10;
         quiet_command = (char*)malloc(size);
-        sprintf(quiet_command, pattern, command, dev_null);
+        sprintf(quiet_command, pattern, command, chaz_OS.dev_null);
     }
-    else if (shell_type == SHELL_TYPE_CMD_EXE) {
+    else if (chaz_OS.shell_type == CHAZ_OS_CMD_EXE) {
         char pattern[] = "%s > NUL 2> NUL";
         size_t size = sizeof(pattern) + strlen(command) + 10;
         quiet_command = (char*)malloc(size);
@@ -165,7 +169,9 @@ chaz_OS_run_quietly(const char *command) {
 void
 chaz_OS_mkdir(const char *filepath) {
     char *command = NULL;
-    if (shell_type == SHELL_TYPE_POSIX || shell_type == SHELL_TYPE_CMD_EXE) {
+    if (chaz_OS.shell_type == CHAZ_OS_POSIX
+        || chaz_OS.shell_type == CHAZ_OS_CMD_EXE
+       ) {
         unsigned size = sizeof("mkdir") + 1 + strlen(filepath) + 1;
         command = (char*)malloc(size);
         sprintf(command, "mkdir %s", filepath);
@@ -180,12 +186,12 @@ chaz_OS_mkdir(const char *filepath) {
 void
 chaz_OS_rmdir(const char *filepath) {
     char *command = NULL;
-    if (shell_type == SHELL_TYPE_POSIX) {
+    if (chaz_OS.shell_type == CHAZ_OS_POSIX) {
         unsigned size = strlen("rmdir") + 1 + strlen(filepath) + 1;
         command = (char*)malloc(size);
         sprintf(command, "rmdir %s", filepath);
     }
-    else if (shell_type == SHELL_TYPE_CMD_EXE) {
+    else if (chaz_OS.shell_type == CHAZ_OS_CMD_EXE) {
         unsigned size = strlen("rmdir /q") + 1 + strlen(filepath) + 1;
         command = (char*)malloc(size);
         sprintf(command, "rmdir /q %s", filepath);

http://git-wip-us.apache.org/repos/asf/lucy/blob/8b60c97d/charmonizer/src/Charmonizer/Probe.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Probe.c b/charmonizer/src/Charmonizer/Probe.c
index b0342dc..d1c3152 100644
--- a/charmonizer/src/Charmonizer/Probe.c
+++ b/charmonizer/src/Charmonizer/Probe.c
@@ -62,15 +62,14 @@ chaz_Probe_clean_up(void) {
     if (chaz_Util_verbosity) { printf("Cleanup complete.\n"); }
 }
 
-static const char charm_h_code[] =
-    CHAZ_QUOTE(  #ifndef CHARM_H                                                  )
-    CHAZ_QUOTE(  #define CHARM_H 1                                                )
-    CHAZ_QUOTE(  #include <stdio.h>                                               )
-    CHAZ_QUOTE(  #define Charm_Setup freopen("_charmonizer_target", "w", stdout)  )
-    CHAZ_QUOTE(  #endif                                                           );
-
 static void
 S_write_charm_h(void) {
+    static const char charm_h_code[] =
+        CHAZ_QUOTE(  #ifndef CHARM_H                                                  )
+        CHAZ_QUOTE(  #define CHARM_H 1                                                )
+        CHAZ_QUOTE(  #include <stdio.h>                                               )
+        CHAZ_QUOTE(  #define Charm_Setup freopen("_charmonizer_target", "w", stdout)  )
+        CHAZ_QUOTE(  #endif                                                           );
     chaz_Util_write_file("_charm.h", charm_h_code);
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/8b60c97d/charmonizer/src/Charmonizer/Probe/DirManip.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Probe/DirManip.c b/charmonizer/src/Charmonizer/Probe/DirManip.c
index abc3fa7..1df66e1 100644
--- a/charmonizer/src/Charmonizer/Probe/DirManip.c
+++ b/charmonizer/src/Charmonizer/Probe/DirManip.c
@@ -24,9 +24,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-static int   mkdir_num_args  = 0;
-static char  mkdir_command_buf[7];
-static char *mkdir_command = mkdir_command_buf;
+static struct {
+    int  mkdir_num_args;
+    char mkdir_command[7];
+} chaz_DirManip = { 0, "" };
 
 /* Source code for rmdir. */
 static int
@@ -50,12 +51,12 @@ S_compile_posix_mkdir(const char *header) {
 
     /* Set vars on success. */
     if (mkdir_available) {
-        strcpy(mkdir_command, "mkdir");
+        strcpy(chaz_DirManip.mkdir_command, "mkdir");
         if (strcmp(header, "direct.h") == 0) {
-            mkdir_num_args = 1;
+            chaz_DirManip.mkdir_num_args = 1;
         }
         else {
-            mkdir_num_args = 2;
+            chaz_DirManip.mkdir_num_args = 2;
         }
     }
 
@@ -75,8 +76,8 @@ S_compile_win_mkdir(void) {
 
     mkdir_available = chaz_CC_test_compile(win_mkdir_code);
     if (mkdir_available) {
-        strcpy(mkdir_command, "_mkdir");
-        mkdir_num_args = 1;
+        strcpy(chaz_DirManip.mkdir_command, "_mkdir");
+        chaz_DirManip.mkdir_num_args = 1;
     }
     return mkdir_available;
 }
@@ -116,11 +117,19 @@ S_try_rmdir(void) {
     if (S_compile_rmdir("direct.h"))   { return; }
 }
 
-static const char cygwin_code[] =
-    CHAZ_QUOTE(#ifndef __CYGWIN__            )
-    CHAZ_QUOTE(  #error "Not Cygwin"         )
-    CHAZ_QUOTE(#endif                        )
-    CHAZ_QUOTE(int main() { return 0; }      );
+static int
+chaz_DirManip_is_cygwin(void) {
+    static int is_cygwin = -1;
+    static const char cygwin_code[] =
+        CHAZ_QUOTE(#ifndef __CYGWIN__            )
+        CHAZ_QUOTE(  #error "Not Cygwin"         )
+        CHAZ_QUOTE(#endif                        )
+        CHAZ_QUOTE(int main() { return 0; }      );
+    if (is_cygwin == -1) {
+        is_cygwin = chaz_CC_test_compile(cygwin_code);
+    }
+    return is_cygwin;
+}
 
 void
 chaz_DirManip_run(void) {
@@ -161,28 +170,28 @@ chaz_DirManip_run(void) {
         }
     }
 
-    if (mkdir_num_args == 2) {
+    if (chaz_DirManip.mkdir_num_args == 2) {
         /* It's two args, but the command isn't "mkdir". */
         char scratch[50];
-        if (strlen(mkdir_command) > 30) {
-            chaz_Util_die("Command too long: '%s'", mkdir_command);
+        if (strlen(chaz_DirManip.mkdir_command) > 30) {
+            chaz_Util_die("Command too long: '%s'", chaz_DirManip.mkdir_command);
         }
-        sprintf(scratch, "%s(_dir, _mode)", mkdir_command);
+        sprintf(scratch, "%s(_dir, _mode)", chaz_DirManip.mkdir_command);
         chaz_ConfWriter_add_def("makedir(_dir, _mode)", scratch);
         chaz_ConfWriter_add_def("MAKEDIR_MODE_IGNORED", "0");
     }
-    else if (mkdir_num_args == 1) {
+    else if (chaz_DirManip.mkdir_num_args == 1) {
         /* It's one arg... mode arg will be ignored. */
         char scratch[50];
-        if (strlen(mkdir_command) > 30) {
-            chaz_Util_die("Command too long: '%s'", mkdir_command);
+        if (strlen(chaz_DirManip.mkdir_command) > 30) {
+            chaz_Util_die("Command too long: '%s'", chaz_DirManip.mkdir_command);
         }
-        sprintf(scratch, "%s(_dir)", mkdir_command);
+        sprintf(scratch, "%s(_dir)", chaz_DirManip.mkdir_command);
         chaz_ConfWriter_add_def("makedir(_dir, _mode)", scratch);
         chaz_ConfWriter_add_def("MAKEDIR_MODE_IGNORED", "1");
     }
 
-    if (chaz_CC_test_compile(cygwin_code)) {
+    if (chaz_DirManip_is_cygwin()) {
         strcpy(dir_sep, "/");
     }
     else if (chaz_HeadCheck_check_header("windows.h")) {

http://git-wip-us.apache.org/repos/asf/lucy/blob/8b60c97d/charmonizer/src/Charmonizer/Probe/FuncMacro.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Probe/FuncMacro.c b/charmonizer/src/Charmonizer/Probe/FuncMacro.c
index ac1d16c..69ef04f 100644
--- a/charmonizer/src/Charmonizer/Probe/FuncMacro.c
+++ b/charmonizer/src/Charmonizer/Probe/FuncMacro.c
@@ -22,23 +22,51 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-/* Code for verifying ISO func macro. */
-static const char iso_func_code[] =
-    CHAZ_QUOTE(  #include "_charm.h"               )
-    CHAZ_QUOTE(  int main() {                      )
-    CHAZ_QUOTE(      Charm_Setup;                  )
-    CHAZ_QUOTE(      printf("%s", __func__);       )
-    CHAZ_QUOTE(      return 0;                     )
-    CHAZ_QUOTE(  }                                 );
-
-/* Code for verifying GNU func macro. */
-static const char gnuc_func_code[] =
-    CHAZ_QUOTE(  #include "_charm.h"               )
-    CHAZ_QUOTE(  int main() {                      )
-    CHAZ_QUOTE(      Charm_Setup;                  )
-    CHAZ_QUOTE(      printf("%s", __FUNCTION__);   )
-    CHAZ_QUOTE(      return 0;                     )
-    CHAZ_QUOTE(  }                                 );
+/* Probe for ISO func macro. */
+static int
+chaz_FuncMacro_probe_iso() {
+    static const char iso_func_code[] =
+        CHAZ_QUOTE(  #include "_charm.h"               )
+        CHAZ_QUOTE(  int main() {                      )
+        CHAZ_QUOTE(      Charm_Setup;                  )
+        CHAZ_QUOTE(      printf("%s", __func__);       )
+        CHAZ_QUOTE(      return 0;                     )
+        CHAZ_QUOTE(  }                                 );
+    size_t output_len;
+    char *output;
+    int success = false;
+
+    output = chaz_CC_capture_output(iso_func_code, &output_len);
+    if (output != NULL && strncmp(output, "main", 4) == 0) {
+        success = true;
+    }
+    free(output);
+
+    return success;
+}
+
+static int
+chaz_FuncMacro_probe_gnu() {
+    /* Code for verifying GNU func macro. */
+    static const char gnu_func_code[] =
+        CHAZ_QUOTE(  #include "_charm.h"               )
+        CHAZ_QUOTE(  int main() {                      )
+        CHAZ_QUOTE(      Charm_Setup;                  )
+        CHAZ_QUOTE(      printf("%s", __FUNCTION__);   )
+        CHAZ_QUOTE(      return 0;                     )
+        CHAZ_QUOTE(  }                                 );
+    size_t output_len;
+    char *output;
+    int success = false;
+
+    output = chaz_CC_capture_output(gnu_func_code, &output_len);
+    if (output != NULL && strncmp(output, "main", 4) == 0) {
+        success = true;
+    }
+    free(output);
+
+    return success;
+}
 
 /* Attempt to verify inline keyword. */
 static char*
@@ -56,12 +84,32 @@ S_try_inline(const char *keyword, size_t *output_len) {
     return chaz_CC_capture_output(code, output_len);
 }
 
-static const char* inline_options[] = {
-    "__inline",
-    "__inline__",
-    "inline"
-};
-static int num_inline_options = sizeof(inline_options) / sizeof(void*);
+static void
+chaz_FuncMacro_probe_inline(void) {
+    static const char* inline_options[] = {
+        "__inline",
+        "__inline__",
+        "inline"
+    };
+    const int num_inline_options = sizeof(inline_options) / sizeof(void*);
+    int has_inline = false;
+    int i;
+
+    for (i = 0; i < num_inline_options; i++) {
+        const char *inline_option = inline_options[i];
+        size_t output_len;
+        char *output = S_try_inline(inline_option, &output_len);
+        if (output != NULL) {
+            has_inline = true;
+            chaz_ConfWriter_add_def("INLINE", inline_option);
+            free(output);
+            break;
+        }
+    }
+    if (!has_inline) {
+        chaz_ConfWriter_add_def("INLINE", NULL);
+    }
+}
 
 void
 chaz_FuncMacro_run(void) {
@@ -71,25 +119,18 @@ chaz_FuncMacro_run(void) {
     int has_funcmac      = false;
     int has_iso_funcmac  = false;
     int has_gnuc_funcmac = false;
-    int has_inline       = false;
 
     chaz_ConfWriter_start_module("FuncMacro");
 
-    /* Check for ISO func macro. */
-    output = chaz_CC_capture_output(iso_func_code, &output_len);
-    if (output != NULL && strncmp(output, "main", 4) == 0) {
+    /* Check for func macros. */
+    if (chaz_FuncMacro_probe_iso()) {
         has_funcmac     = true;
         has_iso_funcmac = true;
     }
-    free(output);
-
-    /* Check for GNUC func macro. */
-    output = chaz_CC_capture_output(gnuc_func_code, &output_len);
-    if (output != NULL && strncmp(output, "main", 4) == 0) {
+    if (chaz_FuncMacro_probe_gnu()) {
         has_funcmac      = true;
         has_gnuc_funcmac = true;
     }
-    free(output);
 
     /* Write out common defines. */
     if (has_funcmac) {
@@ -109,20 +150,7 @@ chaz_FuncMacro_run(void) {
     }
 
     /* Check for inline keyword. */
-
-    for (i = 0; i < num_inline_options; i++) {
-        const char *inline_option = inline_options[i];
-        output = S_try_inline(inline_option, &output_len);
-        if (output != NULL) {
-            has_inline = true;
-            chaz_ConfWriter_add_def("INLINE", inline_option);
-            free(output);
-            break;
-        }
-    }
-    if (!has_inline) {
-        chaz_ConfWriter_add_def("INLINE", NULL);
-    }
+    chaz_FuncMacro_probe_inline();
 
     chaz_ConfWriter_end_module();
 }

http://git-wip-us.apache.org/repos/asf/lucy/blob/8b60c97d/charmonizer/src/Charmonizer/Probe/Headers.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Probe/Headers.c b/charmonizer/src/Charmonizer/Probe/Headers.c
index 307956c..75d1d2d 100644
--- a/charmonizer/src/Charmonizer/Probe/Headers.c
+++ b/charmonizer/src/Charmonizer/Probe/Headers.c
@@ -24,10 +24,12 @@
 #include <stdlib.h>
 #include <stdarg.h>
 
-/* Keep track of which headers have succeeded. */
-static int keeper_count = 0;
-#define MAX_KEEPER_COUNT 200
-static const char *keepers[MAX_KEEPER_COUNT + 1] = { NULL };
+#define CHAZ_HEADERS_MAX_KEEPERS 200
+
+static struct {
+    int keeper_count;
+    const char *keepers[CHAZ_HEADERS_MAX_KEEPERS + 1];
+} chaz_Headers = { 0, { NULL } };
 
 /* Add a header to the keepers array.
  */
@@ -40,52 +42,17 @@ S_keep(const char *header_name);
 static void
 S_encode_affirmation(const char *header_name, char *buffer, size_t buf_size);
 
-#define NUM_C89_HEADERS 15
-const char *c89_headers[] = {
-    "assert.h",
-    "ctype.h",
-    "errno.h",
-    "float.h",
-    "limits.h",
-    "locale.h",
-    "math.h",
-    "setjmp.h",
-    "signal.h",
-    "stdarg.h",
-    "stddef.h",
-    "stdio.h",
-    "stdlib.h",
-    "string.h",
-    "time.h",
-    NULL
-};
-
-#define NUM_POSIX_HEADERS 14
-const char *posix_headers[] = {
-    "cpio.h",
-    "dirent.h",
-    "fcntl.h",
-    "grp.h",
-    "pwd.h",
-    "sys/stat.h",
-    "sys/times.h",
-    "sys/types.h",
-    "sys/utsname.h",
-    "sys/wait.h",
-    "tar.h",
-    "termios.h",
-    "unistd.h",
-    "utime.h",
-    NULL
-};
-
-#define NUM_WIN_HEADERS 3
-const char *win_headers[] = {
-    "io.h",
-    "windows.h",
-    "process.h",
-    NULL
-};
+/* Probe for all C89 headers. */
+static void
+chaz_Headers_probe_c89(void);
+
+/* Probe for all POSIX headers. */
+static void
+chaz_Headers_probe_posix(void);
+
+/* Prove for selected Windows headers. */
+static void
+chaz_Headers_probe_win(void);
 
 int
 chaz_Headers_check(const char *header_name) {
@@ -95,62 +62,12 @@ chaz_Headers_check(const char *header_name) {
 void
 chaz_Headers_run(void) {
     int i;
-    int has_posix = false;
-    int has_c89   = false;
-
-    keeper_count = 0;
 
     chaz_ConfWriter_start_module("Headers");
 
-    /* Try for all POSIX headers in one blast. */
-    if (chaz_HeadCheck_check_many_headers((const char**)posix_headers)) {
-        has_posix = true;
-        chaz_ConfWriter_add_def("HAS_POSIX", NULL);
-        for (i = 0; posix_headers[i] != NULL; i++) {
-            S_keep(posix_headers[i]);
-        }
-    }
-    /* Test one-at-a-time. */
-    else {
-        for (i = 0; posix_headers[i] != NULL; i++) {
-            if (chaz_HeadCheck_check_header(posix_headers[i])) {
-                S_keep(posix_headers[i]);
-            }
-        }
-    }
-
-    /* Test for all c89 headers in one blast. */
-    if (chaz_HeadCheck_check_many_headers((const char**)c89_headers)) {
-        has_c89 = true;
-        chaz_ConfWriter_add_def("HAS_C89", NULL);
-        chaz_ConfWriter_add_def("HAS_C90", NULL);
-        for (i = 0; c89_headers[i] != NULL; i++) {
-            S_keep(c89_headers[i]);
-        }
-    }
-    /* Test one-at-a-time. */
-    else {
-        for (i = 0; c89_headers[i] != NULL; i++) {
-            if (chaz_HeadCheck_check_header(c89_headers[i])) {
-                S_keep(c89_headers[i]);
-            }
-        }
-    }
-
-    /* Test for all Windows headers in one blast */
-    if (chaz_HeadCheck_check_many_headers((const char**)win_headers)) {
-        for (i = 0; win_headers[i] != NULL; i++) {
-            S_keep(win_headers[i]);
-        }
-    }
-    /* Test one-at-a-time. */
-    else {
-        for (i = 0; win_headers[i] != NULL; i++) {
-            if (chaz_HeadCheck_check_header(win_headers[i])) {
-                S_keep(win_headers[i]);
-            }
-        }
-    }
+    chaz_Headers_probe_posix();
+    chaz_Headers_probe_c89();
+    chaz_Headers_probe_win();
 
     /* One-offs. */
     if (chaz_HeadCheck_check_header("pthread.h")) {
@@ -158,9 +75,9 @@ chaz_Headers_run(void) {
     }
 
     /* Append the config with every header detected so far. */
-    for (i = 0; keepers[i] != NULL; i++) {
+    for (i = 0; chaz_Headers.keepers[i] != NULL; i++) {
         char aff_buf[200];
-        S_encode_affirmation(keepers[i], aff_buf, 200);
+        S_encode_affirmation(chaz_Headers.keepers[i], aff_buf, 200);
         chaz_ConfWriter_add_def(aff_buf, NULL);
     }
 
@@ -169,11 +86,11 @@ chaz_Headers_run(void) {
 
 static void
 S_keep(const char *header_name) {
-    if (keeper_count >= MAX_KEEPER_COUNT) {
+    if (chaz_Headers.keeper_count >= CHAZ_HEADERS_MAX_KEEPERS) {
         chaz_Util_die("Too many keepers -- increase MAX_KEEPER_COUNT");
     }
-    keepers[keeper_count++] = header_name;
-    keepers[keeper_count]   = NULL;
+    chaz_Headers.keepers[chaz_Headers.keeper_count++] = header_name;
+    chaz_Headers.keepers[chaz_Headers.keeper_count]   = NULL;
 }
 
 static void
@@ -205,5 +122,108 @@ S_encode_affirmation(const char *header_name, char *buffer, size_t buf_size) {
     }
 }
 
+static void
+chaz_Headers_probe_c89(void) {
+    const char *c89_headers[] = {
+        "assert.h",
+        "ctype.h",
+        "errno.h",
+        "float.h",
+        "limits.h",
+        "locale.h",
+        "math.h",
+        "setjmp.h",
+        "signal.h",
+        "stdarg.h",
+        "stddef.h",
+        "stdio.h",
+        "stdlib.h",
+        "string.h",
+        "time.h",
+        NULL
+    };
+    int i;
 
+    /* Test for all c89 headers in one blast. */
+    if (chaz_HeadCheck_check_many_headers((const char**)c89_headers)) {
+        chaz_ConfWriter_add_def("HAS_C89", NULL);
+        chaz_ConfWriter_add_def("HAS_C90", NULL);
+        for (i = 0; c89_headers[i] != NULL; i++) {
+            S_keep(c89_headers[i]);
+        }
+    }
+    /* Test one-at-a-time. */
+    else {
+        for (i = 0; c89_headers[i] != NULL; i++) {
+            if (chaz_HeadCheck_check_header(c89_headers[i])) {
+                S_keep(c89_headers[i]);
+            }
+        }
+    }
+}
+
+static void
+chaz_Headers_probe_posix(void) {
+    const char *posix_headers[] = {
+        "cpio.h",
+        "dirent.h",
+        "fcntl.h",
+        "grp.h",
+        "pwd.h",
+        "sys/stat.h",
+        "sys/times.h",
+        "sys/types.h",
+        "sys/utsname.h",
+        "sys/wait.h",
+        "tar.h",
+        "termios.h",
+        "unistd.h",
+        "utime.h",
+        NULL
+    };
+    int i;
+
+    /* Try for all POSIX headers in one blast. */
+    if (chaz_HeadCheck_check_many_headers((const char**)posix_headers)) {
+        chaz_ConfWriter_add_def("HAS_POSIX", NULL);
+        for (i = 0; posix_headers[i] != NULL; i++) {
+            S_keep(posix_headers[i]);
+        }
+    }
+    /* Test one-at-a-time. */
+    else {
+        for (i = 0; posix_headers[i] != NULL; i++) {
+            if (chaz_HeadCheck_check_header(posix_headers[i])) {
+                S_keep(posix_headers[i]);
+            }
+        }
+    }
+}
+
+
+static void
+chaz_Headers_probe_win(void) {
+    const char *win_headers[] = {
+        "io.h",
+        "windows.h",
+        "process.h",
+        NULL
+    };
+    int i;
+
+    /* Test for all Windows headers in one blast */
+    if (chaz_HeadCheck_check_many_headers((const char**)win_headers)) {
+        for (i = 0; win_headers[i] != NULL; i++) {
+            S_keep(win_headers[i]);
+        }
+    }
+    /* Test one-at-a-time. */
+    else {
+        for (i = 0; win_headers[i] != NULL; i++) {
+            if (chaz_HeadCheck_check_header(win_headers[i])) {
+                S_keep(win_headers[i]);
+            }
+        }
+    }
+}
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/8b60c97d/charmonizer/src/Charmonizer/Probe/Integers.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Probe/Integers.c b/charmonizer/src/Charmonizer/Probe/Integers.c
index 0c8b9ee..11e6fa8 100644
--- a/charmonizer/src/Charmonizer/Probe/Integers.c
+++ b/charmonizer/src/Charmonizer/Probe/Integers.c
@@ -28,7 +28,7 @@
 static int
 S_machine_is_big_endian(void);
 
-static const char sizes_code[] =
+static const char chaz_Integers_sizes_code[] =
     CHAZ_QUOTE(  #include "_charm.h"                       )
     CHAZ_QUOTE(  int main () {                             )
     CHAZ_QUOTE(      Charm_Setup;                          )
@@ -40,7 +40,7 @@ static const char sizes_code[] =
     CHAZ_QUOTE(      return 0;                             )
     CHAZ_QUOTE(  }                                         );
 
-static const char type64_code[] =
+static const char chaz_Integers_type64_code[] =
     CHAZ_QUOTE(  #include "_charm.h"                       )
     CHAZ_QUOTE(  int main()                                )
     CHAZ_QUOTE(  {                                         )
@@ -49,7 +49,7 @@ static const char type64_code[] =
     CHAZ_QUOTE(      return 0;                             )
     CHAZ_QUOTE(  }                                         );
 
-static const char literal64_code[] =
+static const char chaz_Integers_literal64_code[] =
     CHAZ_QUOTE(  #include "_charm.h"                       )
     CHAZ_QUOTE(  #define big 9000000000000000000%s         )
     CHAZ_QUOTE(  int main()                                )
@@ -99,7 +99,7 @@ chaz_Integers_run(void) {
     }
 
     /* Record sizeof() for several common integer types. */
-    output = chaz_CC_capture_output(sizes_code, &output_len);
+    output = chaz_CC_capture_output(chaz_Integers_sizes_code, &output_len);
     if (output != NULL) {
         char *end_ptr = output;
 
@@ -115,7 +115,7 @@ chaz_Integers_run(void) {
     }
 
     /* Determine whether long longs are available. */
-    sprintf(code_buf, type64_code, "long long");
+    sprintf(code_buf, chaz_Integers_type64_code, "long long");
     output = chaz_CC_capture_output(code_buf, &output_len);
     if (output != NULL) {
         has_long_long    = true;
@@ -123,7 +123,7 @@ chaz_Integers_run(void) {
     }
 
     /* Determine whether the __int64 type is available. */
-    sprintf(code_buf, type64_code, "__int64");
+    sprintf(code_buf, chaz_Integers_type64_code, "__int64");
     output = chaz_CC_capture_output(code_buf, &output_len);
     if (output != NULL) {
         has___int64 = true;
@@ -168,13 +168,13 @@ chaz_Integers_run(void) {
         strcpy(u64_t_postfix, "UL");
     }
     else if (has_64) {
-        sprintf(code_buf, literal64_code, "LL");
+        sprintf(code_buf, chaz_Integers_literal64_code, "LL");
         output = chaz_CC_capture_output(code_buf, &output_len);
         if (output != NULL) {
             strcpy(i64_t_postfix, "LL");
         }
         else {
-            sprintf(code_buf, literal64_code, "i64");
+            sprintf(code_buf, chaz_Integers_literal64_code, "i64");
             output = chaz_CC_capture_output(code_buf, &output_len);
             if (output != NULL) {
                 strcpy(i64_t_postfix, "i64");
@@ -183,13 +183,13 @@ chaz_Integers_run(void) {
                 chaz_Util_die("64-bit types, but no literal syntax found");
             }
         }
-        sprintf(code_buf, literal64_code, "ULL");
+        sprintf(code_buf, chaz_Integers_literal64_code, "ULL");
         output = chaz_CC_capture_output(code_buf, &output_len);
         if (output != NULL) {
             strcpy(u64_t_postfix, "ULL");
         }
         else {
-            sprintf(code_buf, literal64_code, "Ui64");
+            sprintf(code_buf, chaz_Integers_literal64_code, "Ui64");
             output = chaz_CC_capture_output(code_buf, &output_len);
             if (output != NULL) {
                 strcpy(u64_t_postfix, "Ui64");

http://git-wip-us.apache.org/repos/asf/lucy/blob/8b60c97d/charmonizer/src/Charmonizer/Probe/LargeFiles.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Probe/LargeFiles.c b/charmonizer/src/Charmonizer/Probe/LargeFiles.c
index 03559d1..b6ece76 100644
--- a/charmonizer/src/Charmonizer/Probe/LargeFiles.c
+++ b/charmonizer/src/Charmonizer/Probe/LargeFiles.c
@@ -24,43 +24,26 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-static const char* off64_options[] = {
-    "off64_t",
-    "off_t",
-    "__int64",
-    "long"
-};
-
-#define NUM_OFF64_OPTIONS (sizeof(off64_options) / sizeof(off64_options[0]))
+/* Module vars. */
+static struct {
+    char off64_type[10];
+} chaz_LargeFiles = { "" };
 
-/* Sets of symbols which might provide large file support. */
-typedef struct stdio64_combo {
+/* Sets of symbols which might provide large file support for stdio. */
+typedef struct chaz_LargeFiles_stdio64_combo {
     const char *includes;
     const char *fopen_command;
     const char *ftell_command;
     const char *fseek_command;
-} stdio64_combo;
-static stdio64_combo stdio64_combos[] = {
-    { "#include <sys/types.h>\n", "fopen64",   "ftello64",  "fseeko64"  },
-    { "#include <sys/types.h>\n", "fopen",     "ftello64",  "fseeko64"  },
-    { "#include <sys/types.h>\n", "fopen",     "ftello",    "fseeko"    },
-    { "",                         "fopen",     "ftell",     "fseek"     },
-    { "",                         "fopen",     "_ftelli64", "_fseeki64" },
-    { "",                         "fopen",     "ftell",     "fseek"     },
-    { NULL, NULL, NULL, NULL }
-};
+} chaz_LargeFiles_stdio64_combo;
 
-typedef struct unbuff_combo {
+/* Sets of symbols which might provide large file support for unbuffered i/o.
+ */
+typedef struct chaz_LargeFiles_unbuff_combo {
     const char *includes;
     const char *lseek_command;
     const char *pread64_command;
-} unbuff_combo;
-static unbuff_combo unbuff_combos[] = {
-    { "#include <unistd.h>\n#include <fcntl.h>\n", "lseek64",   "pread64" },
-    { "#include <unistd.h>\n#include <fcntl.h>\n", "lseek",     "pread"      },
-    { "#include <io.h>\n#include <fcntl.h>\n",     "_lseeki64", "NO_PREAD64" },
-    { NULL, NULL, NULL }
-};
+} chaz_LargeFiles_unbuff_combo;
 
 /* Check for a 64-bit file pointer type.
  */
@@ -69,33 +52,29 @@ S_probe_off64(void);
 
 /* Check what name 64-bit ftell, fseek go by.
  */
+static void
+chaz_LargeFiles_probe_stdio64(void);
 static int
-S_probe_stdio64(stdio64_combo *combo);
+S_probe_stdio64(chaz_LargeFiles_stdio64_combo *combo);
+
+/* Probe for 64-bit unbuffered i/o.
+ */
+static void
+chaz_LargeFiles_probe_unbuff(void);
 
 /* Check for a 64-bit lseek.
  */
 static int
-S_probe_lseek(unbuff_combo *combo);
+S_probe_lseek(chaz_LargeFiles_unbuff_combo *combo);
 
 /* Check for a 64-bit pread.
  */
 static int
-S_probe_pread64(unbuff_combo *combo);
-
-/* Vars for holding lfs commands, once they're discovered. */
-static char fopen_command[10];
-static char fseek_command[10];
-static char ftell_command[10];
-static char lseek_command[10];
-static char pread64_command[10];
-static char off64_type[10];
+S_probe_pread64(chaz_LargeFiles_unbuff_combo *combo);
 
 void
 chaz_LargeFiles_run(void) {
     int found_off64_t = false;
-    int found_stdio64 = false;
-    int found_lseek   = false;
-    int found_pread64 = false;
     unsigned i;
     const char *stat_includes = "#include <stdio.h>\n#include <sys/stat.h>";
 
@@ -105,48 +84,15 @@ chaz_LargeFiles_run(void) {
     found_off64_t = S_probe_off64();
     if (found_off64_t) {
         chaz_ConfWriter_add_def("HAS_64BIT_OFFSET_TYPE", NULL);
-        chaz_ConfWriter_add_def("off64_t",  off64_type);
+        chaz_ConfWriter_add_def("off64_t",  chaz_LargeFiles.off64_type);
     }
 
     /* See if stdio variants with 64-bit support exist. */
-    for (i = 0; stdio64_combos[i].includes != NULL; i++) {
-        stdio64_combo combo = stdio64_combos[i];
-        if (S_probe_stdio64(&combo)) {
-            found_stdio64 = true;
-            chaz_ConfWriter_add_def("HAS_64BIT_STDIO", NULL);
-            strcpy(fopen_command, combo.fopen_command);
-            strcpy(fseek_command, combo.fseek_command);
-            strcpy(ftell_command, combo.ftell_command);
-            chaz_ConfWriter_add_def("fopen64",  fopen_command);
-            chaz_ConfWriter_add_def("ftello64", ftell_command);
-            chaz_ConfWriter_add_def("fseeko64", fseek_command);
-            break;
-        }
-    }
+    chaz_LargeFiles_probe_stdio64();
 
     /* Probe for 64-bit versions of lseek and pread (if we have an off64_t). */
     if (found_off64_t) {
-        for (i = 0; unbuff_combos[i].lseek_command != NULL; i++) {
-            unbuff_combo combo = unbuff_combos[i];
-            found_lseek = S_probe_lseek(&combo);
-            if (found_lseek) {
-                chaz_ConfWriter_add_def("HAS_64BIT_LSEEK", NULL);
-                strcpy(lseek_command, combo.lseek_command);
-                chaz_ConfWriter_add_def("lseek64", lseek_command);
-                break;
-            }
-        }
-        for (i = 0; unbuff_combos[i].pread64_command != NULL; i++) {
-            unbuff_combo combo = unbuff_combos[i];
-            found_pread64 = S_probe_pread64(&combo);
-            if (found_pread64) {
-                chaz_ConfWriter_add_def("HAS_64BIT_PREAD", NULL);
-                strcpy(pread64_command, combo.pread64_command);
-                chaz_ConfWriter_add_def("pread64", pread64_command);
-                found_pread64 = true;
-                break;
-            }
-        }
+        chaz_LargeFiles_probe_unbuff();
     }
 
     /* Make checks needed for testing. */
@@ -169,23 +115,29 @@ chaz_LargeFiles_run(void) {
     chaz_ConfWriter_end_module();
 }
 
-/* Code for finding an off64_t or some other 64-bit signed type. */
-static const char off64_code[] =
-    CHAZ_QUOTE(  %s                                        )
-    CHAZ_QUOTE(  #include "_charm.h"                       )
-    CHAZ_QUOTE(  int main()                                )
-    CHAZ_QUOTE(  {                                         )
-    CHAZ_QUOTE(      Charm_Setup;                          )
-    CHAZ_QUOTE(      printf("%%d", (int)sizeof(%s));       )
-    CHAZ_QUOTE(      return 0;                             )
-    CHAZ_QUOTE(  }                                         );
-
 static const int
 S_probe_off64(void) {
+    static const char off64_code[] =
+        CHAZ_QUOTE(  %s                                        )
+        CHAZ_QUOTE(  #include "_charm.h"                       )
+        CHAZ_QUOTE(  int main()                                )
+        CHAZ_QUOTE(  {                                         )
+        CHAZ_QUOTE(      Charm_Setup;                          )
+        CHAZ_QUOTE(      printf("%%d", (int)sizeof(%s));       )
+        CHAZ_QUOTE(      return 0;                             )
+        CHAZ_QUOTE(  }                                         );
     char code_buf[sizeof(off64_code) + 100];
     int i;
     int success = false;
-    for (i = 0; i < NUM_OFF64_OPTIONS; i++) {
+    static const char* off64_options[] = {
+        "off64_t",
+        "off_t",
+        "__int64",
+        "long"
+    };
+    int num_off64_options = sizeof(off64_options) / sizeof(off64_options[0]);
+
+    for (i = 0; i < num_off64_options; i++) {
         const char *candidate = off64_options[i];
         char *output;
         size_t output_len;
@@ -201,7 +153,7 @@ S_probe_off64(void) {
             long sizeof_candidate = strtol(output, NULL, 10);
             free(output);
             if (sizeof_candidate == 8) {
-                strcpy(off64_type, candidate);
+                strcpy(chaz_LargeFiles.off64_type, candidate);
                 success = true;
                 break;
             }
@@ -210,33 +162,31 @@ S_probe_off64(void) {
     return success;
 }
 
-/* Code for checking ftello64 and friends. */
-static const char stdio64_code[] =
-    CHAZ_QUOTE(  %s                                         )
-    CHAZ_QUOTE(  #include "_charm.h"                        )
-    CHAZ_QUOTE(  int main() {                               )
-    CHAZ_QUOTE(      %s pos;                                )
-    CHAZ_QUOTE(      FILE *f;                               )
-    CHAZ_QUOTE(      Charm_Setup;                           )
-    CHAZ_QUOTE(      f = %s("_charm_stdio64", "w");         )
-    CHAZ_QUOTE(      if (f == NULL) return -1;              )
-    CHAZ_QUOTE(      printf("%%d", (int)sizeof(%s));        )
-    CHAZ_QUOTE(      pos = %s(stdout);                      )
-    CHAZ_QUOTE(      %s(stdout, 0, SEEK_SET);               )
-    CHAZ_QUOTE(      return 0;                              )
-    CHAZ_QUOTE(  }                                          );
-
-
 static int
-S_probe_stdio64(stdio64_combo *combo) {
+S_probe_stdio64(chaz_LargeFiles_stdio64_combo *combo) {
+    static const char stdio64_code[] =
+        CHAZ_QUOTE(  %s                                         )
+        CHAZ_QUOTE(  #include "_charm.h"                        )
+        CHAZ_QUOTE(  int main() {                               )
+        CHAZ_QUOTE(      %s pos;                                )
+        CHAZ_QUOTE(      FILE *f;                               )
+        CHAZ_QUOTE(      Charm_Setup;                           )
+        CHAZ_QUOTE(      f = %s("_charm_stdio64", "w");         )
+        CHAZ_QUOTE(      if (f == NULL) return -1;              )
+        CHAZ_QUOTE(      printf("%%d", (int)sizeof(%s));        )
+        CHAZ_QUOTE(      pos = %s(stdout);                      )
+        CHAZ_QUOTE(      %s(stdout, 0, SEEK_SET);               )
+        CHAZ_QUOTE(      return 0;                              )
+        CHAZ_QUOTE(  }                                          );
     char *output = NULL;
     size_t output_len;
     char code_buf[sizeof(stdio64_code) + 200];
     int success = false;
 
     /* Prepare the source code. */
-    sprintf(code_buf, stdio64_code, combo->includes, off64_type,
-            combo->fopen_command, off64_type, combo->ftell_command,
+    sprintf(code_buf, stdio64_code, combo->includes,
+            chaz_LargeFiles.off64_type, combo->fopen_command,
+            chaz_LargeFiles.off64_type, combo->ftell_command,
             combo->fseek_command);
 
     /* Verify compilation and that the offset type has 8 bytes. */
@@ -256,8 +206,33 @@ S_probe_stdio64(stdio64_combo *combo) {
     return success;
 }
 
+static void
+chaz_LargeFiles_probe_stdio64(void) {
+    int i;
+    static chaz_LargeFiles_stdio64_combo stdio64_combos[] = {
+        { "#include <sys/types.h>\n", "fopen64",   "ftello64",  "fseeko64"  },
+        { "#include <sys/types.h>\n", "fopen",     "ftello64",  "fseeko64"  },
+        { "#include <sys/types.h>\n", "fopen",     "ftello",    "fseeko"    },
+        { "",                         "fopen",     "ftell",     "fseek"     },
+        { "",                         "fopen",     "_ftelli64", "_fseeki64" },
+        { "",                         "fopen",     "ftell",     "fseek"     },
+        { NULL, NULL, NULL, NULL }
+    };
+
+    for (i = 0; stdio64_combos[i].includes != NULL; i++) {
+        chaz_LargeFiles_stdio64_combo combo = stdio64_combos[i];
+        if (S_probe_stdio64(&combo)) {
+            chaz_ConfWriter_add_def("HAS_64BIT_STDIO", NULL);
+            chaz_ConfWriter_add_def("fopen64",  combo.fopen_command);
+            chaz_ConfWriter_add_def("ftello64", combo.ftell_command);
+            chaz_ConfWriter_add_def("fseeko64", combo.fseek_command);
+            break;
+        }
+    }
+}
+
 static int
-S_probe_lseek(unbuff_combo *combo) {
+S_probe_lseek(chaz_LargeFiles_unbuff_combo *combo) {
     static const char lseek_code[] =
         CHAZ_QUOTE( %s                                                       )
         CHAZ_QUOTE( #include "_charm.h"                                      )
@@ -292,7 +267,7 @@ S_probe_lseek(unbuff_combo *combo) {
 }
 
 static int
-S_probe_pread64(unbuff_combo *combo) {
+S_probe_pread64(chaz_LargeFiles_unbuff_combo *combo) {
     /* Code for checking 64-bit pread.  The pread call will fail, but that's
      * fine as long as it compiles. */
     static const char pread64_code[] =
@@ -322,3 +297,31 @@ S_probe_pread64(unbuff_combo *combo) {
     return success;
 }
 
+static void
+chaz_LargeFiles_probe_unbuff(void) {
+    static chaz_LargeFiles_unbuff_combo unbuff_combos[] = {
+        { "#include <unistd.h>\n#include <fcntl.h>\n", "lseek64",   "pread64" },
+        { "#include <unistd.h>\n#include <fcntl.h>\n", "lseek",     "pread"      },
+        { "#include <io.h>\n#include <fcntl.h>\n",     "_lseeki64", "NO_PREAD64" },
+        { NULL, NULL, NULL }
+    };
+    int i;
+
+    for (i = 0; unbuff_combos[i].lseek_command != NULL; i++) {
+        chaz_LargeFiles_unbuff_combo combo = unbuff_combos[i];
+        if (S_probe_lseek(&combo)) {
+            chaz_ConfWriter_add_def("HAS_64BIT_LSEEK", NULL);
+            chaz_ConfWriter_add_def("lseek64", combo.lseek_command);
+            break;
+        }
+    }
+    for (i = 0; unbuff_combos[i].pread64_command != NULL; i++) {
+        chaz_LargeFiles_unbuff_combo combo = unbuff_combos[i];
+        if (S_probe_pread64(&combo)) {
+            chaz_ConfWriter_add_def("HAS_64BIT_PREAD", NULL);
+            chaz_ConfWriter_add_def("pread64", combo.pread64_command);
+            break;
+        }
+    }
+};
+

http://git-wip-us.apache.org/repos/asf/lucy/blob/8b60c97d/charmonizer/src/Charmonizer/Probe/Memory.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Probe/Memory.c b/charmonizer/src/Charmonizer/Probe/Memory.c
index 4b6928f..0d552f6 100644
--- a/charmonizer/src/Charmonizer/Probe/Memory.c
+++ b/charmonizer/src/Charmonizer/Probe/Memory.c
@@ -23,15 +23,27 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-static const char alloca_code[] =
-    "#include <%s>\n"
-    CHAZ_QUOTE(  int main() {                   )
-    CHAZ_QUOTE(      void *foo = %s(1);         )
-    CHAZ_QUOTE(      return 0;                  )
-    CHAZ_QUOTE(  }                              );
+/* Probe for alloca() or equivalent. */
+static void
+chaz_Memory_probe_alloca(void);
 
 void
 chaz_Memory_run(void) {
+    chaz_ConfWriter_start_module("Memory");
+
+    chaz_Memory_probe_alloca();
+
+    chaz_ConfWriter_end_module();
+}
+
+static void
+chaz_Memory_probe_alloca(void) {
+    static const char alloca_code[] =
+        "#include <%s>\n"
+        CHAZ_QUOTE(  int main() {                   )
+        CHAZ_QUOTE(      void *foo = %s(1);         )
+        CHAZ_QUOTE(      return 0;                  )
+        CHAZ_QUOTE(  }                              );
     int has_sys_mman_h = false;
     int has_alloca_h   = false;
     int has_malloc_h   = false;
@@ -41,8 +53,6 @@ chaz_Memory_run(void) {
     int has_underscore_alloca = false;
     char code_buf[sizeof(alloca_code) + 100];
 
-    chaz_ConfWriter_start_module("Memory");
-
     {
         /* OpenBSD needs sys/types.h for sys/mman.h to work and mmap() to be
          * available. Everybody else that has sys/mman.h should have
@@ -103,8 +113,6 @@ chaz_Memory_run(void) {
             chaz_ConfWriter_add_def("chy_alloca", "_alloca");
         }
     }
-
-    chaz_ConfWriter_end_module();
 }
 
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/8b60c97d/charmonizer/src/Charmonizer/Probe/SymbolVisibility.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Probe/SymbolVisibility.c b/charmonizer/src/Charmonizer/Probe/SymbolVisibility.c
index 873bb99..0b2af00 100644
--- a/charmonizer/src/Charmonizer/Probe/SymbolVisibility.c
+++ b/charmonizer/src/Charmonizer/Probe/SymbolVisibility.c
@@ -22,7 +22,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-static const char symbol_exporting_code[] =
+static const char chaz_SymbolVisibility_symbol_exporting_code[] =
     CHAZ_QUOTE(  %s int exported_function() {   )
     CHAZ_QUOTE(      return 42;                 )
     CHAZ_QUOTE(  }                              )
@@ -33,7 +33,7 @@ static const char symbol_exporting_code[] =
 void
 chaz_SymbolVisibility_run(void) {
     int can_control_visibility = false;
-    char code_buf[sizeof(symbol_exporting_code) + 100];
+    char code_buf[sizeof(chaz_SymbolVisibility_symbol_exporting_code) + 100];
 
     chaz_ConfWriter_start_module("SymbolVisibility");
     chaz_CC_set_warnings_as_errors(1);
@@ -41,7 +41,8 @@ chaz_SymbolVisibility_run(void) {
     /* Windows. */
     if (!can_control_visibility) {
         char export_win[] = "__declspec(dllexport)";
-        sprintf(code_buf, symbol_exporting_code, export_win);
+        sprintf(code_buf, chaz_SymbolVisibility_symbol_exporting_code,
+                export_win);
         if (chaz_CC_test_compile(code_buf)) {
             can_control_visibility = true;
             chaz_ConfWriter_add_def("EXPORT", export_win);
@@ -52,7 +53,8 @@ chaz_SymbolVisibility_run(void) {
     /* GCC. */
     if (!can_control_visibility) {
         char export_gcc[] = "__attribute__ ((visibility (\"default\")))";
-        sprintf(code_buf, symbol_exporting_code, export_gcc);
+        sprintf(code_buf, chaz_SymbolVisibility_symbol_exporting_code,
+                export_gcc);
         if (chaz_CC_test_compile(code_buf)) {
             can_control_visibility = true;
             chaz_ConfWriter_add_def("EXPORT", export_gcc);

http://git-wip-us.apache.org/repos/asf/lucy/blob/8b60c97d/charmonizer/src/Charmonizer/Probe/VariadicMacros.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Probe/VariadicMacros.c b/charmonizer/src/Charmonizer/Probe/VariadicMacros.c
index b71d87b..9802273 100644
--- a/charmonizer/src/Charmonizer/Probe/VariadicMacros.c
+++ b/charmonizer/src/Charmonizer/Probe/VariadicMacros.c
@@ -23,7 +23,7 @@
 
 
 /* Code for verifying ISO-style variadic macros. */
-static const char iso_code[] =
+static const char chaz_VariadicMacros_iso_code[] =
     CHAZ_QUOTE(  #include "_charm.h"                                   )
     CHAZ_QUOTE(  #define ISO_TEST(fmt, ...) \\                         )
     "                printf(fmt, __VA_ARGS__)                        \n"
@@ -34,7 +34,7 @@ static const char iso_code[] =
     CHAZ_QUOTE(  }                                                     );
 
 /* Code for verifying GNU-style variadic macros. */
-static const char gnuc_code[] =
+static const char chaz_VariadicMacros_gnuc_code[] =
     CHAZ_QUOTE(  #include "_charm.h"                                   )
     CHAZ_QUOTE(  #define GNU_TEST(fmt, args...) printf(fmt, ##args)    )
     CHAZ_QUOTE(  int main() {                                          )
@@ -54,7 +54,7 @@ chaz_VariadicMacros_run(void) {
     chaz_ConfWriter_start_module("VariadicMacros");
 
     /* Test for ISO-style variadic macros. */
-    output = chaz_CC_capture_output(iso_code, &output_len);
+    output = chaz_CC_capture_output(chaz_VariadicMacros_iso_code, &output_len);
     if (output != NULL) {
         has_varmacros = true;
         has_iso_varmacros = true;
@@ -63,7 +63,7 @@ chaz_VariadicMacros_run(void) {
     }
 
     /* Test for GNU-style variadic macros. */
-    output = chaz_CC_capture_output(gnuc_code, &output_len);
+    output = chaz_CC_capture_output(chaz_VariadicMacros_gnuc_code, &output_len);
     if (output != NULL) {
         has_gnuc_varmacros = true;
         if (has_varmacros == false) {


Mime
View raw message