diff options
Diffstat (limited to '')
-rw-r--r-- | src/TextFile.cxx (renamed from src/text_file.c) | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/text_file.c b/src/TextFile.cxx index 3674e5ce2..4ad59ee4a 100644 --- a/src/text_file.c +++ b/src/TextFile.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2011 The Music Player Daemon Project + * Copyright (C) 2003-2013 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -18,27 +18,20 @@ */ #include "config.h" -#include "text_file.h" +#include "TextFile.hxx" #include <assert.h> #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, |