X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;ds=sidebyside;f=tests%2Futils%2Fxml-utils%2Fvalidate_xml.cpp;h=887f7af524c146a2f1f6d8b5ecd2ee018cc981c3;hb=09d8c782dbdfca9a6a67359d53fd8eb2d1eac902;hp=bb67e56e17edea75706b56c50ec072c49f2433be;hpb=729c1fec5976af17fded2f026725a08ef1924290;p=lttng-tools.git diff --git a/tests/utils/xml-utils/validate_xml.cpp b/tests/utils/xml-utils/validate_xml.cpp index bb67e56e1..887f7af52 100644 --- a/tests/utils/xml-utils/validate_xml.cpp +++ b/tests/utils/xml-utils/validate_xml.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Jonathan Rajotte + * Copyright (C) 2014 EfficiOS Inc. * * SPDX-License-Identifier: LGPL-2.1-only * @@ -25,21 +25,24 @@ #include #include -#include +#include +namespace { struct validation_ctx { xmlSchemaParserCtxtPtr parser_ctx; xmlSchemaPtr schema; xmlSchemaValidCtxtPtr schema_validation_ctx; }; +} /* namespace */ enum command_err_code { CMD_SUCCESS = 0, CMD_ERROR }; -static -void xml_error_handler(void *ctx, const char *format, ...) +static ATTR_FORMAT_PRINTF(2, 3) +void xml_error_handler(void *ctx __attribute__((unused)), + const char *format, ...) { char *err_msg; va_list args; @@ -144,14 +147,16 @@ static int validate_xml(const char *xml_file_path, struct validation_ctx *ctx) ret = CMD_SUCCESS; end: + if (doc) { + xmlFreeDoc(doc); + } return ret; - - } -int main(int argc, char **argv, char *env[]) + +int main(int argc, char **argv) { int ret; - struct validation_ctx ctx = { 0 }; + struct validation_ctx ctx = {}; /* Check if we have all argument */ if (argc < 3) {