diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-01-11 16:35:19 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-01-11 16:35:19 +0200 |
| commit | 67af2eead2b9424ba311ef208cd45df839c3efbe (patch) | |
| tree | 7eddfb0bf01c5b259f4d96e8630ec141005a965e | |
| parent | 45b3531e29c1b596f1be123de94b7c618c92bf8a (diff) | |
| download | ek-67af2eead2b9424ba311ef208cd45df839c3efbe.tar.gz ek-67af2eead2b9424ba311ef208cd45df839c3efbe.zip | |
fix some analyzer warnings
| -rw-r--r-- | src/actualize.c | 6 | ||||
| -rw-r--r-- | src/ast.c | 12 |
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; @@ -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; |
