You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2013/04/10 14:25:38 UTC

[lucy-commits] [2/2] git commit: refs/heads/master - Regenerate charmonizer.c

Regenerate charmonizer.c


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

Branch: refs/heads/master
Commit: 1af7ab0abafdb3c63c1b57be99bd7fef0035f829
Parents: af6ae92
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Apr 10 14:25:04 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Apr 10 14:25:04 2013 +0200

----------------------------------------------------------------------
 clownfish/compiler/common/charmonizer.c |   32 ++++++++++++++++--------
 clownfish/runtime/common/charmonizer.c  |   34 +++++++++++++++++--------
 common/charmonizer.c                    |   34 +++++++++++++++++--------
 3 files changed, 67 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/1af7ab0a/clownfish/compiler/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/common/charmonizer.c b/clownfish/compiler/common/charmonizer.c
index ed010cc..e6310ac 100644
--- a/clownfish/compiler/common/charmonizer.c
+++ b/clownfish/compiler/common/charmonizer.c
@@ -2717,7 +2717,7 @@ chaz_HeadCheck_check_many_headers(const char **header_names) {
     static const char test_code[] = "int main() { return 0; }\n";
     int success;
     int i;
-    char *code_buf = chaz_Util_strdup("");
+    char *code_buf;
     size_t needed = sizeof(test_code) + 20;
 
     /* Build the source code string. */
@@ -4591,17 +4591,20 @@ chaz_Integers_run(void) {
     /* Record sizeof() for several common integer types. */
     output = chaz_CC_capture_output(chaz_Integers_sizes_code, &output_len);
     if (output != NULL) {
+        char *ptr     = output;
         char *end_ptr = output;
 
-        sizeof_char  = strtol(output, &end_ptr, 10);
-        output       = end_ptr;
-        sizeof_short = strtol(output, &end_ptr, 10);
-        output       = end_ptr;
-        sizeof_int   = strtol(output, &end_ptr, 10);
-        output       = end_ptr;
-        sizeof_long  = strtol(output, &end_ptr, 10);
-        output       = end_ptr;
-        sizeof_ptr   = strtol(output, &end_ptr, 10);
+        sizeof_char  = strtol(ptr, &end_ptr, 10);
+        ptr          = end_ptr;
+        sizeof_short = strtol(ptr, &end_ptr, 10);
+        ptr          = end_ptr;
+        sizeof_int   = strtol(ptr, &end_ptr, 10);
+        ptr          = end_ptr;
+        sizeof_long  = strtol(ptr, &end_ptr, 10);
+        ptr          = end_ptr;
+        sizeof_ptr   = strtol(ptr, &end_ptr, 10);
+
+        free(output);
     }
 
     /* Determine whether long longs are available. */
@@ -4610,6 +4613,7 @@ chaz_Integers_run(void) {
     if (output != NULL) {
         has_long_long    = true;
         sizeof_long_long = strtol(output, NULL, 10);
+        free(output);
     }
 
     /* Determine whether the __int64 type is available. */
@@ -4618,6 +4622,7 @@ chaz_Integers_run(void) {
     if (output != NULL) {
         has___int64 = true;
         sizeof___int64 = strtol(output, NULL, 10);
+        free(output);
     }
 
     /* Figure out which integer types are available. */
@@ -4662,12 +4667,14 @@ chaz_Integers_run(void) {
         output = chaz_CC_capture_output(code_buf, &output_len);
         if (output != NULL) {
             strcpy(i64_t_postfix, "LL");
+            free(output);
         }
         else {
             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");
+                free(output);
             }
             else {
                 chaz_Util_die("64-bit types, but no literal syntax found");
@@ -4677,12 +4684,14 @@ chaz_Integers_run(void) {
         output = chaz_CC_capture_output(code_buf, &output_len);
         if (output != NULL) {
             strcpy(u64_t_postfix, "ULL");
+            free(output);
         }
         else {
             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");
+                free(output);
             }
             else {
                 chaz_Util_die("64-bit types, but no literal syntax found");
@@ -4855,13 +4864,14 @@ chaz_Integers_run(void) {
                 sprintf(code_buf, format_64_code, options[i], u64_t_postfix);
                 output = chaz_CC_capture_output(code_buf, &output_len);
 
-                if (output_len != 0
+                if (output != NULL
                     && strcmp(output, "18446744073709551615") == 0
                    ) {
                     sprintf(scratch, "\"%sd\"", options[i]);
                     chaz_ConfWriter_add_global_def("PRId64", scratch);
                     sprintf(scratch, "\"%su\"", options[i]);
                     chaz_ConfWriter_add_global_def("PRIu64", scratch);
+                    free(output);
                     break;
                 }
             }

http://git-wip-us.apache.org/repos/asf/lucy/blob/1af7ab0a/clownfish/runtime/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/common/charmonizer.c b/clownfish/runtime/common/charmonizer.c
index ad85653..310666e 100644
--- a/clownfish/runtime/common/charmonizer.c
+++ b/clownfish/runtime/common/charmonizer.c
@@ -2996,7 +2996,7 @@ chaz_HeadCheck_check_many_headers(const char **header_names) {
     static const char test_code[] = "int main() { return 0; }\n";
     int success;
     int i;
-    char *code_buf = chaz_Util_strdup("");
+    char *code_buf;
     size_t needed = sizeof(test_code) + 20;
 
     /* Build the source code string. */
@@ -5171,17 +5171,20 @@ chaz_Integers_run(void) {
     /* Record sizeof() for several common integer types. */
     output = chaz_CC_capture_output(chaz_Integers_sizes_code, &output_len);
     if (output != NULL) {
+        char *ptr     = output;
         char *end_ptr = output;
 
-        sizeof_char  = strtol(output, &end_ptr, 10);
-        output       = end_ptr;
-        sizeof_short = strtol(output, &end_ptr, 10);
-        output       = end_ptr;
-        sizeof_int   = strtol(output, &end_ptr, 10);
-        output       = end_ptr;
-        sizeof_long  = strtol(output, &end_ptr, 10);
-        output       = end_ptr;
-        sizeof_ptr   = strtol(output, &end_ptr, 10);
+        sizeof_char  = strtol(ptr, &end_ptr, 10);
+        ptr          = end_ptr;
+        sizeof_short = strtol(ptr, &end_ptr, 10);
+        ptr          = end_ptr;
+        sizeof_int   = strtol(ptr, &end_ptr, 10);
+        ptr          = end_ptr;
+        sizeof_long  = strtol(ptr, &end_ptr, 10);
+        ptr          = end_ptr;
+        sizeof_ptr   = strtol(ptr, &end_ptr, 10);
+
+        free(output);
     }
 
     /* Determine whether long longs are available. */
@@ -5190,6 +5193,7 @@ chaz_Integers_run(void) {
     if (output != NULL) {
         has_long_long    = true;
         sizeof_long_long = strtol(output, NULL, 10);
+        free(output);
     }
 
     /* Determine whether the __int64 type is available. */
@@ -5198,6 +5202,7 @@ chaz_Integers_run(void) {
     if (output != NULL) {
         has___int64 = true;
         sizeof___int64 = strtol(output, NULL, 10);
+        free(output);
     }
 
     /* Figure out which integer types are available. */
@@ -5242,12 +5247,14 @@ chaz_Integers_run(void) {
         output = chaz_CC_capture_output(code_buf, &output_len);
         if (output != NULL) {
             strcpy(i64_t_postfix, "LL");
+            free(output);
         }
         else {
             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");
+                free(output);
             }
             else {
                 chaz_Util_die("64-bit types, but no literal syntax found");
@@ -5257,12 +5264,14 @@ chaz_Integers_run(void) {
         output = chaz_CC_capture_output(code_buf, &output_len);
         if (output != NULL) {
             strcpy(u64_t_postfix, "ULL");
+            free(output);
         }
         else {
             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");
+                free(output);
             }
             else {
                 chaz_Util_die("64-bit types, but no literal syntax found");
@@ -5435,13 +5444,14 @@ chaz_Integers_run(void) {
                 sprintf(code_buf, format_64_code, options[i], u64_t_postfix);
                 output = chaz_CC_capture_output(code_buf, &output_len);
 
-                if (output_len != 0
+                if (output != NULL
                     && strcmp(output, "18446744073709551615") == 0
                    ) {
                     sprintf(scratch, "\"%sd\"", options[i]);
                     chaz_ConfWriter_add_global_def("PRId64", scratch);
                     sprintf(scratch, "\"%su\"", options[i]);
                     chaz_ConfWriter_add_global_def("PRIu64", scratch);
+                    free(output);
                     break;
                 }
             }
@@ -6163,6 +6173,7 @@ chaz_VariadicMacros_run(void) {
         has_iso_varmacros = true;
         chaz_ConfWriter_add_def("HAS_VARIADIC_MACROS", NULL);
         chaz_ConfWriter_add_def("HAS_ISO_VARIADIC_MACROS", NULL);
+        free(output);
     }
 
     /* Test for GNU-style variadic macros. */
@@ -6174,6 +6185,7 @@ chaz_VariadicMacros_run(void) {
             chaz_ConfWriter_add_def("HAS_VARIADIC_MACROS", NULL);
         }
         chaz_ConfWriter_add_def("HAS_GNUC_VARIADIC_MACROS", NULL);
+        free(output);
     }
 
     chaz_ConfWriter_end_module();

http://git-wip-us.apache.org/repos/asf/lucy/blob/1af7ab0a/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/common/charmonizer.c b/common/charmonizer.c
index 20a99b5..c8e4cb8 100644
--- a/common/charmonizer.c
+++ b/common/charmonizer.c
@@ -2996,7 +2996,7 @@ chaz_HeadCheck_check_many_headers(const char **header_names) {
     static const char test_code[] = "int main() { return 0; }\n";
     int success;
     int i;
-    char *code_buf = chaz_Util_strdup("");
+    char *code_buf;
     size_t needed = sizeof(test_code) + 20;
 
     /* Build the source code string. */
@@ -5171,17 +5171,20 @@ chaz_Integers_run(void) {
     /* Record sizeof() for several common integer types. */
     output = chaz_CC_capture_output(chaz_Integers_sizes_code, &output_len);
     if (output != NULL) {
+        char *ptr     = output;
         char *end_ptr = output;
 
-        sizeof_char  = strtol(output, &end_ptr, 10);
-        output       = end_ptr;
-        sizeof_short = strtol(output, &end_ptr, 10);
-        output       = end_ptr;
-        sizeof_int   = strtol(output, &end_ptr, 10);
-        output       = end_ptr;
-        sizeof_long  = strtol(output, &end_ptr, 10);
-        output       = end_ptr;
-        sizeof_ptr   = strtol(output, &end_ptr, 10);
+        sizeof_char  = strtol(ptr, &end_ptr, 10);
+        ptr          = end_ptr;
+        sizeof_short = strtol(ptr, &end_ptr, 10);
+        ptr          = end_ptr;
+        sizeof_int   = strtol(ptr, &end_ptr, 10);
+        ptr          = end_ptr;
+        sizeof_long  = strtol(ptr, &end_ptr, 10);
+        ptr          = end_ptr;
+        sizeof_ptr   = strtol(ptr, &end_ptr, 10);
+
+        free(output);
     }
 
     /* Determine whether long longs are available. */
@@ -5190,6 +5193,7 @@ chaz_Integers_run(void) {
     if (output != NULL) {
         has_long_long    = true;
         sizeof_long_long = strtol(output, NULL, 10);
+        free(output);
     }
 
     /* Determine whether the __int64 type is available. */
@@ -5198,6 +5202,7 @@ chaz_Integers_run(void) {
     if (output != NULL) {
         has___int64 = true;
         sizeof___int64 = strtol(output, NULL, 10);
+        free(output);
     }
 
     /* Figure out which integer types are available. */
@@ -5242,12 +5247,14 @@ chaz_Integers_run(void) {
         output = chaz_CC_capture_output(code_buf, &output_len);
         if (output != NULL) {
             strcpy(i64_t_postfix, "LL");
+            free(output);
         }
         else {
             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");
+                free(output);
             }
             else {
                 chaz_Util_die("64-bit types, but no literal syntax found");
@@ -5257,12 +5264,14 @@ chaz_Integers_run(void) {
         output = chaz_CC_capture_output(code_buf, &output_len);
         if (output != NULL) {
             strcpy(u64_t_postfix, "ULL");
+            free(output);
         }
         else {
             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");
+                free(output);
             }
             else {
                 chaz_Util_die("64-bit types, but no literal syntax found");
@@ -5435,13 +5444,14 @@ chaz_Integers_run(void) {
                 sprintf(code_buf, format_64_code, options[i], u64_t_postfix);
                 output = chaz_CC_capture_output(code_buf, &output_len);
 
-                if (output_len != 0
+                if (output != NULL
                     && strcmp(output, "18446744073709551615") == 0
                    ) {
                     sprintf(scratch, "\"%sd\"", options[i]);
                     chaz_ConfWriter_add_global_def("PRId64", scratch);
                     sprintf(scratch, "\"%su\"", options[i]);
                     chaz_ConfWriter_add_global_def("PRIu64", scratch);
+                    free(output);
                     break;
                 }
             }
@@ -6163,6 +6173,7 @@ chaz_VariadicMacros_run(void) {
         has_iso_varmacros = true;
         chaz_ConfWriter_add_def("HAS_VARIADIC_MACROS", NULL);
         chaz_ConfWriter_add_def("HAS_ISO_VARIADIC_MACROS", NULL);
+        free(output);
     }
 
     /* Test for GNU-style variadic macros. */
@@ -6174,6 +6185,7 @@ chaz_VariadicMacros_run(void) {
             chaz_ConfWriter_add_def("HAS_VARIADIC_MACROS", NULL);
         }
         chaz_ConfWriter_add_def("HAS_GNUC_VARIADIC_MACROS", NULL);
+        free(output);
     }
 
     chaz_ConfWriter_end_module();