aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/actualize.c6
-rw-r--r--src/ast.c12
2 files changed, 15 insertions, 3 deletions
diff --git a/src/actualize.c b/src/actualize.c
index e17305c..2cb2f7a 100644
--- a/src/actualize.c
+++ b/src/actualize.c
@@ -344,8 +344,8 @@ static int analyze_visibility(struct scope *scope, struct ast *node)
case AST_IMPORT: {
const char *file = import_file(node);
int ret = process_file(&scope,
- (int)ast_flags(node, AST_FLAG_PUBLIC),
- file);
+ (int)ast_flags(node, AST_FLAG_PUBLIC),
+ file);
if (ret == 0)
return 0;
@@ -832,7 +832,7 @@ static int expand_chain(struct ast *expd, struct ast *params,
}
static struct ast *chain_graft(struct ast *exists, struct ast *def,
- struct ast *params, struct type *types)
+ struct ast *params, struct type *types)
{
if (same_src(exists, def))
return exists;
diff --git a/src/ast.c b/src/ast.c
index 5cfafdd..daf393e 100644
--- a/src/ast.c
+++ b/src/ast.c
@@ -76,6 +76,9 @@ static struct ast *create_empty_ast()
}
struct ast *n = calloc(1, sizeof(struct ast));
+ if (!n)
+ return NULL;
+
/* just to be safe */
n->k = AST_EMPTY;
vect_append(struct ast *, nodes, &n);
@@ -89,6 +92,9 @@ static struct type *create_empty_type()
}
struct type *n = calloc(1, sizeof(struct type));
+ if (!n)
+ return NULL;
+
/* just to be safe */
n->k = TYPE_VOID;
n->size = -1;
@@ -393,6 +399,9 @@ struct ast *clone_ast(struct ast *n)
assert(n->k);
struct ast *new = create_empty_ast();
+ if (!new)
+ return NULL;
+
new->scope = n->scope;
new->loc = n->loc;
new->k = n->k;
@@ -435,6 +444,9 @@ struct type *clone_type(struct type *n)
assert(n->k);
struct type *new = create_empty_type();
+ if (!new)
+ return NULL;
+
new->scope = n->scope;
new->loc = n->loc;
new->k = n->k;