X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=server-src%2Finfofile.c;h=6ceca7ef5f39e71bb2eec71a68c2ba71f1944dc1;hb=d3b2175e084f88c8736ad7073eacbf4670147aec;hp=32f86f4123c3dbd69087ee058b3de8a9f7d7d762;hpb=34197d9f46a5f4e944378cbb65fca32ee0eec7b9;p=debian%2Famanda diff --git a/server-src/infofile.c b/server-src/infofile.c index 32f86f4..6ceca7e 100644 --- a/server-src/infofile.c +++ b/server-src/infofile.c @@ -241,10 +241,10 @@ read_txinfofile( amfree(line); return 0; /* normal end of record */ } - else if (strncmp(line,"last_level:",11) == 0) { + else if (strncmp_const(line,"last_level:") == 0) { break; /* normal */ } - else if (strncmp(line,"history:",8) == 0) { + else if (strncmp_const(line,"history:") == 0) { break; /* normal */ } memset(&onestat, 0, SIZEOF(onestat)); @@ -252,13 +252,9 @@ read_txinfofile( s = line; ch = *s++; -#define sc "stats:" - if(strncmp(line, sc, SIZEOF(sc)-1) != 0) { + if(strncmp_const_skip(line, "stats:", s, ch) != 0) { break; } - s += SIZEOF(sc)-1; - ch = s[-1]; -#undef sc skip_whitespace(s, ch); if(ch == '\0' || sscanf((s - 1), "%d", &level) != 1) { @@ -354,14 +350,10 @@ read_txinfofile( s = line; ch = *s++; -#define sc "history:" - if(strncmp(line, sc, SIZEOF(sc)-1) != 0) { + if(strncmp_const_skip(line, "history:", s, ch) != 0) { amfree(line); break; } - s += SIZEOF(sc)-1; - ch = s[-1]; -#undef sc skip_whitespace(s, ch); if(ch == '\0' || sscanf((s - 1), "%d", &onehistory.level) != 1) {