From 43aeadaab8c29351e506c03829c3dc74a9f6b86a Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 13 Jan 2021 19:01:49 -0800 Subject: Replaced _exit()s with exits() --- bp.c | 2 +- compiler.c | 2 +- grammar.c | 2 +- utils.c | 4 ++-- utils.h | 2 +- vm.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bp.c b/bp.c index bab03ea..57c8135 100644 --- a/bp.c +++ b/bp.c @@ -80,7 +80,7 @@ static int process_file(def_t *defs, const char *filename, vm_op_t *pattern, uns intern_file(f); match_t *m = match(defs, f, f->contents, pattern, flags); if (m && print_errors(f, m, print_options) > 0) - _exit(1); + exit(1); if (m != NULL && m->end > m->start + 1) { success = 1; diff --git a/compiler.c b/compiler.c index 882acdb..f36a7a4 100644 --- a/compiler.c +++ b/compiler.c @@ -10,7 +10,7 @@ #include "compiler.h" #include "utils.h" -#define file_err(f, ...) do { fprint_line(stderr, f, __VA_ARGS__); _exit(1); } while(0) +#define file_err(f, ...) do { fprint_line(stderr, f, __VA_ARGS__); exit(1); } while(0) __attribute__((nonnull)) static vm_op_t *expand_chain(file_t *f, vm_op_t *first); diff --git a/grammar.c b/grammar.c index 06b2693..3b3d349 100644 --- a/grammar.c +++ b/grammar.c @@ -51,7 +51,7 @@ def_t *load_grammar(def_t *defs, file_t *f) } if (src < f->end) { fprint_line(stderr, f, src, NULL, "Invalid BP pattern"); - _exit(1); + exit(1); } return defs; } diff --git a/utils.c b/utils.c index b3feb86..616255f 100644 --- a/utils.c +++ b/utils.c @@ -194,7 +194,7 @@ void *memcheck(void *p) { if (p == NULL) { fprintf(stderr, "memory allocation failure\n"); - _exit(1); + exit(1); } return p; } @@ -218,7 +218,7 @@ void xfree(void *p) { if (*(void**)p == NULL) { fprintf(stderr, "Attempt to free(NULL)\n"); - _exit(1); + exit(1); } free(*(void**)p); p = NULL; diff --git a/utils.h b/utils.h index aa2fba1..f9d27d4 100644 --- a/utils.h +++ b/utils.h @@ -12,7 +12,7 @@ #define streq(a, b) (strcmp(a, b) == 0) // TODO: better error reporting -#define check(cond, ...) do { if (!(cond)) { fprintf(stderr, __VA_ARGS__); fwrite("\n", 1, 1, stderr); _exit(1); } } while(0) +#define check(cond, ...) do { if (!(cond)) { fprintf(stderr, __VA_ARGS__); fwrite("\n", 1, 1, stderr); exit(1); } } while(0) #define debug(...) do { if (verbose) fprintf(stderr, __VA_ARGS__); } while(0) #define new(t) memcheck(calloc(sizeof(t), 1)) #define xcalloc(a,b) memcheck(calloc(a,b)) diff --git a/vm.c b/vm.c index 9e35334..68c793a 100644 --- a/vm.c +++ b/vm.c @@ -481,7 +481,7 @@ static match_t *_match(def_t *defs, file_t *f, const char *str, vm_op_t *op, uns } default: { fprintf(stderr, "Unknown opcode: %d", op->type); - _exit(1); + exit(1); return NULL; } } -- cgit v1.2.3