Debian Codegraph @

src/CPE/cpe_ctx_priv.c

raw symbols SCIP
1 /*
2 * Copyright 2013--2014 Red Hat Inc., Durham, North Carolina.
3 * All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * Authors:
20 * Šimon Lukašík
21 */
22
23 #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`!
24 #include <config.h>cxx . . $ `<file>/build/config.h`/
25 #endif
26
27 #include <string.h>
28 #include <libxml/xmlreader.h>
29
30 #include "cpe_ctx_priv.h"cxx . . $ `<file>/src/CPE/cpe_ctx_priv.h`/
31 #include "common/_error.h"cxx . . $ `<file>/src/common/_error.h`/
32 #include "common/elements.h"cxx . . $ `<file>/src/common/elements.h`/
33
34 struct cpe_parser_ctxcxx . . $ cpe_parser_ctx# {
35 xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# readercxx . . $ cpe_parser_ctx#reader.;
36 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! owns_readercxx . . $ cpe_parser_ctx#owns_reader.;
37 char *schema_versioncxx . . $ cpe_parser_ctx#schema_version.;
38 };
39
40 static inline struct cpe_parser_ctxcxx . . $ cpe_parser_ctx# *_cpe_parser_ctx_newcxx . . $ _cpe_parser_ctx_new(f7ee737c4b2207cd).()
41 {
42 return calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct cpe_parser_ctxcxx . . $ cpe_parser_ctx#));
43 }
44
45 struct cpe_parser_ctxcxx . . $ cpe_parser_ctx# *cpe_parser_ctx_from_readercxx . . $ cpe_parser_ctx_from_reader(e3d9c9b7d3b0da8).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader)
46 {
47 struct cpe_parser_ctxcxx . . $ cpe_parser_ctx# *ctx = _cpe_parser_ctx_newcxx . . $ _cpe_parser_ctx_new(f7ee737c4b2207cd).();
48 ctx->readercxx . . $ cpe_parser_ctx#reader. = reader;
49 ctx->owns_readercxx . . $ cpe_parser_ctx#owns_reader. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
50 return ctx;
51 }
52
53 void cpe_parser_ctx_freecxx . . $ cpe_parser_ctx_free(270d62ec502b7607).(struct cpe_parser_ctxcxx . . $ cpe_parser_ctx# *ctx)
54 {
55 if (ctx) {
56 if (ctx->readercxx . . $ cpe_parser_ctx#reader. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && ctx->owns_readercxx . . $ cpe_parser_ctx#owns_reader.)
57 xmlFreeTextReadercxx . . $ xmlFreeTextReader(724dbfdba9ec3ce8).(ctx->readercxx . . $ cpe_parser_ctx#reader.);
58 freecxx . . $ free(5d22bdacc48458e8).(ctx->schema_versioncxx . . $ cpe_parser_ctx#schema_version.);
59 freecxx . . $ free(5d22bdacc48458e8).(ctx);
60 }
61 }
62
63 static inline const char *_cpe_parser_ctx_get_schema_versioncxx . . $ _cpe_parser_ctx_get_schema_version(c8419ac930835460).(struct cpe_parser_ctxcxx . . $ cpe_parser_ctx# *ctx)
64 {
65 return (ctx->schema_versioncxx . . $ cpe_parser_ctx#schema_version. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) ? "2.3" : ctx->schema_versioncxx . . $ cpe_parser_ctx#schema_version.;
66 }
67
68 static int _cpe_parser_ctx_version_cmpcxx . . $ _cpe_parser_ctx_version_cmp(ebd7f5351df141f7).(struct cpe_parser_ctxcxx . . $ cpe_parser_ctx# *ctx, const char *version)
69 {
70 #ifdef __USE_GNUcxx . . $ `<external>/18206667465210621810/features.h:430:10`!
71 return strverscmpcxx . . $ strverscmp(5ae29d726ae57f88).(_cpe_parser_ctx_get_schema_versioncxx . . $ _cpe_parser_ctx_get_schema_version(c8419ac930835460).(ctx), version);
72 #else
73 return strcmp(_cpe_parser_ctx_get_schema_version(ctx), version);
74 #endif
75 }
76
77 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! cpe_parser_ctx_version_gtcxx . . $ cpe_parser_ctx_version_gt(25289f94b35fa287).(struct cpe_parser_ctxcxx . . $ cpe_parser_ctx# *ctx, const char *version)
78 {
79 return _cpe_parser_ctx_version_cmpcxx . . $ _cpe_parser_ctx_version_cmp(ebd7f5351df141f7).(ctx, version) > 0;
80 }
81
82 OSCAP_GETTERcxx . . $ `src/common/util.h:111:9`!(xmlTextReaderPtr, cpe_parser_ctx, reader);
83 OSCAP_SETTER_GENERICcxx . . $ `src/common/util.h:215:9`!(cpe_parser_ctx, const char *, schema_version, free, oscap_strdup);