Fix type free memleak
[babeltrace.git] / include / babeltrace / ctf / types.h
CommitLineData
d79865b9
MD
1#ifndef _BABELTRACE_CTF_TYPES_H
2#define _BABELTRACE_CTF_TYPES_H
6dc2ca62
MD
3
4/*
5 * Common Trace Format
6 *
7 * Type header
8 *
de0ba614 9 * Copyright (c) 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6dc2ca62 10 *
de0ba614
MD
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6dc2ca62
MD
24 */
25
26#include <stdint.h>
27#include <glib.h>
28
29/*
de0ba614
MD
30 * IMPORTANT: All lengths (len) and offsets (start, end) are expressed in bits,
31 * *not* in bytes.
32 *
33 * All write primitives, as well as read for dynamically sized entities, can
6dc2ca62
MD
34 * receive a NULL ptr/dest parameter. In this case, no write is performed, but
35 * the size is returned.
36 */
37
de0ba614
MD
38uint64_t ctf_uint_read(const unsigned char *ptr, int byte_order, size_t len);
39int64_t ctf_int_read(const unsigned char *ptr, int byte_order, size_t len);
40size_t ctf_uint_write(unsigned char *ptr, int byte_order, size_t len, uint64_t v);
41size_t ctf_int_write(unsigned char *ptr, int byte_order, size_t len, int64_t v);
6dc2ca62 42
fc93b2bd
MD
43uint64_t ctf_bitfield_unsigned_read(const unsigned char *ptr,
44 unsigned long start, unsigned long len,
45 int byte_order);
46int64_t ctf_bitfield_signed_read(const unsigned char *ptr,
47 unsigned long start, unsigned long len,
48 int byte_order);
49size_t ctf_bitfield_unsigned_write(unsigned char *ptr,
50 unsigned long start, unsigned long len,
51 int byte_order, uint64_t v);
52size_t ctf_bitfield_signed_write(unsigned char *ptr,
53 unsigned long start, unsigned long len,
54 int byte_order, int64_t v);
6dc2ca62 55
0a46062b 56double ctf_double_read(const unsigned char *ptr, const struct type_class_float *src);
fc93b2bd 57size_t ctf_double_write(unsigned char *ptr, const struct type_class_float *dest,
de0ba614
MD
58 double v);
59long double ctf_ldouble_read(const unsigned char *ptr,
0a46062b 60 const struct type_class_float *src);
fc93b2bd 61size_t ctf_ldouble_write(unsigned char *ptr, const struct type_class_float *dest,
de0ba614 62 long double v);
fc93b2bd
MD
63void ctf_float_copy(unsigned char *destp, const struct type_class_float *dest,
64 const unsigned char *srcp, const struct type_class_float *src);
6dc2ca62 65
de0ba614 66size_t ctf_string_copy(unsigned char *dest, const unsigned char *src);
6dc2ca62 67
448d3cc7
MD
68GQuark ctf_enum_read(const unsigned char *ptr,
69 const struct type_class_enum *src);
70size_t ctf_enum_write(unsigned char *ptr, const struct type_class_enum *dest,
71 GQuark q);
6dc2ca62 72
d79865b9 73#endif /* _BABELTRACE_CTF_TYPES_H */
This page took 0.025819 seconds and 4 git commands to generate.