Debian Codegraph @

src/OVAL/probes/probe/rcache.c

raw symbols SCIP
1 /*
2 * Copyright 2011 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 * Daniel Kopecek <[email protected]>
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 <stddef.h>
28 #include <sexp.h>cxx . . $ `<file>/src/OVAL/probes/SEAP/public/sexp.h`/
29
30 #include "../SEAP/generic/rbt/rbt.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/generic/rbt/rbt.h`/
31
32 #include "rcache.h"cxx . . $ `<file>/src/OVAL/probes/probe/rcache.h`/
33
34 probe_rcache_tcxx . . $ probe_rcache_t# *probe_rcache_newcxx . . $ probe_rcache_new(828cb6e43476d228).(void)
35 {
36 probe_rcache_tcxx . . $ probe_rcache_t# *cache;
37
38 cache = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(probe_rcache_tcxx . . $ probe_rcache_t#));
39 cache->treecxx . . $ $anonymous_type_8c8f972de8d0e9c7_0#tree. = rbt_str_newcxx . . $ rbt_str_new(557e4aca7c153cb).();
40
41 return (cache);
42 }
43
44 static void probe_rcache_free_nodecxx . . $ probe_rcache_free_node(bd95e63a1880cd3a).(struct rbt_str_nodecxx . . $ rbt_str_node# *n)
45 {
46 freecxx . . $ free(5d22bdacc48458e8).(n->keycxx . . $ rbt_str_node#key.);
47 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(n->datacxx . . $ rbt_str_node#data.);
48 }
49
50 void probe_rcache_freecxx . . $ probe_rcache_free(746d67ca65c3914d).(probe_rcache_tcxx . . $ probe_rcache_t# *cache)
51 {
52 rbt_str_free_cbcxx . . $ rbt_str_free_cb(d6c6edd7b040d8d5).(cache->treecxx . . $ $anonymous_type_8c8f972de8d0e9c7_0#tree., &probe_rcache_free_nodecxx . . $ probe_rcache_free_node(bd95e63a1880cd3a).);
53 freecxx . . $ free(5d22bdacc48458e8).(cache);
54 return;
55 }
56
57 int probe_rcache_sexp_addcxx . . $ probe_rcache_sexp_add(2a038249cafd8515).(probe_rcache_tcxx . . $ probe_rcache_t# *cache, const SEXP_tcxx . . $ SEXP_t# *id, SEXP_tcxx . . $ SEXP_t# *item)
58 {
59 SEXP_tcxx . . $ SEXP_t# *r;
60 char *k;
61
62 if (cache == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || id == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || item == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
63 return -1;
64 }
65
66 k = SEXP_string_cstrcxx . . $ SEXP_string_cstr(c831a2fa12818dfe).(id);
67 r = SEXP_refcxx . . $ SEXP_ref(2f7f980afaaae0f0).(item);
68
69 if (rbt_str_addcxx . . $ rbt_str_add(d471093ac4c699c2).(cache->treecxx . . $ $anonymous_type_8c8f972de8d0e9c7_0#tree., k, (void *)r) != 0) {
70 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(r);
71 freecxx . . $ free(5d22bdacc48458e8).(k);
72 return (-1);
73 }
74
75 return (0);
76 }
77
78 int probe_rcache_cstr_addcxx . . $ probe_rcache_cstr_add(361cb903f8474df4).(probe_rcache_tcxx . . $ probe_rcache_t# *cache, const char *id, SEXP_tcxx . . $ SEXP_t# * item)
79 {
80 return (-1);
81 }
82
83 int probe_rcache_sexp_delcxx . . $ probe_rcache_sexp_del(e4673514834a31e6).(probe_rcache_tcxx . . $ probe_rcache_t# *cache, const SEXP_tcxx . . $ SEXP_t# * id)
84 {
85 return (-1);
86 }
87
88 int probe_rcache_cstr_delcxx . . $ probe_rcache_cstr_del(3d763e8ab2749d90).(probe_rcache_tcxx . . $ probe_rcache_t# *cache, const char *id)
89 {
90 return (-1);
91 }
92
93 SEXP_tcxx . . $ SEXP_t# *probe_rcache_sexp_getcxx . . $ probe_rcache_sexp_get(ce64d4c7f6269eda).(probe_rcache_tcxx . . $ probe_rcache_t# *cache, const SEXP_tcxx . . $ SEXP_t# * id)
94 {
95 char b[128], *k = b;
96 SEXP_tcxx . . $ SEXP_t# *r = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
97
98 if (SEXP_string_cstr_rcxx . . $ SEXP_string_cstr_r(ca07af91a4fa826f).(id, k, sizeof b) == ((size_t)-1))
99 k = SEXP_string_cstrcxx . . $ SEXP_string_cstr(c831a2fa12818dfe).(id);
100
101 if (k == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
102 return(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
103
104 rbt_str_getcxx . . $ rbt_str_get(3cd4f904f7b02e6c).(cache->treecxx . . $ $anonymous_type_8c8f972de8d0e9c7_0#tree., k, (void *)&r);
105
106 if (k != b)
107 freecxx . . $ free(5d22bdacc48458e8).(k);
108
109 return (r != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ? SEXP_refcxx . . $ SEXP_ref(2f7f980afaaae0f0).(r) : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
110 }
111
112 SEXP_tcxx . . $ SEXP_t# *probe_rcache_cstr_getcxx . . $ probe_rcache_cstr_get(76dd82e483622dd).(probe_rcache_tcxx . . $ probe_rcache_t# *cache, const char *k)
113 {
114 SEXP_tcxx . . $ SEXP_t# *r = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
115
116 rbt_str_getcxx . . $ rbt_str_get(3cd4f904f7b02e6c).(cache->treecxx . . $ $anonymous_type_8c8f972de8d0e9c7_0#tree., k, (void *)&r);
117
118 return (r != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ? SEXP_refcxx . . $ SEXP_ref(2f7f980afaaae0f0).(r) : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
119 }