X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Ffilter.c;fp=src%2Fcommon%2Ffilter.c;h=0000000000000000000000000000000000000000;hp=9195808ee75be083b5d5e386fa2febf564d0a135;hb=a6bc4ca9d659caf016ef932fcd944029737ac57c;hpb=97535efaa975ca52bf02c2d5e76351bfd2e3defa diff --git a/src/common/filter.c b/src/common/filter.c deleted file mode 100644 index 9195808ee..000000000 --- a/src/common/filter.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2016 Jérémie Galarneau - * - * SPDX-License-Identifier: LGPL-2.1-only - * - */ - -#include "filter.h" -#include - -struct bytecode_symbol_iterator { - /* No ownership of bytecode is taken. */ - char *bytecode; - size_t offset, len; -}; - -struct bytecode_symbol_iterator *bytecode_symbol_iterator_create( - struct lttng_bytecode *bytecode) -{ - struct bytecode_symbol_iterator *it = NULL; - - if (!bytecode) { - goto end; - } - - it = zmalloc(sizeof(*it)); - if (!it) { - goto end; - } - - it->bytecode = bytecode->data; - it->offset = bytecode->reloc_table_offset; - it->len = bytecode->len; -end: - return it; -} - -int bytecode_symbol_iterator_next(struct bytecode_symbol_iterator *it) -{ - int ret; - size_t len; - - if (!it || it->offset >= it->len) { - ret = -1; - goto end; - } - - len = strlen(it->bytecode + it->offset + sizeof(uint16_t)) + 1; - it->offset += len + sizeof(uint16_t); - ret = it->offset >= it->len ? -1 : 0; -end: - return ret; -} - -int bytecode_symbol_iterator_get_type(struct bytecode_symbol_iterator *it) -{ - int ret; - - if (!it) { - ret = -1; - goto end; - } - - ret = *((uint16_t *) (it->bytecode + it->offset)); -end: - return ret; - } - -const char *bytecode_symbol_iterator_get_name( - struct bytecode_symbol_iterator *it) -{ - const char *ret = NULL; - - if (!it) { - goto end; - } - - ret = it->bytecode + it->offset + sizeof(uint16_t); -end: - return ret; -} - -void bytecode_symbol_iterator_destroy(struct bytecode_symbol_iterator *it) -{ - free(it); -}