- /* If the buffer is empty, start using it from the beginning. */
- if (buffer->offset == buffer->end)
- {
- buffer->offset = 0;
- buffer->end = 0;
- }
-
- restart:
- /* If there is enough space to store all data, store it now. */
- if (buffer->end + len < buffer->alloc)
- {
- *datap = buffer->buf + buffer->end;
- buffer->end += len;
- return;
- }
-
- /* If the buffer is quite empty, but all data is at the end, move the
- data to the beginning and retry. */
- if (buffer->offset > buffer->alloc / 2)
- {
- memmove(buffer->buf, buffer->buf + buffer->offset,
- buffer->end - buffer->offset);
- buffer->end -= buffer->offset;
- buffer->offset = 0;
- goto restart;
- }
-
- /* Increase the size of the buffer and retry. */
- buffer->alloc += len + 32768;
- buffer->buf = xrealloc(buffer->buf, buffer->alloc);
- goto restart;
+ void *p;
+
+ /* If the buffer is empty, start using it from the beginning. */
+ if (buffer->offset == buffer->end) {
+ buffer->offset = 0;
+ buffer->end = 0;
+ }
+restart:
+ /* If there is enough space to store all data, store it now. */
+ if (buffer->end + len < buffer->alloc) {
+ p = buffer->buf + buffer->end;
+ buffer->end += len;
+ return p;
+ }
+ /*
+ * If the buffer is quite empty, but all data is at the end, move the
+ * data to the beginning and retry.
+ */
+ if (buffer->offset > buffer->alloc / 2) {
+ memmove(buffer->buf, buffer->buf + buffer->offset,
+ buffer->end - buffer->offset);
+ buffer->end -= buffer->offset;
+ buffer->offset = 0;
+ goto restart;
+ }
+ /* Increase the size of the buffer and retry. */
+ buffer->alloc += len + 32768;
+ buffer->buf = xrealloc(buffer->buf, buffer->alloc);
+ goto restart;
+ /* NOTREACHED */