summaryrefslogtreecommitdiff
path: root/gcc/data-streamer-in.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-15 17:11:32 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-15 17:11:32 +0000
commit0fb3af46a9812808184394522ff6d65089d3f9bb (patch)
tree4758c5c96ba58a9277e874c67cdf097af9b94edd /gcc/data-streamer-in.c
parentd0d9fa3b225da0716148b9879b699c6014a626c2 (diff)
downloadgcc-0fb3af46a9812808184394522ff6d65089d3f9bb.tar.gz
2012-10-15 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 192465 using svnmerge.py git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@192466 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/data-streamer-in.c')
-rw-r--r--gcc/data-streamer-in.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/data-streamer-in.c b/gcc/data-streamer-in.c
index 72fce0598a7..bcd6c08a691 100644
--- a/gcc/data-streamer-in.c
+++ b/gcc/data-streamer-in.c
@@ -86,6 +86,35 @@ streamer_read_string (struct data_in *data_in, struct lto_input_block *ib)
}
+/* Read a string from the string table in DATA_IN using the bitpack BP.
+ Write the length to RLEN. */
+
+const char *
+bp_unpack_indexed_string (struct data_in *data_in,
+ struct bitpack_d *bp, unsigned int *rlen)
+{
+ return string_for_index (data_in, bp_unpack_var_len_unsigned (bp), rlen);
+}
+
+
+/* Read a NULL terminated string from the string table in DATA_IN. */
+
+const char *
+bp_unpack_string (struct data_in *data_in, struct bitpack_d *bp)
+{
+ unsigned int len;
+ const char *ptr;
+
+ ptr = bp_unpack_indexed_string (data_in, bp, &len);
+ if (!ptr)
+ return NULL;
+ if (ptr[len - 1] != '\0')
+ internal_error ("bytecode stream: found non-null terminated string");
+
+ return ptr;
+}
+
+
/* Read an unsigned HOST_WIDE_INT number from IB. */
unsigned HOST_WIDE_INT