Add exception_init and exception_free

This commit is contained in:
Pradana Aumars 2021-06-01 00:58:30 +02:00
parent ea37ce1732
commit 208cb375e1
2 changed files with 21 additions and 0 deletions

View File

@ -1 +1,16 @@
#include <stdlib.h>
#include "exception_t.h" #include "exception_t.h"
exception_t*
exception_init() {
exception_t *e = (exception_t*) malloc(sizeof(exception_t));
e->type = NO_ERROR;
e->msg = NULL;
return e;
}
void
exception_free(exception_t *e) {
free(e);
}

View File

@ -15,6 +15,12 @@ typedef struct exception_t {
char *msg; char *msg;
} exception_t; } exception_t;
exception_t*
exception_init();
void
exception_free(exception_t *e);
char* char*
exception_str(exception_t *e); exception_str(exception_t *e);