-d00febdab0535546ccbf1ef634be1f23b09c8b77
+613e530547549f4220c4571ea913acbe5fa56f72
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
// Read LENGTH bytes from the stream.
-std::string
-Import::read(size_t length)
+void
+Import::read(size_t length, std::string* out)
{
const char* data;
if (!this->stream_->peek(length, &data))
go_error_at(this->location_, "import error at %d: expected %d bytes",
this->stream_->pos(), static_cast<int>(length));
this->stream_->set_saw_error();
- return "";
+ *out = std::string("");
+ return;
}
+ *out = std::string(data, length);
this->advance(length);
- return std::string(data, length);
}
// Turn a string into a integer with appropriate error handling.
get_char()
{ return this->stream_->get_char(); }
- // Read LENGTH characters into a string and advance past them. On
- // EOF reports an error and returns an empty string.
- std::string
- read(size_t length);
+ // Read LENGTH characters into *OUT and advance past them. On
+ // EOF reports an error and sets *OUT to an empty string.
+ void
+ read(size_t length, std::string* out);
// Return true at the end of the stream.
bool