[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 6/9] grep: remove one #ifdef
From: |
Paolo Bonzini |
Subject: |
Re: [PATCH 6/9] grep: remove one #ifdef |
Date: |
Fri, 19 Mar 2010 15:54:52 +0100 |
>> -#ifdef EGREP_PROGRAM
>> -# define IF_BK(x, y) (y)
>> - char *n = xmalloc (sizeof word_beg_no_bk - 1 + size + sizeof
>> word_end_no_bk);
>
> Removing this xmalloc and using only the following one, while
> correct, makes the code too fragile for my taste, because
> it would then depend on word_beg_bk having the largest size.
It already does. After my patch, the corruption would be for egrep as
well as grep (while before only for grep), but it's not new.
> Please consider using something like
>
> #define MAX_BUF_SIZE \
> MAX (sizeof line_end_no_bk,
> MAX (sizeof word_beg_no_bk,
> ...
> MAX (sizeof line_end_bk,
> ... , 0)))
>
> and then using "2 * MAX_BUF_SIZE - 1 + size" in the xmalloc call.
Queued.
Paolo
- Re: [PATCH 2/9] grep: remove one #ifdef, (continued)
- [PATCH 3/9] grep: change struct matcher termination, Paolo Bonzini, 2010/03/19
- [PATCH 4/9] grep: make egrep/fgrep use struct matcher, Paolo Bonzini, 2010/03/19
- [PATCH 5/9] grep: eliminate {COMPILE,EXECUTE}_{RET,ARGS,FCT}, Paolo Bonzini, 2010/03/19
- [PATCH 6/9] grep: remove one #ifdef, Paolo Bonzini, 2010/03/19
- [PATCH 8/9] grep: prepare for libification of *search.c, Paolo Bonzini, 2010/03/19
- [PATCH 9/9] grep: libify *search.c, Paolo Bonzini, 2010/03/19
- [PATCH 7/9] grep: split search.c, Paolo Bonzini, 2010/03/19
- Re: [PATCH 0/9] remove most {,E,F}GREP_PROGRAM occurrences, Jim Meyering, 2010/03/19
- Re: [PATCH 0/9] remove most {,E,F}GREP_PROGRAM occurrences, Jim Meyering, 2010/03/19