Open SCAP Library
Loading...
Searching...
No Matches
sexp-manip_r.h
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 <dkopecek@redhat.com>
21 */
22
23#ifndef SEXP_MANIP_R_H
24#define SEXP_MANIP_R_H
25
26#include <stdarg.h>
27#include <stddef.h>
28#include <stdint.h>
29#include <stdbool.h>
30#include "sexp-types.h"
31#include "oscap_export.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
38#define _GNUC_PRINTF( format_idx, arg_idx ) \
39 __attribute__((__format__ (__printf__, format_idx, arg_idx)))
40#else /* !__GNUC__ */
41#define _GNUC_PRINTF( format_idx, arg_idx )
42#endif /* __GNUC__ */
43
44OSCAP_API SEXP_t *SEXP_init(SEXP_t *sexp_mem);
45
46OSCAP_API SEXP_t *SEXP_number_newb_r(SEXP_t *sexp_mem, bool n);
47#define SEXP_number_newi_r SEXP_number_newi_32_r
48OSCAP_API SEXP_t *SEXP_number_newi_32_r(SEXP_t *sexp_mem, int32_t n);
49OSCAP_API SEXP_t *SEXP_number_newu_32_r(SEXP_t *sexp_mem, uint32_t n);
50OSCAP_API SEXP_t *SEXP_number_newu_64_r(SEXP_t *sexp_mem, uint64_t n);
51OSCAP_API SEXP_t *SEXP_number_newi_64_r(SEXP_t *sexp_mem, int64_t n);
52OSCAP_API SEXP_t *SEXP_number_newf_r(SEXP_t *sexp_mem, double n);
53
54OSCAP_API SEXP_t *SEXP_string_new_r(SEXP_t *sexp_mem, const void *string, size_t length);
55OSCAP_API SEXP_t *SEXP_string_newf_r(SEXP_t *sexp_mem, const char *format, ...) _GNUC_PRINTF (2,3);
56OSCAP_API SEXP_t *SEXP_string_newf_rv(SEXP_t *sexp_mem, const char *format, va_list ap);
57
58OSCAP_API SEXP_t *SEXP_list_new_rv(SEXP_t *sexp_mem, SEXP_t *memb, va_list alist);
59OSCAP_API SEXP_t *SEXP_list_new_r(SEXP_t *sexp_mem, SEXP_t *memb, ...);
60
61OSCAP_API SEXP_t *SEXP_list_rest_r (SEXP_t *rest, const SEXP_t *list);
62
63OSCAP_API int SEXP_unref_r(SEXP_t *s_exp);
64
65#if defined(NDEBUG)
66OSCAP_API void SEXP_free_r (SEXP_t *s_exp);
67#else
68#include <stdint.h>
69OSCAP_API void __SEXP_free_r(SEXP_t *s_exp, const char *file, uint32_t line, const char *func);
70
71__attribute__ ((unused)) static void SEXP_free_r(SEXP_t *sexp)
72{
73 __SEXP_free_r(sexp, __FILE__, __LINE__, __PRETTY_FUNCTION__);
74}
75
76#define SEXP_free_r(ptr) __SEXP_free_r(ptr, __FILE__, __LINE__, __PRETTY_FUNCTION__)
77
78#endif
79
80#ifdef __cplusplus
81}
82#endif
83
84#endif /* SEXP_MANIP_R_H */
Definition sexp-types.h:82