From 264eb14f837d13affc78b1665cc3ff567aa13d10 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 1 Apr 2016 17:53:57 -0400 Subject: [PATCH] Use a tokenizer for ParseRoomNetConfigFile() because StrBufSipLine() is skipping lines. --- citadel/modules/rssclient/serv_rssclient.c | 1 + citadel/netconfig.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/citadel/modules/rssclient/serv_rssclient.c b/citadel/modules/rssclient/serv_rssclient.c index 4daba9bdd..e482fff07 100644 --- a/citadel/modules/rssclient/serv_rssclient.c +++ b/citadel/modules/rssclient/serv_rssclient.c @@ -793,6 +793,7 @@ void rssclient_scan_room(struct ctdlroom *qrbuf, void *data, OneRoomNetCfg *OneR while (RSSCfg != NULL) { + // syslog(LOG_DEBUG, "\033[32m RSSCfg %s for %s %d \033[0m", ((RSSCfg == NULL) ? "IS NULL" : "IS NOT NULL"), qrbuf->QRname, __LINE__); pthread_mutex_lock(&RSSQueueMutex); GetHash(RSSFetchUrls, SKEY(RSSCfg->Url), diff --git a/citadel/netconfig.c b/citadel/netconfig.c index 239ab731d..94b638bcb 100644 --- a/citadel/netconfig.c +++ b/citadel/netconfig.c @@ -27,6 +27,7 @@ # endif #endif #include +#include #include @@ -57,8 +58,9 @@ void RegisterRoomCfgType(const char* Name, long len, RoomNetCfg eCfg, CfgLinePar pCfg->Str.len = len; pCfg->IsSingleLine = uniq; pCfg->nSegments = nSegments; - if (CfgTypeHash == NULL) + if (CfgTypeHash == NULL) { CfgTypeHash = NewHash(1, NULL); + } Put(CfgTypeHash, Name, len, pCfg, NULL); } @@ -235,12 +237,13 @@ char *LoadRoomNetConfigFile(long roomnum) OneRoomNetCfg *ParseRoomNetConfigFile(char *serialized_data) { const char *Pos = NULL; - const char *CPos = NULL; const CfgLineType *pCfg = NULL; StrBuf *Line = NULL; StrBuf *InStr = NULL; StrBuf *Cfg = NULL; OneRoomNetCfg *OneRNCfg = NULL; + int num_lines = 0; + int i = 0; OneRNCfg = malloc(sizeof(OneRoomNetCfg)); memset(OneRNCfg, 0, sizeof(OneRoomNetCfg)); @@ -248,9 +251,10 @@ OneRoomNetCfg *ParseRoomNetConfigFile(char *serialized_data) Line = NewStrBuf(); InStr = NewStrBuf(); Cfg = NewStrBufPlain(serialized_data, -1); + num_lines = num_tokens(ChrPtr(Cfg), '\n'); - while (StrBufSipLine(Line, Cfg, &CPos)) { - + for (i=0; i 0) { Pos = NULL; StrBufExtract_NextToken(InStr, Line, &Pos, '|'); -- 2.30.2