Make the te_expr struct valid C++ code.

This commit is contained in:
Lewis Van Winkle
2016-08-22 19:06:40 -05:00
parent 860b8ff199
commit 4c1015ab7f
2 changed files with 2 additions and 2 deletions

View File

@@ -66,7 +66,7 @@ typedef struct state {
static te_expr *new_expr(const int type, const te_expr *parameters[]) { static te_expr *new_expr(const int type, const te_expr *parameters[]) {
const int arity = ARITY(type); const int arity = ARITY(type);
const int psize = sizeof(void*) * arity; const int psize = sizeof(void*) * arity;
const int size = sizeof(te_expr) + psize + (IS_CLOSURE(type) ? sizeof(void*) : 0); const int size = (sizeof(te_expr) - sizeof(void*)) + psize + (IS_CLOSURE(type) ? sizeof(void*) : 0);
te_expr *ret = malloc(size); te_expr *ret = malloc(size);
memset(ret, 0, size); memset(ret, 0, size);
if (arity && parameters) { if (arity && parameters) {

View File

@@ -35,7 +35,7 @@ extern "C" {
typedef struct te_expr { typedef struct te_expr {
int type; int type;
union {double value; const double *bound; const void *function;}; union {double value; const double *bound; const void *function;};
void *parameters[]; void *parameters[1];
} te_expr; } te_expr;