[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 8/9] dfa: change position_set nelem to size_t
From: |
Jim Meyering |
Subject: |
Re: [PATCH 8/9] dfa: change position_set nelem to size_t |
Date: |
Tue, 03 Jan 2012 11:14:10 +0100 |
Paolo Bonzini wrote:
> * src/dfa.c (position_set): Change nelem to a size_t.
> ---
> src/dfa.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/dfa.c b/src/dfa.c
> index 03676b0..491f447 100644
> --- a/src/dfa.c
> +++ b/src/dfa.c
> @@ -246,7 +246,7 @@ typedef struct
> typedef struct
> {
> position *elems; /* Elements of this position set. */
> - int nelem; /* Number of elements in this set. */
> + size_t nelem; /* Number of elements in this set. */
That change induces these new warnings/errors:
dfa.c: In function 'dfaanalyze':
dfa.c:2165:13: error: comparison of unsigned expression >= 0 is always true
[-Werror=type-limits]
dfa.c:2185:13: error: comparison of unsigned expression >= 0 is always true
[-Werror=type-limits]
dfa.c:2294:9: error: comparison of unsigned expression >= 0 is always true
[-Werror=type-limits]
Fortunately, it's easy to avoid those by removing the offending
assertion from REALLOC_IF_NECESSARY. Please squash this into your
change-set:
diff --git a/src/dfa.c b/src/dfa.c
index 491f447..db6058e 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -430,7 +430,6 @@ static void regexp (void);
#define REALLOC_IF_NECESSARY(p, n_alloc, n_required) \
do \
{ \
- assert (0 <= (n_required)); \
if ((n_alloc) <= (n_required)) \
{ \
size_t new_n_alloc = (n_required) + !(p); \
I would have preferred to retain it as long as some n_required
variables are still signed, but if that condition ever becomes false,
we will eventually find out via other means.
- [PATCH 4/9] dfa: use a separate data type for grps, (continued)
- [PATCH 4/9] dfa: use a separate data type for grps, Paolo Bonzini, 2012/01/03
- [PATCH 5/9] dfa: introduce alloc_posset, Paolo Bonzini, 2012/01/03
- [PATCH 6/9] dfa: remove dead assignment, Paolo Bonzini, 2012/01/03
- [PATCH 7/9] dfa: move nalloc to position_set structure, Paolo Bonzini, 2012/01/03
- [PATCH 8/9] dfa: change position_set nelem to size_t, Paolo Bonzini, 2012/01/03
- Re: [PATCH 8/9] dfa: change position_set nelem to size_t,
Jim Meyering <=
- [PATCH 9/9] dfa: automatically resize position_sets, Paolo Bonzini, 2012/01/03