summaryrefslogtreecommitdiff
path: root/upb/sink.h
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2017-09-25 18:00:12 -0700
committerGitHub <noreply@github.com>2017-09-25 18:00:12 -0700
commitbcb62b7fbfb0c959f7d3671b40c1b7efbb3a4156 (patch)
tree85c6e64d44beb2c970728290c7f88d87c736642e /upb/sink.h
parentae30b4a816a57a8101ce187245edc3050d515c06 (diff)
parent0a9681874ee9ec1e3104b4bdb8e6b2396561ccb6 (diff)
Merge pull request #92 from TeBoring/unknown
Add new "unknown field" handler.
Diffstat (limited to 'upb/sink.h')
-rw-r--r--upb/sink.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/upb/sink.h b/upb/sink.h
index a50bafb..0b98f07 100644
--- a/upb/sink.h
+++ b/upb/sink.h
@@ -315,6 +315,18 @@ UPB_INLINE size_t upb_sink_putstring(upb_sink *s, upb_selector_t sel,
return handler(s->closure, hd, buf, n, handle);
}
+UPB_INLINE bool upb_sink_putunknown(upb_sink *s, const char *buf, size_t n) {
+ typedef upb_unknown_handlerfunc func;
+ func *handler;
+ const void *hd;
+ if (!s->handlers) return true;
+ handler = (func *)upb_handlers_gethandler(s->handlers, UPB_UNKNOWN_SELECTOR);
+
+ if (!handler) return n;
+ hd = upb_handlers_gethandlerdata(s->handlers, UPB_UNKNOWN_SELECTOR);
+ return handler(s->closure, hd, buf, n);
+}
+
UPB_INLINE bool upb_sink_startmsg(upb_sink *s) {
typedef upb_startmsg_handlerfunc func;
func *startmsg;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback