diff --git a/cfg.mk b/cfg.mk index 010de34..e8c2aa6 100644 --- a/cfg.mk +++ b/cfg.mk @@ -369,7 +369,7 @@ static-analysis: static-analysis-init static-analysis-config \ static-analysis-make ASAN_FLAGS=-fsanitize=address -fno-omit-frame-pointer -ASAN_CFLAGS=-O0 -g -Dlint $(ASAN_FLAGS) +ASAN_CFLAGS=-O0 -g -DPACIFY_LSAN $(ASAN_FLAGS) ASAN_LDFLAGS=$(ASAN_FLAGS) .PHONY: build-asan diff --git a/sed/compile.c b/sed/compile.c index 29162ed..055ccf2 100644 --- a/sed/compile.c +++ b/sed/compile.c @@ -658,7 +658,9 @@ setup_replacement (struct subst *sub, const char *text, idx_t length) base = xmemdup (text, length); length = normalize_text (base, length, TEXT_REPLACEMENT); - IF_LINT (sub->replacement_buffer = base); +#ifdef PACIFY_LSAN + sub->replacement_buffer = base; +#endif text_end = base + length; tail = &root; @@ -1562,7 +1564,7 @@ finish_program (struct vector *program) file_read = file_write = NULL; } -#ifdef lint +#ifdef PACIFY_LSAN for (idx_t i = 0; i < program->v_length; ++i) { const struct sed_cmd *sc = &program->v[i]; @@ -1585,6 +1587,6 @@ finish_program (struct vector *program) obstack_free (&obs, NULL); #else (void)program; -#endif /* lint */ +#endif } diff --git a/sed/execute.c b/sed/execute.c index 7b7186a..734d475 100644 --- a/sed/execute.c +++ b/sed/execute.c @@ -1599,7 +1599,7 @@ process_files (struct vector *the_program, char **argv) } closedown (&input); -#ifdef lint +#ifdef PACIFY_LSAN /* We're about to exit, so these free()s are redundant. But if we're running under a memory-leak detecting implementation of malloc(), we want to explicitly @@ -1610,7 +1610,7 @@ process_files (struct vector *the_program, char **argv) free (hold.text); free (line.text); free (s_accum.text); -#endif /* lint */ +#endif if (input.bad_count) status = EXIT_BAD_INPUT; diff --git a/sed/regexp.c b/sed/regexp.c index 31c6759..9280ffd 100644 --- a/sed/regexp.c +++ b/sed/regexp.c @@ -347,7 +347,7 @@ match_regex (struct regex *regex, char *buf, idx_t buflen, } -#ifdef lint +#ifdef PACIFY_LSAN void release_regex (struct regex *regex) { @@ -360,4 +360,4 @@ release_regex (struct regex *regex) regfree (®ex->pattern); free (regex); } -#endif /* lint */ +#endif diff --git a/sed/sed.c b/sed/sed.c index dbfa781..3155dab 100644 --- a/sed/sed.c +++ b/sed/sed.c @@ -91,7 +91,9 @@ struct localeinfo localeinfo; static void cleanup (void) { - IF_LINT (free (in_place_extension)); +#ifdef PACIFY_LSAN + free (in_place_extension); +#endif remove_cleanup_file (); } @@ -280,7 +282,9 @@ main (int argc, char **argv) case 'i': separate_files = true; - IF_LINT (free (in_place_extension)); +#ifdef PACIFY_LSAN + free (in_place_extension); +#endif if (optarg == NULL) /* use no backups */ in_place_extension = xstrdup ("*"); diff --git a/sed/sed.h b/sed/sed.h index e76a108..a520955 100644 --- a/sed/sed.h +++ b/sed/sed.h @@ -139,8 +139,8 @@ struct subst { unsigned print : 2; /* 'p' option given (before/after eval) */ unsigned eval : 1; /* 'e' option given */ unsigned max_id : 4; /* maximum backreference on the RHS */ -#ifdef lint - char* replacement_buffer; +#ifdef PACIFY_LSAN + char *replacement_buffer; #endif }; @@ -236,9 +236,7 @@ struct regex *compile_regex (struct buffer *b, int flags, int needed_sub); int match_regex (struct regex *regex, char *buf, idx_t buflen, idx_t buf_start_offset, struct re_registers *regarray, int regsize); -#ifdef lint void release_regex (struct regex *); -#endif void debug_print_command (const struct vector *program, const struct sed_cmd *sc); diff --git a/sed/utils.c b/sed/utils.c index 28aa538..c3cd293 100644 --- a/sed/utils.c +++ b/sed/utils.c @@ -74,7 +74,7 @@ panic (const char *str, ...) va_end (ap); putc ('\n', stderr); -#ifdef lint +#ifdef PACIFY_LSAN while (open_files) { struct open_file *next = open_files->link;