Repository: lucy Updated Branches: refs/heads/master 6f6821e83 -> 590fef045
Regenerate charmonizer.c for whitespace fix Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/590fef04 Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/590fef04 Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/590fef04 Branch: refs/heads/master Commit: 590fef0457c020cb6248509e8a5a88ba144e4866 Parents: 6f6821e Author: Nick Wellnhofer <[email protected]> Authored: Fri Sep 5 21:37:22 2014 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Fri Sep 5 21:37:22 2014 +0200 ---------------------------------------------------------------------- common/charmonizer.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/590fef04/common/charmonizer.c ---------------------------------------------------------------------- diff --git a/common/charmonizer.c b/common/charmonizer.c index c18f77f..3e776f8 100644 --- a/common/charmonizer.c +++ b/common/charmonizer.c @@ -4496,6 +4496,7 @@ chaz_Make_list_files(const char *dir, const char *ext, #include <stdarg.h> #include <ctype.h> #include <time.h> +#include <errno.h> /* #include "Charmonizer/Core/Compiler.h" */ /* #include "Charmonizer/Core/Util.h" */ @@ -4948,6 +4949,7 @@ chaz_Util_can_open_file(const char *file_path) { #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <ctype.h> /* #include "Charmonizer/Probe.h" */ /* #include "Charmonizer/Core/HeaderChecker.h" */ /* #include "Charmonizer/Core/ConfWriter.h" */ @@ -5000,11 +5002,30 @@ chaz_Probe_parse_cli_args(int argc, const char *argv[], args->code_coverage = 1; } else if (memcmp(arg, "--cc=", 5) == 0) { - if (strlen(arg) > CHAZ_PROBE_MAX_CC_LEN - 5) { + size_t len = strlen(arg); + size_t l = 5; + size_t r = len; + size_t trimmed_len; + + if (len > CHAZ_PROBE_MAX_CC_LEN - 5) { fprintf(stderr, "Exceeded max length for compiler command"); exit(1); } - strcpy(args->cc, arg + 5); + + /* + * Some Perl setups have a 'cc' config value with leading + * whitespace. + */ + while (isspace(arg[l])) { + ++l; + } + while (r > l && isspace(arg[r-1])) { + --r; + } + + trimmed_len = r - l; + memcpy(args->cc, arg + l, trimmed_len); + args->cc[trimmed_len] = '\0'; } } /* preserve value of i */
