Dedicated xml,json,yang and xsl parser utility programs added

Sanity check of stdarg (...) added
Cleanup of error messages.
This commit is contained in:
Olof hagsand 2018-06-17 19:40:06 +02:00
parent 1306174071
commit 85c4782e36
56 changed files with 1004 additions and 379 deletions

View file

@ -730,16 +730,14 @@ json_parse_file(int fd,
int len = 0;
if ((jsonbuf = malloc(jsonbuflen)) == NULL){
clicon_err(OE_XML, errno, "%s: malloc", __FUNCTION__);
clicon_err(OE_XML, errno, "malloc");
goto done;
}
memset(jsonbuf, 0, jsonbuflen);
ptr = jsonbuf;
while (1){
if ((ret = read(fd, &ch, 1)) < 0){
clicon_err(OE_XML, errno, "%s: read: [pid:%d]\n",
__FUNCTION__,
(int)getpid());
clicon_err(OE_XML, errno, "read");
break;
}
if (ret != 0)
@ -756,7 +754,7 @@ json_parse_file(int fd,
oldjsonbuflen = jsonbuflen;
jsonbuflen *= 2;
if ((jsonbuf = realloc(jsonbuf, jsonbuflen)) == NULL){
clicon_err(OE_XML, errno, "%s: realloc", __FUNCTION__);
clicon_err(OE_XML, errno, "realloc");
goto done;
}
memset(jsonbuf+oldjsonbuflen, 0, jsonbuflen-oldjsonbuflen);