Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / legacy-libs / grpc / deps / grpc / third_party / upb / upb / sink.c
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/sink.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/sink.c
new file mode 100644 (file)
index 0000000..d55d258
--- /dev/null
@@ -0,0 +1,17 @@
+
+#include "upb/sink.h"
+
+bool upb_bufsrc_putbuf(const char *buf, size_t len, upb_bytessink sink) {
+  void *subc;
+  bool ret;
+  upb_bufhandle handle = UPB_BUFHANDLE_INIT;
+  handle.buf = buf;
+  ret = upb_bytessink_start(sink, len, &subc);
+  if (ret && len != 0) {
+    ret = (upb_bytessink_putbuf(sink, subc, buf, len, &handle) >= len);
+  }
+  if (ret) {
+    ret = upb_bytessink_end(sink);
+  }
+  return ret;
+}