configure.in: fix check for code_gen library availability
[barvinok/uuh.git] / section_array.h
blob01f9a9c50201bea3e66057618a11a6197e4a1968
1 #ifndef SECTION_ARRAY_H
2 #define SECTION_ARRAY_H
4 #include <barvinok/evalue.h>
6 #define REALLOCN(ptr,type,n) (type*)realloc(ptr, (n) * sizeof(type))
8 struct evalue_section_array {
9 struct evalue_section *s;
10 int size;
11 int ns;
14 static void evalue_section_array_init(struct evalue_section_array *sections)
16 sections->size = 0;
17 sections->ns = 0;
18 sections->s = NULL;
21 static void evalue_section_array_ensure(struct evalue_section_array *sections,
22 int size)
24 if (size <= sections->size)
25 return;
27 sections->size = size + 32;
28 sections->s = REALLOCN(sections->s, struct evalue_section, sections->size);
31 static void evalue_section_array_add(struct evalue_section_array *sections,
32 Polyhedron *D, evalue *e)
34 sections->s[sections->ns].E = e;
35 sections->s[sections->ns].D = D;
36 ++sections->ns;
39 #endif