Debian Codegraph @

src/bnetd/attr.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2004 Dizzy
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 #ifndef __ATTR_INCLUDED__
20 #define __ATTR_INCLUDED__cxx . . $ `src/bnetd/attr.h:20:9`!
21
22 #include "common/elist.h"cxx . . $ `<file>/src/common/elist.h`/
23 #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/
24
25 namespace pvpgncxx . . $ pvpgn/
26 {
27
28 namespace bnetdcxx . . $ pvpgn/bnetd/
29 {
30
31 typedef struct attr_structcxx . . $ pvpgn/bnetd/attr_struct# {
32 const char *keycxx . . $ pvpgn/bnetd/attr_struct#key.;
33 const char *valcxx . . $ pvpgn/bnetd/attr_struct#val.;
34 int dirtycxx . . $ pvpgn/bnetd/attr_struct#dirty.;
35 t_hlistcxx . . $ pvpgn/t_hlist# linkcxx . . $ pvpgn/bnetd/attr_struct#link.;
36 } t_attrcxx . . $ pvpgn/bnetd/t_attr#;
37
38 static inline t_attrcxx . . $ pvpgn/bnetd/t_attr# *attr_createcxx . . $ pvpgn/bnetd/attr_create(14a607e4a65cb9d5).(const char *key, const char *val)
39 {
40 t_attrcxx . . $ pvpgn/bnetd/t_attr# *attr;
41
42 attr = (t_attrcxx . . $ pvpgn/bnetd/t_attr#*)xmalloccxx . . $ pvpgn/bnetd/t_attr#(sizeof(t_attr));
43 attr->dirtycxx . . $ pvpgn/bnetd/attr_struct#dirty. = 0;
44 hlist_initcxx . . $ pvpgn/hlist_struct#next.(&attr->link);
45 attr->keycxx . . $ pvpgn/bnetd/attr_struct#key. = key ? xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(key) : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
46 attr->valcxx . . $ pvpgn/bnetd/attr_struct#val. = val ? xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(val) : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
47
48 return attr;
49 }
50
51 static inline int attr_destroycxx . . $ pvpgn/bnetd/attr_destroy(9fe1faf7e594f6cd).(t_attrcxx . . $ pvpgn/bnetd/t_attr# *attr)
52 {
53 if (attr->keycxx . . $ pvpgn/bnetd/attr_struct#key.) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void*)attr->key);
54 if (attr->valcxx . . $ pvpgn/bnetd/attr_struct#val.) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void*)attr->val);
55
56 xfreecxx . . $ `src/common/xalloc.h:51:9`!((void*)attr);
57
58 return 0;
59 }
60
61 static inline int attr_get_dirtycxx . . $ pvpgn/bnetd/attr_get_dirty(9fe1faf7e594f6cd).(t_attrcxx . . $ pvpgn/bnetd/t_attr# *attr)
62 {
63 return attr->dirtycxx . . $ pvpgn/bnetd/attr_struct#dirty.;
64 }
65
66 static inline void attr_clear_dirtycxx . . $ pvpgn/bnetd/attr_clear_dirty(d2d8112715f5226d).(t_attrcxx . . $ pvpgn/bnetd/t_attr# *attr)
67 {
68 attr->dirtycxx . . $ pvpgn/bnetd/attr_struct#dirty. = 0;
69 }
70
71 static inline const char *attr_get_keycxx . . $ pvpgn/bnetd/attr_get_key(32e503b365e650a7).(t_attrcxx . . $ pvpgn/bnetd/t_attr# *attr)
72 {
73 return attr->keycxx . . $ pvpgn/bnetd/attr_struct#key.;
74 }
75
76 static inline const char *attr_get_valcxx . . $ pvpgn/bnetd/attr_get_val(32e503b365e650a7).(t_attrcxx . . $ pvpgn/bnetd/t_attr# *attr)
77 {
78 return attr->valcxx . . $ pvpgn/bnetd/attr_struct#val.;
79 }
80
81 static inline void attr_set_valcxx . . $ pvpgn/bnetd/attr_set_val(4d1c53343a7db94e).(t_attrcxx . . $ pvpgn/bnetd/t_attr# *attr, const char *val)
82 {
83 if (attr->valcxx . . $ pvpgn/bnetd/attr_struct#val.) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void*)attr->val);
84
85 if (val) attr->valcxx . . $ pvpgn/bnetd/attr_struct#val. = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(val);
86 else attr->valcxx . . $ pvpgn/bnetd/attr_struct#val. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
87 }
88
89 static inline void attr_set_dirtycxx . . $ pvpgn/bnetd/attr_set_dirty(d2d8112715f5226d).(t_attrcxx . . $ pvpgn/bnetd/t_attr# *attr)
90 {
91 attr->dirtycxx . . $ pvpgn/bnetd/attr_struct#dirty. = 1;
92 }
93
94 }
95
96 }
97
98 #endif /* __ATTR_H_INCLUDED__ */