X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=util.c;h=09f18171cede5399a020610050b9f202dd476ee7;hp=ce7d849855fe39b5b3b1caf3a683fac4b05e3a7f;hb=f8f9decc545a7e9fc7b4c92534f4bf2b1db4a4f0;hpb=553046dfa92cd4e0c2d16c25a80deba38d4c9ded diff --git a/util.c b/util.c index ce7d849..09f1817 100644 --- a/util.c +++ b/util.c @@ -89,9 +89,12 @@ bool uci_validate_text(const char *str) { while (*str) { unsigned char c = *str; - if ((c == '\r') || (c == '\n') || - ((c < 32) && (c != '\t'))) + if (((c < 32) && + (c != '\t') && + (c != '\n') && + (c != '\r'))) { return false; + } str++; } return true; @@ -161,12 +164,12 @@ error: } -__private void uci_parse_error(struct uci_context *ctx, char *pos, char *reason) +__private void uci_parse_error(struct uci_context *ctx, char *reason) { struct uci_parse_context *pctx = ctx->pctx; pctx->reason = reason; - pctx->byte = pos - pctx->buf; + pctx->byte = pctx_pos(pctx); UCI_THROW(ctx, UCI_ERR_PARSE); }