diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2005-11-04 17:18:33 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2005-11-04 17:18:33 +0100 |
commit | 92af12daac8a33db8be0b33335bd79330ced9463 (patch) | |
tree | 32416d5ef4b5f96d09905d40c076a368fd275097 /config.h | |
parent | 903e929a85945567e9433b93f03567fe2f3b98fc (diff) | |
download | vdr-92af12daac8a33db8be0b33335bd79330ced9463.tar.gz vdr-92af12daac8a33db8be0b33335bd79330ced9463.tar.bz2 |
cReadLine now dynamically allocates its buffer; changed cConfig::Load() to use cReadLine instead of a fixed buffer
Diffstat (limited to 'config.h')
-rw-r--r-- | config.h | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.233 2005/11/04 14:18:59 kls Exp $ + * $Id: config.h 1.234 2005/11/04 15:55:05 kls Exp $ */ #ifndef __CONFIG_H @@ -102,20 +102,21 @@ public: isyslog("loading %s", fileName); FILE *f = fopen(fileName, "r"); if (f) { + char *s; int line = 0; - char buffer[MAXPARSEBUFFER]; + cReadLine ReadLine; result = true; - while (fgets(buffer, sizeof(buffer), f) > 0) { + while ((s = ReadLine.Read(f)) != NULL) { line++; if (allowComments) { - char *p = strchr(buffer, '#'); + char *p = strchr(s, '#'); if (p) *p = 0; } - stripspace(buffer); - if (!isempty(buffer)) { + stripspace(s); + if (!isempty(s)) { T *l = new T; - if (l->Parse(buffer)) + if (l->Parse(s)) Add(l); else { esyslog("ERROR: error in %s, line %d", fileName, line); |