aboutsummaryrefslogtreecommitdiff
path: root/src/TextFile.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-03 10:16:05 +0100
committerMax Kellermann <max@duempel.org>2013-01-03 10:16:05 +0100
commit90fe4c5124e3fd335f05804d3cc47ba996e62b14 (patch)
treeef7fb6b3cb2edbe4898431db611f04fb281129fc /src/TextFile.cxx
parent2452447c814048ed72e95a459c76b4be65962b5c (diff)
TextFile: convert to a class
Diffstat (limited to 'src/TextFile.cxx')
-rw-r--r--src/TextFile.cxx11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/TextFile.cxx b/src/TextFile.cxx
index ec9c5d44..4ad59ee4 100644
--- a/src/TextFile.cxx
+++ b/src/TextFile.cxx
@@ -24,21 +24,14 @@
#include <string.h>
char *
-read_text_line(FILE *file, GString *buffer)
+TextFile::ReadLine()
{
- enum {
- max_length = 512 * 1024,
- step = 1024,
- };
-
gsize length = 0, i;
char *p;
assert(file != NULL);
assert(buffer != NULL);
-
- if (buffer->allocated_len < step)
- g_string_set_size(buffer, step);
+ assert(buffer->allocated_len >= step);
while (buffer->len < max_length) {
p = fgets(buffer->str + length,