summaryrefslogtreecommitdiff
path: root/src/upb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/upb.c')
-rw-r--r--src/upb.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/upb.c b/src/upb.c
index e82a8e4..e58d272 100644
--- a/src/upb.c
+++ b/src/upb.c
@@ -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);
+ }
+}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback