diff options
author | Joshua Haberman <joshua@reverberate.org> | 2010-07-09 19:56:58 -0700 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2010-07-09 19:56:58 -0700 |
commit | b04ff41664f45c3c86eea62173a1223ff04d6ad7 (patch) | |
tree | 25e4c47ddcb8cb90c34b397ab1059f730e151100 /src/upb.h | |
parent | be5ddd8a645eaa949a8d500718257fb7cb71cf44 (diff) |
Dynamically allocate string for error msg.
Diffstat (limited to 'src/upb.h')
-rw-r--r-- | src/upb.h | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -281,23 +281,19 @@ enum upb_status_code { UPB_ERROR_MAX_NESTING_EXCEEDED = -3 }; -#define UPB_ERRORMSG_MAXLEN 256 typedef struct { enum upb_status_code code; - char msg[UPB_ERRORMSG_MAXLEN]; + upb_string *str; } upb_status; -#define UPB_STATUS_INIT {UPB_STATUS_OK, ""} +#define UPB_STATUS_INIT {UPB_STATUS_OK, NULL} +#define UPB_ERRORMSG_MAXLEN 256 INLINE bool upb_ok(upb_status *status) { return status->code == UPB_STATUS_OK; } -INLINE void upb_reset(upb_status *status) { - status->code = UPB_STATUS_OK; - status->msg[0] = '\0'; -} - +void upb_reset(upb_status *status); void upb_seterr(upb_status *status, enum upb_status_code code, const char *msg, ...); void upb_copyerr(upb_status *to, upb_status *from); |