fixes from review

- Makefile.in: restore iwyu target
- regex_replacer_t::replace_matches(): correct size passed to realloc()
This commit is contained in:
Michael Steed 2015-08-22 19:35:56 -06:00
parent 9ff7477a92
commit ece7f35ec5
2 changed files with 10 additions and 4 deletions

View file

@ -848,6 +848,13 @@ depend:
./config.status ./config.status
.PHONY: depend .PHONY: depend
# Include What You Use
iwyu:
# Requires the --keep-going flag as it always returns 1
# Can't set MAKEFLAGS on a target-specific basic
$(MAKE) -k _iwyu CXX=include-what-you-use
_iwyu: clean $(PROGRAMS)
.PHONY: iwyu _iwyu
# #
# Cleanup targets # Cleanup targets

View file

@ -460,12 +460,11 @@ static const wchar_t *pcre2_strerror(int err_code)
struct compiled_regex_t struct compiled_regex_t
{ {
const wchar_t *argv0;
pcre2_code *code; pcre2_code *code;
pcre2_match_data *match; pcre2_match_data *match;
compiled_regex_t(const wchar_t *argv0_, const wchar_t *pattern, bool ignore_case) compiled_regex_t(const wchar_t *argv0, const wchar_t *pattern, bool ignore_case)
: argv0(argv0_), code(0), match(0) : code(0), match(0)
{ {
// Disable some sequences that can lead to security problems // Disable some sequences that can lead to security problems
uint32_t options = PCRE2_NEVER_UTF; uint32_t options = PCRE2_NEVER_UTF;
@ -885,7 +884,7 @@ public:
{ {
if (outlen < MAX_REPLACE_SIZE) if (outlen < MAX_REPLACE_SIZE)
{ {
outlen = std::max(2 * outlen, MAX_REPLACE_SIZE); outlen = std::min(2 * outlen, MAX_REPLACE_SIZE);
output = (wchar_t *)realloc(output, sizeof(wchar_t) * outlen); output = (wchar_t *)realloc(output, sizeof(wchar_t) * outlen);
if (output == 0) if (output == 0)
{ {