From bda3269a42877ae0a0b2b44b579cba5b13d5b1de Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 12 Sep 2011 16:41:04 -0700 Subject: Fleshed out fielddef default functionality. Fixes unit test submitted by Hunter Morris (thanks!). --- upb/bytestream.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'upb/bytestream.h') diff --git a/upb/bytestream.h b/upb/bytestream.h index 96d840c..6ec1ba6 100644 --- a/upb/bytestream.h +++ b/upb/bytestream.h @@ -160,6 +160,14 @@ INLINE void upb_strref_read(const struct _upb_strref *r, char *buf) { } } +// Dynamically allocates a upb_strref object whose contents are the given +// string. The given string data is copied into the strref, which makes these +// functions unsuitable for tight loops (in those cases a strref should be made +// to point to existing string data). +upb_strref *upb_strref_new(const char *str); +upb_strref *upb_strref_newl(const void *str, size_t len); +void upb_strref_free(upb_strref *ref); + /* upb_bytesink ***************************************************************/ -- cgit v1.2.3