X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Ffilter%2Ffilter-visitor-ir-validate-globbing.cpp;fp=src%2Fcommon%2Ffilter%2Ffilter-visitor-ir-validate-globbing.cpp;h=f0a236345ad69dc0d8a2322d5e0434da1e7d24c2;hp=718098a433403bea810158b9e8b5b2fe27ca030a;hb=28ab034a2c3582d07d3423d2d746731f87d3969f;hpb=52e345b9ac912d033c2a2c25a170a01cf209839d diff --git a/src/common/filter/filter-visitor-ir-validate-globbing.cpp b/src/common/filter/filter-visitor-ir-validate-globbing.cpp index 718098a43..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 "filter-ast.hpp" -#include "filter-parser.hpp" -#include "filter-ir.hpp" +#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; } }