X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fciniparser%2Fciniparser.c;h=527f83776e86428c5e283b76211291445ae7b4f9;hb=8cb4a3ed3d44fa4f85e176aaeaaf1da1d6eab5b6;hp=dceb22f55f7d10f55de10c4dcaadbf36f59ec224;hpb=3c81225fc0a4fb99d10282ebf11b7ec6ae1eabdd;p=ccan diff --git a/ccan/ciniparser/ciniparser.c b/ccan/ciniparser/ciniparser.c index dceb22f5..527f8377 100644 --- a/ccan/ciniparser/ciniparser.c +++ b/ccan/ciniparser/ciniparser.c @@ -33,7 +33,7 @@ */ #include -#include "ciniparser.h" +#include #define ASCIILINESZ (1024) #define INI_INVALID_KEY ((char*) NULL) @@ -128,7 +128,6 @@ line_status ciniparser_line(char *input_line, char *section, strcpy(line, strstrip(input_line)); len = (int) strlen(line); - sta = LINE_UNPROCESSED; if (len < 1) { /* Empty line */ sta = LINE_EMPTY; @@ -317,7 +316,7 @@ int ciniparser_getint(dictionary *d, const char *key, int notfound) return (int) strtol(str, NULL, 10); } -double ciniparser_getdouble(dictionary *d, char *key, double notfound) +double ciniparser_getdouble(dictionary *d, const char *key, double notfound) { char *str; @@ -424,12 +423,10 @@ dictionary *ciniparser_load(const char *ininame) } /* Detect multi-line */ - if (line[len] == '\\') { + if (len >= 0 && line[len] == '\\') { /* Multi-line value */ last = len; continue; - } else { - last = 0; } switch (ciniparser_line(line, section, key, val)) {