#ifndef EDAPI_ERROR_H #define EDAPI_ERROR_H typedef enum { ed_error_success = 0, ed_error_args, ed_error_invalid, ed_error_internal, ed_error_invalid_json, } EDErrorCode; #define ED_SUCCESS(r) ((r) == ed_error_success) #define ED_ERROR(r) ((r) != ed_error_success) /** * Goes to label l if b is true. */ #define goto_if_true(b, l) do { if (b) goto l; } while(0) /** * Goes to label `l` if r is an error code. */ #define goto_if_error(r, l) do { if (ED_ERROR(r)) goto l; } while(0) #endif