diff options
Diffstat (limited to 'src/upb.c')
-rw-r--r-- | src/upb.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -5,6 +5,7 @@ * */ +#include <stdarg.h> #include <stddef.h> #include "upb.h" @@ -35,3 +36,14 @@ struct upb_type_info upb_type_info[] = { TYPE_INFO(BYTES, UPB_WIRE_TYPE_DELIMITED, struct upb_string*) }; +void upb_seterr(struct upb_status *status, enum upb_status_code code, + const char *msg, ...) +{ + if(upb_ok(status)) { // The first error is the most interesting. + status->code = code; + va_list args; + va_start(args, msg); + vsnprintf(status->msg, UPB_ERRORMSG_MAXLEN, msg, args); + va_end(args); + } +} |