X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Ffilter%2Ffilter-visitor-ir-validate-globbing.cpp;h=718098a433403bea810158b9e8b5b2fe27ca030a;hb=HEAD;hp=8f9c785c49b231925822581fe3019e4ca8212467;hpb=348ddc5c9107149d48b1f12d31a7e75e9b73b4da;p=lttng-tools.git diff --git a/src/common/filter/filter-visitor-ir-validate-globbing.cpp b/src/common/filter/filter-visitor-ir-validate-globbing.cpp index 8f9c785c4..f0a236345 100644 --- a/src/common/filter/filter-visitor-ir-validate-globbing.cpp +++ b/src/common/filter/filter-visitor-ir-validate-globbing.cpp @@ -9,21 +9,20 @@ * */ -#include -#include -#include -#include -#include +#include "filter-ast.hpp" +#include "filter-ir.hpp" +#include "filter-parser.hpp" -#include -#include +#include +#include -#include "filter-ast.h" -#include "filter-parser.hpp" -#include "filter-ir.h" +#include +#include +#include +#include +#include -static -int validate_globbing(struct ir_op *node) +static int validate_globbing(struct ir_op *node) { int ret; @@ -45,30 +44,32 @@ int validate_globbing(struct ir_op *node) struct ir_op *right = node->u.binary.right; if (left->op == IR_OP_LOAD && right->op == IR_OP_LOAD && - left->data_type == IR_DATA_STRING && - right->data_type == IR_DATA_STRING) { + left->data_type == IR_DATA_STRING && right->data_type == IR_DATA_STRING) { /* Test 1. */ if (left->u.load.u.string.type == IR_LOAD_STRING_TYPE_GLOB_STAR && - right->u.load.u.string.type != IR_LOAD_STRING_TYPE_PLAIN) { + right->u.load.u.string.type != IR_LOAD_STRING_TYPE_PLAIN) { fprintf(stderr, "[error] Cannot compare two globbing patterns\n"); return -1; } if (right->u.load.u.string.type == IR_LOAD_STRING_TYPE_GLOB_STAR && - left->u.load.u.string.type != IR_LOAD_STRING_TYPE_PLAIN) { + left->u.load.u.string.type != IR_LOAD_STRING_TYPE_PLAIN) { fprintf(stderr, "[error] Cannot compare two globbing patterns\n"); return -1; } } if ((left->op == IR_OP_LOAD && left->data_type == IR_DATA_STRING) || - (right->op == IR_OP_LOAD && right->data_type == IR_DATA_STRING)) { - if ((left->op == IR_OP_LOAD && left->u.load.u.string.type == IR_LOAD_STRING_TYPE_GLOB_STAR) || - (right->op == IR_OP_LOAD && right->u.load.u.string.type == IR_LOAD_STRING_TYPE_GLOB_STAR)) { + (right->op == IR_OP_LOAD && right->data_type == IR_DATA_STRING)) { + if ((left->op == IR_OP_LOAD && + left->u.load.u.string.type == IR_LOAD_STRING_TYPE_GLOB_STAR) || + (right->op == IR_OP_LOAD && + right->u.load.u.string.type == IR_LOAD_STRING_TYPE_GLOB_STAR)) { /* Test 2. */ if (node->u.binary.type != AST_OP_EQ && - node->u.binary.type != AST_OP_NE) { - fprintf(stderr, "[error] Only the `==` and `!=` operators are allowed with a globbing pattern\n"); + node->u.binary.type != AST_OP_NE) { + fprintf(stderr, + "[error] Only the `==` and `!=` operators are allowed with a globbing pattern\n"); return -1; } }