minor alignment

This commit is contained in:
Olof Hagsand 2020-11-15 05:13:05 -06:00
parent 5c7d67dab4
commit 707685f5ff
2 changed files with 33 additions and 3 deletions

7
.gitignore vendored
View file

@ -46,17 +46,19 @@ include/clixon_config.h
lib/src/build.c lib/src/build.c
lib/clixon/clixon.h lib/clixon/clixon.h
build-root/*.tar.xz build-root/*.tar*
build-root/*.rpm build-root/*.rpm
build-root/.version
build-root/rpmbuild build-root/rpmbuild
build-root/debbuild
util/clixon_util_datastore util/clixon_util_datastore
util/clixon_util_grpc util/clixon_util_grpc
util/clixon_util_insert
util/clixon_util_json util/clixon_util_json
util/clixon_util_path util/clixon_util_path
util/clixon_util_regexp util/clixon_util_regexp
util/clixon_util_socket util/clixon_util_socket
util/clixon_util_ssl
util/clixon_util_stream util/clixon_util_stream
util/clixon_util_xml util/clixon_util_xml
util/clixon_util_xml_mod util/clixon_util_xml_mod
@ -68,3 +70,4 @@ test/site.sh
test/vagrant/site.mk test/vagrant/site.mk
test/cicd/site.mk test/cicd/site.mk
doc/html doc/html

View file

@ -375,6 +375,10 @@ xml_stats(cxobj *xt,
char* char*
xml_name(cxobj *xn) xml_name(cxobj *xn)
{ {
if (xn == NULL) {
clicon_err(OE_XML, EINVAL, "x is NULL");
return NULL;
}
return xn->x_name; return xn->x_name;
} }
@ -565,6 +569,10 @@ nscache_clear(cxobj *x)
cxobj* cxobj*
xml_parent(cxobj *xn) xml_parent(cxobj *xn)
{ {
if (xn == NULL) {
clicon_err(OE_XML, EINVAL, "xn is NULL");
return NULL;
}
return xn->x_up; return xn->x_up;
} }
@ -704,6 +712,10 @@ xml_value_append(cxobj *xn,
enum cxobj_type enum cxobj_type
xml_type(cxobj *xn) xml_type(cxobj *xn)
{ {
if (xn == NULL) {
clicon_err(OE_XML, EINVAL, "xn is NULL");
return CX_ERROR;
}
return xn->x_type; return xn->x_type;
} }
@ -731,6 +743,9 @@ xml_type_set(cxobj *xn,
int int
xml_child_nr(cxobj *xn) xml_child_nr(cxobj *xn)
{ {
if (xn == NULL) {
return 0;
}
if (!is_element(xn)) if (!is_element(xn))
return 0; return 0;
return xn->x_childvec_len; return xn->x_childvec_len;
@ -792,6 +807,10 @@ cxobj *
xml_child_i(cxobj *xn, xml_child_i(cxobj *xn,
int i) int i)
{ {
if (xn == NULL || i < 0) {
clicon_err(OE_XML, EINVAL, "xn is NULL or invalid child nr");
return NULL;
}
if (!is_element(xn)) if (!is_element(xn))
return NULL; return NULL;
if (i < xn->x_childvec_len) if (i < xn->x_childvec_len)
@ -1183,7 +1202,7 @@ xml_cv_set(cxobj *x,
* Get first XML node directly under x_up in the xml hierarchy with * Get first XML node directly under x_up in the xml hierarchy with
* name "name". * name "name".
* *
* @param[in] x_up Base XML object * @param[in] xp Base XML object
* @param[in] name Node name * @param[in] name Node name
* *
* @retval xmlobj if found. * @retval xmlobj if found.
@ -1201,6 +1220,10 @@ xml_find(cxobj *xp,
{ {
cxobj *x = NULL; cxobj *x = NULL;
if (xp == NULL || name == NULL) {
clicon_err(OE_XML, EINVAL, "xp or name is NULL");
return NULL;
}
if (!is_element(xp)) if (!is_element(xp))
return NULL; return NULL;
while ((x = xml_child_each(xp, x, -1)) != NULL) while ((x = xml_child_each(xp, x, -1)) != NULL)
@ -1814,6 +1837,10 @@ xml_free(cxobj *x)
int i; int i;
cxobj *xc; cxobj *xc;
if (x == NULL){
clicon_err(OE_XML, EINVAL, "x is NULL");
return -1;
}
if (x->x_name) if (x->x_name)
free(x->x_name); free(x->x_name);
if (x->x_prefix) if (x->x_prefix)