From 8135e1e691f50e1abb33f6ed602679692b322016 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 15 Oct 2012 14:22:37 +0000 Subject: data-streamer.h (bp_pack_string_with_length): New function. 2012-10-15 Richard Biener * data-streamer.h (bp_pack_string_with_length): New function. (bp_pack_string): Likewise. (bp_unpack_indexed_string): Likewise. (bp_unpack_string): Likewise. * data-streamer-out.c (bp_pack_string_with_length): Likewise. (bp_pack_string): Likewise. * data-streamer-in.c (bp_unpack_indexed_string): Likewise. (bp_unpack_string): Likewise. * tree-streamer-out.c (pack_ts_translation_unit_decl_value_fields): Pack TRANSLATION_UNIT_LANGUAGE here, not ... (write_ts_translation_unit_decl_tree_pointers): ... here. Remove. (streamer_pack_tree_bitfields): Adjust. (streamer_write_tree_body): Likewise. * tree-streamer-in.c (unpack_ts_translation_unit_decl_value_fields): Unpack TRANSLATION_UNIT_LANGUAGE here, not ... (lto_input_ts_translation_unit_decl_tree_pointers): ... here. Remove. (unpack_value_fields): Adjust. (streamer_read_tree_body): Likewise. From-SVN: r192460 --- gcc/data-streamer-out.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'gcc/data-streamer-out.c') diff --git a/gcc/data-streamer-out.c b/gcc/data-streamer-out.c index 98cbf22..aae4d47 100644 --- a/gcc/data-streamer-out.c +++ b/gcc/data-streamer-out.c @@ -115,6 +115,39 @@ streamer_write_string (struct output_block *ob, } +/* Output STRING of LEN characters to the string table in OB. Then + put the index into BP. + When PERSISTENT is set, the string S is supposed to not change during + duration of the OB and thus OB can keep pointer into it. */ + +void +bp_pack_string_with_length (struct output_block *ob, struct bitpack_d *bp, + const char *s, unsigned int len, bool persistent) +{ + unsigned index = 0; + if (s) + index = streamer_string_index (ob, s, len, persistent); + bp_pack_var_len_unsigned (bp, index); +} + + +/* Output the '\0' terminated STRING to the string + table in OB. Then put the index onto the bitpack BP. + When PERSISTENT is set, the string S is supposed to not change during + duration of the OB and thus OB can keep pointer into it. */ + +void +bp_pack_string (struct output_block *ob, struct bitpack_d *bp, + const char *s, bool persistent) +{ + unsigned index = 0; + if (s) + index = streamer_string_index (ob, s, strlen (s) + 1, persistent); + bp_pack_var_len_unsigned (bp, index); +} + + + /* Write a zero to the output stream. */ void -- cgit v1.1