X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;ds=sidebyside;f=util.c;h=f16a378b307ae5468a332bd0427828acec044ff8;hb=ec302c635b27e212c2df5ce3378fd94edfbfd886;hp=ce7d849855fe39b5b3b1caf3a683fac4b05e3a7f;hpb=e339407372ffc70b1451e4eda218c01aa95a6a7f;p=project%2Fuci.git diff --git a/util.c b/util.c index ce7d849..f16a378 100644 --- a/util.c +++ b/util.c @@ -89,9 +89,10 @@ 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 +162,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); }