2 * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
11 struct bytecode_symbol_iterator
{
12 /* No ownership of bytecode is taken. */
18 struct bytecode_symbol_iterator
*bytecode_symbol_iterator_create(
19 struct lttng_filter_bytecode
*bytecode
)
21 struct bytecode_symbol_iterator
*it
= NULL
;
27 it
= zmalloc(sizeof(*it
));
32 it
->bytecode
= bytecode
->data
;
33 it
->offset
= bytecode
->reloc_table_offset
;
34 it
->len
= bytecode
->len
;
40 int bytecode_symbol_iterator_next(struct bytecode_symbol_iterator
*it
)
45 if (!it
|| it
->offset
>= it
->len
) {
50 len
= strlen(it
->bytecode
+ it
->offset
+ sizeof(uint16_t)) + 1;
51 it
->offset
+= len
+ sizeof(uint16_t);
52 ret
= it
->offset
>= it
->len
? -1 : 0;
58 int bytecode_symbol_iterator_get_type(struct bytecode_symbol_iterator
*it
)
67 ret
= *((uint16_t *) (it
->bytecode
+ it
->offset
));
73 const char *bytecode_symbol_iterator_get_name(
74 struct bytecode_symbol_iterator
*it
)
76 const char *ret
= NULL
;
82 ret
= it
->bytecode
+ it
->offset
+ sizeof(uint16_t);
88 void bytecode_symbol_iterator_destroy(struct bytecode_symbol_iterator
*it
)
This page took 0.035759 seconds and 4 git commands to generate.