diff options
author | Tobias Grosser <tobias@grosser.es> | 2011-06-07 16:15:15 -0300 |
---|---|---|
committer | Sven Verdoolaege <skimo@kotnet.org> | 2011-06-07 21:40:24 +0200 |
commit | 157122e88673001b08d01e4ffed7a833b2d5c0b2 (patch) | |
tree | 112416588897017042016996145a7ca521cb783c /isl_polynomial.c | |
parent | adc3b3f624f1ce6362df58c3710e2ac116a39873 (diff) | |
download | isl-157122e88673001b08d01e4ffed7a833b2d5c0b2.tar.gz isl-157122e88673001b08d01e4ffed7a833b2d5c0b2.tar.bz2 isl-157122e88673001b08d01e4ffed7a833b2d5c0b2.zip |
Check the ctx argument of the memory macros
Isl defines its own set of memory management macros. These macros currently
expect an isl_ctx*, but do not yet actively use it. Hence, it is possible to
pass a random string to these macros, without the compiler issuing any warnings.
And in case an isl_ctx* is passed, the compiler does not count the macro call
as a valid use, which may lead to some unexpected 'variable never used'
warnings.
We solve this, by adding a compile time check that always verifies that ctx has
the type isl_ctx*. This is also a valid use of ctx and consequently stops the
'variable never used' warnings. The check itself is designed such that it will
be optimized out during compilation.
While at this fix all cases, where some invalid structures were passed to the
memory location macros instead of an valid isl_ctx*.
Signed-off-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Diffstat (limited to 'isl_polynomial.c')
-rw-r--r-- | isl_polynomial.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/isl_polynomial.c b/isl_polynomial.c index 6f3be323..7eae4f88 100644 --- a/isl_polynomial.c +++ b/isl_polynomial.c @@ -2204,6 +2204,7 @@ static __isl_give isl_qpolynomial *remove_redundant_divs( int *reordering = NULL; int redundant = 0; int n_div; + isl_ctx *ctx; if (!qp) return NULL; @@ -2212,7 +2213,8 @@ static __isl_give isl_qpolynomial *remove_redundant_divs( d = isl_dim_total(qp->dim); len = qp->div->n_col - 2; - active = isl_calloc_array(qp->ctx, int, len); + ctx = isl_qpolynomial_get_ctx(qp); + active = isl_calloc_array(ctx, int, len); if (!active) goto error; |