#include <string.h>
#include <stdlib.h>
#include <inttypes.h>
-#include "filter-ast.h"
+#include "filter-ast.hpp"
#include "filter-parser.hpp"
-#include "filter-ir.h"
+#include "filter-ir.hpp"
-#include <common/compat/errno.h>
-#include <common/macros.h>
-#include <common/string-utils/string-utils.h>
+#include <common/compat/errno.hpp>
+#include <common/macros.hpp>
+#include <common/string-utils/string-utils.hpp>
static
struct ir_op *generate_ir_recursive(struct filter_parser_ctx *ctx,
{
struct ir_op *op;
- op = (ir_op *) calloc(sizeof(struct ir_op), 1);
+ op = zmalloc<ir_op>();
if (!op)
return NULL;
switch (child->data_type) {
{
struct ir_op *op;
- op = (ir_op *) calloc(sizeof(struct ir_op), 1);
+ op = zmalloc<ir_op>();
if (!op)
return NULL;
op->op = IR_OP_LOAD;
{
struct ir_op *op;
- op = (ir_op *) calloc(sizeof(struct ir_op), 1);
+ op = zmalloc<ir_op>();
if (!op)
return NULL;
op->op = IR_OP_LOAD;
{
struct ir_op *op;
- op = (ir_op *) calloc(sizeof(struct ir_op), 1);
+ op = zmalloc<ir_op>();
if (!op)
return NULL;
op->op = IR_OP_LOAD;
node = load_expression_get_forward_chain(node);
if (!node)
return NULL;
- load_exp = (ir_load_expression *) calloc(sizeof(struct ir_load_expression), 1);
+ load_exp = zmalloc<ir_load_expression>();
if (!load_exp)
return NULL;
/* Root */
- load_exp_op = (ir_load_expression_op *) calloc(sizeof(struct ir_load_expression_op), 1);
+ load_exp_op = zmalloc<ir_load_expression_op>();
if (!load_exp_op)
goto error;
load_exp->child = load_exp_op;
struct filter_node *bracket_node;
prev_op = load_exp_op;
- load_exp_op = (ir_load_expression_op *) calloc(sizeof(struct ir_load_expression_op), 1);
+ load_exp_op = zmalloc<ir_load_expression_op>();
if (!load_exp_op)
goto error;
prev_op->next = load_exp_op;
fprintf(stderr, "[error] Expecting constant index in array expression\n");
goto error;
}
- load_exp_op = (ir_load_expression_op *) calloc(sizeof(struct ir_load_expression_op), 1);
+ load_exp_op = zmalloc<ir_load_expression_op>();
if (!load_exp_op)
goto error;
prev_op->next = load_exp_op;
}
/* Add final load field */
prev_op = load_exp_op;
- load_exp_op = (ir_load_expression_op *) calloc(sizeof(struct ir_load_expression_op), 1);
+ load_exp_op = zmalloc<ir_load_expression_op>();
if (!load_exp_op)
goto error;
prev_op->next = load_exp_op;
{
struct ir_op *op;
- op = (ir_op *) calloc(sizeof(struct ir_op), 1);
+ op = zmalloc<ir_op>();
if (!op)
return NULL;
op->op = IR_OP_LOAD;
goto error;
}
- op = (ir_op *) calloc(sizeof(struct ir_op), 1);
+ op = zmalloc<ir_op>();
if (!op)
return NULL;
op->op = IR_OP_UNARY;
goto error;
}
- op = (ir_op *) calloc(sizeof(struct ir_op), 1);
+ op = zmalloc<ir_op>();
if (!op)
return NULL;
op->op = IR_OP_BINARY;
goto error;
}
- op = (ir_op *) calloc(sizeof(struct ir_op), 1);
+ op = zmalloc<ir_op>();
if (!op)
return NULL;
op->op = IR_OP_LOGICAL;
goto error;
}
- op = (ir_op *) calloc(sizeof(struct ir_op), 1);
+ op = zmalloc<ir_op>();
if (!op)
return NULL;
op->op = IR_OP_BINARY;