You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2012/06/19 21:40:14 UTC
[lucy-commits] svn commit: r1351817 - in /lucy/trunk/charmonizer/src/Charmonizer: Core/
Probe/
Author: marvin
Date: Tue Jun 19 19:40:14 2012
New Revision: 1351817
URL: http://svn.apache.org/viewvc?rev=1351817&view=rev
Log:
Remove unnecessary string length arguments.
Modified:
lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c
lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.h
lucy/trunk/charmonizer/src/Charmonizer/Core/HeaderChecker.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/AtomicOps.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/FuncMacro.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/SymbolVisibility.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c
Modified: lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c?rev=1351817&r1=1351816&r2=1351817&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c Tue Jun 19 19:40:14 2012
@@ -100,13 +100,13 @@ CC_init(const char *compiler_command, co
strcpy(include_flag, "-I ");
strcpy(object_flag, "-o ");
strcpy(exe_flag, "-o ");
- compile_succeeded = CC_test_compile(code, strlen(code));
+ compile_succeeded = CC_test_compile(code);
if (!compile_succeeded) {
/* Try MSVC argument style. */
strcpy(include_flag, "/I");
strcpy(object_flag, "/Fo");
strcpy(exe_flag, "/Fe");
- compile_succeeded = CC_test_compile(code, strlen(code));
+ compile_succeeded = CC_test_compile(code);
}
if (!compile_succeeded) {
Util_die("Failed to compile a small test file");
@@ -129,7 +129,7 @@ S_detect_macro(const char *macro) {
char *code = (char*)malloc(size);
int retval;
sprintf(code, detect_macro_code, macro);
- retval = CC_test_compile(code, strlen(code));
+ retval = CC_test_compile(code);
free(code);
return retval;
}
@@ -178,7 +178,7 @@ S_inc_dir_string(void) {
int
CC_compile_exe(const char *source_path, const char *exe_name,
- const char *code, size_t code_len) {
+ const char *code) {
const char *exe_ext = OS_exe_ext();
size_t exe_file_buf_size = strlen(exe_name) + strlen(exe_ext) + 1;
char *exe_file = (char*)malloc(exe_file_buf_size);
@@ -196,7 +196,6 @@ CC_compile_exe(const char *source_path,
+ 200; /* command start, _charm_run, etc. */
char *command = (char*)malloc(command_max_size);
int result;
- (void)code_len; /* Unused. */
/* Write the source file. */
Util_write_file(source_path, code);
@@ -239,7 +238,7 @@ CC_compile_exe(const char *source_path,
int
CC_compile_obj(const char *source_path, const char *obj_name,
- const char *code, size_t code_len) {
+ const char *code) {
const char *obj_ext = OS_obj_ext();
size_t obj_file_buf_size = strlen(obj_name) + strlen(obj_ext) + 1;
char *obj_file = (char*)malloc(obj_file_buf_size);
@@ -255,7 +254,6 @@ CC_compile_obj(const char *source_path,
+ 200; /* command start, _charm_run, etc. */
char *command = (char*)malloc(command_max_size);
int result;
- (void)code_len; /* Unused. */
/* Write the source file. */
Util_write_file(source_path, code);
@@ -286,19 +284,19 @@ CC_compile_obj(const char *source_path,
}
int
-CC_test_compile(const char *source, size_t source_len) {
+CC_test_compile(const char *source) {
int compile_succeeded;
if (!Util_remove_and_verify(try_obj_name)) {
Util_die("Failed to delete file '%s'", try_obj_name);
}
compile_succeeded = CC_compile_obj(TRY_SOURCE_PATH, TRY_BASENAME,
- source, source_len);
+ source);
remove(try_obj_name);
return compile_succeeded;
}
char*
-CC_capture_output(const char *source, size_t source_len, size_t *output_len) {
+CC_capture_output(const char *source, size_t *output_len) {
char *captured_output = NULL;
int compile_succeeded;
@@ -312,7 +310,7 @@ CC_capture_output(const char *source, si
/* Attempt compilation; if successful, run app and slurp output. */
compile_succeeded = CC_compile_exe(TRY_SOURCE_PATH, TRY_BASENAME,
- source, source_len);
+ source);
if (compile_succeeded) {
OS_run_local(try_exe_name, NULL);
captured_output = Util_slurp_file(TARGET_PATH, output_len);
Modified: lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.h
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.h?rev=1351817&r1=1351816&r2=1351817&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.h (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.h Tue Jun 19 19:40:14 2012
@@ -32,20 +32,20 @@ extern "C" {
*/
int
chaz_CC_compile_exe(const char *source_path, const char *exe_path,
- const char *code, size_t code_len);
+ const char *code);
/* Attempt to compile an object file. Return true if the object file
* exists after the attempt.
*/
int
chaz_CC_compile_obj(const char *source_path, const char *obj_path,
- const char *code, size_t code_len);
+ const char *code);
/* Attempt to compile the supplied source code and return true if the
* effort succeeds.
*/
int
-chaz_CC_test_compile(const char *source, size_t source_len);
+chaz_CC_test_compile(const char *source);
/* Attempt to compile the supplied source code. If successful, capture the
* output of the program and return a pointer to a newly allocated buffer.
@@ -53,8 +53,7 @@ chaz_CC_test_compile(const char *source,
* output will be placed into the integer pointed to by [output_len].
*/
char*
-chaz_CC_capture_output(const char *source, size_t source_len,
- size_t *output_len);
+chaz_CC_capture_output(const char *source, size_t *output_len);
/* Add an include directory which will be used for all future compilation
* attempts.
Modified: lucy/trunk/charmonizer/src/Charmonizer/Core/HeaderChecker.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Core/HeaderChecker.c?rev=1351817&r1=1351816&r2=1351817&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Core/HeaderChecker.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Core/HeaderChecker.c Tue Jun 19 19:40:14 2012
@@ -118,7 +118,7 @@ HeadCheck_check_many_headers(const char
strcat(code_buf, test_code);
/* If the code compiles, bulk add all header names to the cache. */
- success = CC_test_compile(code_buf, strlen(code_buf));
+ success = CC_test_compile(code_buf);
if (success) {
for (i = 0; header_names[i] != NULL; i++) {
S_maybe_add_to_cache(header_names[i], true);
@@ -145,7 +145,7 @@ HeadCheck_contains_member(const char *st
char *buf = (char*)malloc(needed);
int retval;
sprintf(buf, contains_code, includes, struct_name, member);
- retval = CC_test_compile(buf, strlen(buf));
+ retval = CC_test_compile(buf);
free(buf);
return retval;
}
@@ -172,7 +172,7 @@ S_discover_header(const char *header_nam
/* See whether code that tries to pull in this header compiles. */
sprintf(include_test, "#include <%s>\n%s", header_name, test_code);
- header->exists = CC_test_compile(include_test, strlen(include_test));
+ header->exists = CC_test_compile(include_test);
free(include_test);
return header;
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/AtomicOps.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/AtomicOps.c?rev=1351817&r1=1351816&r2=1351817&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/AtomicOps.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/AtomicOps.c Tue Jun 19 19:40:14 2012
@@ -51,8 +51,7 @@ AtomicOps_run(void) {
/* Check for OSAtomicCompareAndSwapPtr, introduced in later versions
* of OSAtomic.h. */
- has_osatomic_cas_ptr = CC_test_compile(osatomic_casptr_code,
- strlen(osatomic_casptr_code));
+ has_osatomic_cas_ptr = CC_test_compile(osatomic_casptr_code);
if (has_osatomic_cas_ptr) {
ConfWriter_add_def("HAS_OSATOMIC_CAS_PTR", NULL);
}
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.c?rev=1351817&r1=1351816&r2=1351817&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.c Tue Jun 19 19:40:14 2012
@@ -66,7 +66,7 @@ S_compile_posix_mkdir(const char *header
/* Attempt compilation. */
sprintf(code_buf, posix_mkdir_code, header);
- mkdir_available = CC_test_compile(code_buf, strlen(code_buf));
+ mkdir_available = CC_test_compile(code_buf);
/* Set vars on success. */
if (mkdir_available) {
@@ -85,7 +85,7 @@ S_compile_posix_mkdir(const char *header
static int
S_compile_win_mkdir(void) {
- mkdir_available = CC_test_compile(win_mkdir_code, strlen(win_mkdir_code));
+ mkdir_available = CC_test_compile(win_mkdir_code);
if (mkdir_available) {
strcpy(mkdir_command, "_mkdir");
mkdir_num_args = 1;
@@ -107,7 +107,7 @@ S_compile_rmdir(const char *header) {
size_t needed = sizeof(posix_mkdir_code) + 30;
char *code_buf = (char*)malloc(needed);
sprintf(code_buf, rmdir_code, header);
- rmdir_available = CC_test_compile(code_buf, strlen(code_buf));
+ rmdir_available = CC_test_compile(code_buf);
free(code_buf);
return rmdir_available;
}
@@ -185,7 +185,7 @@ DirManip_run(void) {
ConfWriter_add_def("MAKEDIR_MODE_IGNORED", "1");
}
- if (CC_test_compile(cygwin_code, strlen(cygwin_code))) {
+ if (CC_test_compile(cygwin_code)) {
strcpy(dir_sep, "/");
}
else if (HeadCheck_check_header("windows.h")) {
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/FuncMacro.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/FuncMacro.c?rev=1351817&r1=1351816&r2=1351817&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/FuncMacro.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/FuncMacro.c Tue Jun 19 19:40:14 2012
@@ -56,7 +56,7 @@ static char*
S_try_inline(const char *keyword, size_t *output_len) {
char code[sizeof(inline_code) + 30];
sprintf(code, inline_code, keyword);
- return CC_capture_output(code, strlen(code), output_len);
+ return CC_capture_output(code, output_len);
}
static const char* inline_options[] = {
@@ -79,8 +79,7 @@ FuncMacro_run(void) {
ConfWriter_start_module("FuncMacro");
/* Check for ISO func macro. */
- output = CC_capture_output(iso_func_code, strlen(iso_func_code),
- &output_len);
+ output = CC_capture_output(iso_func_code, &output_len);
if (output != NULL && strncmp(output, "main", 4) == 0) {
has_funcmac = true;
has_iso_funcmac = true;
@@ -88,8 +87,7 @@ FuncMacro_run(void) {
free(output);
/* Check for GNUC func macro. */
- output = CC_capture_output(gnuc_func_code, strlen(gnuc_func_code),
- &output_len);
+ output = CC_capture_output(gnuc_func_code, &output_len);
if (output != NULL && strncmp(output, "main", 4) == 0) {
has_funcmac = true;
has_gnuc_funcmac = true;
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c?rev=1351817&r1=1351816&r2=1351817&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c Tue Jun 19 19:40:14 2012
@@ -101,7 +101,7 @@ Integers_run(void) {
}
/* Record sizeof() for several common integer types. */
- output = CC_capture_output(sizes_code, strlen(sizes_code), &output_len);
+ output = CC_capture_output(sizes_code, &output_len);
if (output != NULL) {
char *end_ptr = output;
@@ -118,7 +118,7 @@ Integers_run(void) {
/* Determine whether long longs are available. */
sprintf(code_buf, type64_code, "long long");
- output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
+ output = CC_capture_output(code_buf, &output_len);
if (output != NULL) {
has_long_long = true;
sizeof_long_long = strtol(output, NULL, 10);
@@ -126,7 +126,7 @@ Integers_run(void) {
/* Determine whether the __int64 type is available. */
sprintf(code_buf, type64_code, "__int64");
- output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
+ output = CC_capture_output(code_buf, &output_len);
if (output != NULL) {
has___int64 = true;
sizeof___int64 = strtol(output, NULL, 10);
@@ -171,14 +171,13 @@ Integers_run(void) {
}
else if (has_64) {
sprintf(code_buf, literal64_code, "LL");
- output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
+ output = CC_capture_output(code_buf, &output_len);
if (output != NULL) {
strcpy(i64_t_postfix, "LL");
}
else {
sprintf(code_buf, literal64_code, "i64");
- output = CC_capture_output(code_buf, strlen(code_buf),
- &output_len);
+ output = CC_capture_output(code_buf, &output_len);
if (output != NULL) {
strcpy(i64_t_postfix, "i64");
}
@@ -187,13 +186,13 @@ Integers_run(void) {
}
}
sprintf(code_buf, literal64_code, "ULL");
- output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
+ output = CC_capture_output(code_buf, &output_len);
if (output != NULL) {
strcpy(u64_t_postfix, "ULL");
}
else {
sprintf(code_buf, literal64_code, "Ui64");
- output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
+ output = CC_capture_output(code_buf, &output_len);
if (output != NULL) {
strcpy(u64_t_postfix, "Ui64");
}
@@ -342,8 +341,7 @@ Integers_run(void) {
for (i = 0; options[i] != NULL; i++) {
/* Try to print 2**64-1, and see if we get it back intact. */
sprintf(code_buf, format_64_code, options[i], u64_t_postfix);
- output = CC_capture_output(code_buf, strlen(code_buf),
- &output_len);
+ output = CC_capture_output(code_buf, &output_len);
if (output_len != 0
&& strcmp(output, "18446744073709551615") == 0
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c?rev=1351817&r1=1351816&r2=1351817&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c Tue Jun 19 19:40:14 2012
@@ -199,7 +199,7 @@ S_probe_off64(void) {
/* Execute the probe. */
sprintf(code_buf, off64_code, sys_types_include, candidate);
- output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
+ output = CC_capture_output(code_buf, &output_len);
if (output != NULL) {
long sizeof_candidate = strtol(output, NULL, 10);
free(output);
@@ -250,7 +250,7 @@ S_probe_stdio64(stdio64_combo *combo) {
combo->fseek_command);
/* Verify compilation and that the offset type has 8 bytes. */
- output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
+ output = CC_capture_output(code_buf, &output_len);
if (output != NULL) {
long size = strtol(output, NULL, 10);
if (size == 8) {
@@ -294,7 +294,7 @@ S_probe_lseek(unbuff_combo *combo) {
/* Verify compilation. */
sprintf(code_buf, lseek_code, combo->includes, combo->lseek_command);
- output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
+ output = CC_capture_output(code_buf, &output_len);
if (output != NULL) {
success = true;
free(output);
@@ -335,7 +335,7 @@ S_probe_pread64(unbuff_combo *combo) {
/* Verify compilation. */
sprintf(code_buf, pread64_code, combo->includes, combo->pread64_command);
- output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
+ output = CC_capture_output(code_buf, &output_len);
if (output != NULL) {
success = true;
free(output);
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c?rev=1351817&r1=1351816&r2=1351817&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c Tue Jun 19 19:40:14 2012
@@ -62,7 +62,7 @@ Memory_run(void) {
/* Unixen. */
sprintf(code_buf, alloca_code, "alloca.h", "alloca");
- if (CC_test_compile(code_buf, strlen(code_buf))) {
+ if (CC_test_compile(code_buf)) {
has_alloca_h = true;
has_alloca = true;
ConfWriter_add_def("HAS_ALLOCA_H", NULL);
@@ -70,7 +70,7 @@ Memory_run(void) {
}
if (!has_alloca) {
sprintf(code_buf, alloca_code, "stdlib.h", "alloca");
- if (CC_test_compile(code_buf, strlen(code_buf))) {
+ if (CC_test_compile(code_buf)) {
has_alloca = true;
need_stdlib_h = true;
ConfWriter_add_def("ALLOCA_IN_STDLIB_H", NULL);
@@ -80,7 +80,7 @@ Memory_run(void) {
if (!has_alloca) {
sprintf(code_buf, alloca_code, "stdio.h", /* stdio.h is filler */
"__builtin_alloca");
- if (CC_test_compile(code_buf, strlen(code_buf))) {
+ if (CC_test_compile(code_buf)) {
has_builtin_alloca = true;
ConfWriter_add_def("alloca", "__builtin_alloca");
}
@@ -89,7 +89,7 @@ Memory_run(void) {
/* Windows. */
if (!(has_alloca || has_builtin_alloca)) {
sprintf(code_buf, alloca_code, "malloc.h", "alloca");
- if (CC_test_compile(code_buf, strlen(code_buf))) {
+ if (CC_test_compile(code_buf)) {
has_malloc_h = true;
has_alloca = true;
ConfWriter_add_def("HAS_MALLOC_H", NULL);
@@ -98,7 +98,7 @@ Memory_run(void) {
}
if (!(has_alloca || has_builtin_alloca)) {
sprintf(code_buf, alloca_code, "malloc.h", "_alloca");
- if (CC_test_compile(code_buf, strlen(code_buf))) {
+ if (CC_test_compile(code_buf)) {
has_malloc_h = true;
has_underscore_alloca = true;
ConfWriter_add_def("HAS_MALLOC_H", NULL);
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/SymbolVisibility.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/SymbolVisibility.c?rev=1351817&r1=1351816&r2=1351817&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/SymbolVisibility.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/SymbolVisibility.c Tue Jun 19 19:40:14 2012
@@ -44,7 +44,7 @@ SymbolVisibility_run(void) {
if (!can_control_visibility) {
char export_win[] = "__declspec(dllexport)";
sprintf(code_buf, symbol_exporting_code, export_win);
- if (CC_test_compile(code_buf, strlen(code_buf))) {
+ if (CC_test_compile(code_buf)) {
can_control_visibility = true;
ConfWriter_add_def("EXPORT", export_win);
ConfWriter_add_def("IMPORT", "__declspec(dllimport)");
@@ -55,7 +55,7 @@ SymbolVisibility_run(void) {
if (!can_control_visibility) {
char export_gcc[] = "__attribute__ ((visibility (\"default\")))";
sprintf(code_buf, symbol_exporting_code, export_gcc);
- if (CC_test_compile(code_buf, strlen(code_buf))) {
+ if (CC_test_compile(code_buf)) {
can_control_visibility = true;
ConfWriter_add_def("EXPORT", export_gcc);
ConfWriter_add_def("IMPORT", NULL);
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c?rev=1351817&r1=1351816&r2=1351817&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c Tue Jun 19 19:40:14 2012
@@ -56,7 +56,7 @@ VariadicMacros_run(void) {
ConfWriter_start_module("VariadicMacros");
/* Test for ISO-style variadic macros. */
- output = CC_capture_output(iso_code, strlen(iso_code), &output_len);
+ output = CC_capture_output(iso_code, &output_len);
if (output != NULL) {
has_varmacros = true;
has_iso_varmacros = true;
@@ -65,7 +65,7 @@ VariadicMacros_run(void) {
}
/* Test for GNU-style variadic macros. */
- output = CC_capture_output(gnuc_code, strlen(gnuc_code), &output_len);
+ output = CC_capture_output(gnuc_code, &output_len);
if (output != NULL) {
has_gnuc_varmacros = true;
if (has_varmacros == false) {