Standardize `strcmp(a, b) == 0` instead of `!strcmp(a, b)`
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 10 Jul 2019 21:33:41 +0000 (17:33 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 10 Jul 2019 22:06:59 +0000 (18:06 -0400)
`!strcmp(a, b)` always looks like a negation to me (not equal), while
the `== 0` version clearly shows that we're after equality.

Semantic patch:

    @@
    expression a;
    expression b;
    @@

    - !strcmp(a, b)
    + strcmp(a, b) == 0

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I8e05b544c5cbd733e3d3e5b2c3554ee98669d1d5
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1685
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
12 files changed:
src/cli/babeltrace2-cfg-cli-args.c
src/cli/babeltrace2-cfg-cli-params-arg.c
src/cli/babeltrace2.c
src/ctf-writer/attributes.c
src/lib/graph/component.c
src/lib/trace-ir/attributes.c
src/plugins/ctf/common/metadata/visitor-generate-ir.c
src/plugins/ctf/fs-src/fs.c
src/plugins/ctf/lttng-live/viewer-connection.c
src/plugins/text/pretty/pretty.c
tests/ctf-writer/ctf_writer.c
tests/lib/test_bt_values.c

index 4036413b194be3df88e61698acc4d440c3619e46..1b7bd9321c1212ad7db2d4261b9f1cb3815b1bc3 100644 (file)
@@ -615,35 +615,35 @@ bt_value *names_from_arg(const char *arg)
                {
                        const char *identifier = scanner->value.v_identifier;
 
-                       if (!strcmp(identifier, "payload") ||
-                                       !strcmp(identifier, "args") ||
-                                       !strcmp(identifier, "arg")) {
+                       if (strcmp(identifier, "payload") == 0 ||
+                                       strcmp(identifier, "args") == 0 ||
+                                       strcmp(identifier, "arg") == 0) {
                                found_item = true;
                                if (bt_value_array_append_string_element(names,
                                                "payload")) {
                                        goto error;
                                }
-                       } else if (!strcmp(identifier, "context") ||
-                                       !strcmp(identifier, "ctx")) {
+                       } else if (strcmp(identifier, "context") == 0 ||
+                                       strcmp(identifier, "ctx") == 0) {
                                found_item = true;
                                if (bt_value_array_append_string_element(names,
                                                "context")) {
                                        goto error;
                                }
-                       } else if (!strcmp(identifier, "scope") ||
-                                       !strcmp(identifier, "header")) {
+                       } else if (strcmp(identifier, "scope") == 0 ||
+                                       strcmp(identifier, "header") == 0) {
                                found_item = true;
                                if (bt_value_array_append_string_element(names,
                                                identifier)) {
                                        goto error;
                                }
-                       } else if (!strcmp(identifier, "all")) {
+                       } else if (strcmp(identifier, "all") == 0) {
                                found_all = true;
                                if (bt_value_array_append_string_element(names,
                                                identifier)) {
                                        goto error;
                                }
-                       } else if (!strcmp(identifier, "none")) {
+                       } else if (strcmp(identifier, "none") == 0) {
                                found_none = true;
                                if (bt_value_array_append_string_element(names,
                                                identifier)) {
@@ -726,15 +726,15 @@ bt_value *fields_from_arg(const char *arg)
                {
                        const char *identifier = scanner->value.v_identifier;
 
-                       if (!strcmp(identifier, "trace") ||
-                                       !strcmp(identifier, "trace:hostname") ||
-                                       !strcmp(identifier, "trace:domain") ||
-                                       !strcmp(identifier, "trace:procname") ||
-                                       !strcmp(identifier, "trace:vpid") ||
-                                       !strcmp(identifier, "loglevel") ||
-                                       !strcmp(identifier, "emf") ||
-                                       !strcmp(identifier, "callsite") ||
-                                       !strcmp(identifier, "all")) {
+                       if (strcmp(identifier, "trace") == 0 ||
+                                       strcmp(identifier, "trace:hostname") == 0 ||
+                                       strcmp(identifier, "trace:domain") == 0 ||
+                                       strcmp(identifier, "trace:procname") == 0 ||
+                                       strcmp(identifier, "trace:vpid") == 0 ||
+                                       strcmp(identifier, "loglevel") == 0 ||
+                                       strcmp(identifier, "emf") == 0 ||
+                                       strcmp(identifier, "callsite") == 0 ||
+                                       strcmp(identifier, "all") == 0) {
                                if (bt_value_array_append_string_element(fields,
                                                identifier)) {
                                        goto error;
@@ -837,10 +837,10 @@ int insert_flat_params_from_array(GString *params_arg,
                g_string_append(tmpstr, "-");
 
                /* Special-case for "all" and "none". */
-               if (!strcmp(suffix, "all")) {
+               if (strcmp(suffix, "all") == 0) {
                        is_default = true;
                        g_string_assign(default_value, "show");
-               } else if (!strcmp(suffix, "none")) {
+               } else if (strcmp(suffix, "none") == 0) {
                        is_default = true;
                        g_string_assign(default_value, "hide");
                }
index 71c188bff0761b36d0d0914cc2ebff3c74faf8d0..622080a9abd869566d8c774068a5d80b6639ddd6 100644 (file)
@@ -318,17 +318,17 @@ bt_value *ini_parse_value(struct ini_parsing_state *state)
                 */
                const char *id = state->scanner->value.v_identifier;
 
-               if (!strcmp(id, "null") || !strcmp(id, "NULL") ||
-                               !strcmp(id, "nul")) {
+               if (strcmp(id, "null") == 0 || strcmp(id, "NULL") == 0 ||
+                               strcmp(id, "nul") == 0) {
                        value = bt_value_null;
-               } else if (!strcmp(id, "true") || !strcmp(id, "TRUE") ||
-                               !strcmp(id, "yes") ||
-                               !strcmp(id, "YES")) {
+               } else if (strcmp(id, "true") == 0 || strcmp(id, "TRUE") == 0 ||
+                               strcmp(id, "yes") == 0 ||
+                               strcmp(id, "YES") == 0) {
                        value = bt_value_bool_create_init(true);
-               } else if (!strcmp(id, "false") ||
-                               !strcmp(id, "FALSE") ||
-                               !strcmp(id, "no") ||
-                               !strcmp(id, "NO")) {
+               } else if (strcmp(id, "false") == 0 ||
+                               strcmp(id, "FALSE") == 0 ||
+                               strcmp(id, "no") == 0 ||
+                               strcmp(id, "NO") == 0) {
                        value = bt_value_bool_create_init(false);
                } else {
                        value = bt_value_string_create_init(id);
index cbbc9bd2d3dec07c5662f33c95fe1ee54d7ba633..6f6a1f37d5991d01b7cf8b564855ed81313732ac 100644 (file)
@@ -1483,8 +1483,8 @@ gboolean port_id_equal(gconstpointer v1, gconstpointer v2)
        const struct port_id *id1 = v1;
        const struct port_id *id2 = v2;
 
-       return !strcmp(id1->instance_name, id2->instance_name) &&
-               !strcmp(id1->port_name, id2->port_name);
+       return strcmp(id1->instance_name, id2->instance_name) == 0 &&
+               strcmp(id1->port_name, id2->port_name) == 0;
 }
 
 static
index dc51fc6b2eb23b6e6f8d08bd56be87348974210c..ba4711293132ce38bef407a0ebff847bbe57dc60 100644 (file)
@@ -205,7 +205,7 @@ struct bt_ctf_private_value *bt_ctf_attributes_borrow_field_by_name(
                field_name = bt_ctf_value_string_get(
                        bt_ctf_private_value_as_value(attr_field_name_obj));
 
-               if (!strcmp(field_name, name)) {
+               if (strcmp(field_name, name) == 0) {
                        break;
                }
 
index b780d1bf4388112723b774a075df6baa6c270c5e..22119689dd4873fea9a94c55c682b6d741f0fa42 100644 (file)
@@ -410,7 +410,7 @@ struct bt_port *borrow_port_by_name(GPtrArray *ports,
        for (i = 0; i < ports->len; i++) {
                struct bt_port *port = g_ptr_array_index(ports, i);
 
-               if (!strcmp(name, port->name->str)) {
+               if (strcmp(name, port->name->str) == 0) {
                        ret_port = port;
                        break;
                }
index d2047b7c72dbf36cb6e70674a28408cac7d1fd4a..488dd86feab50bb4449d400797c7c255ef9d5555 100644 (file)
@@ -191,7 +191,7 @@ struct bt_value *bt_attributes_borrow_field_by_name(
 
                field_name = bt_value_string_get(attr_field_name_obj);
 
-               if (!strcmp(field_name, name)) {
+               if (strcmp(field_name, name) == 0) {
                        break;
                }
 
index b0dd00cac6333e0568a45f18278c8b799194c9cf..5b64ad28c953c90fbd91fdcc32f5fc5e3968ca28 100644 (file)
@@ -1035,9 +1035,9 @@ int get_boolean(struct ctx *ctx, struct ctf_node *unary_expr)
        {
                const char *str = unary_expr->u.unary_expression.u.string;
 
-               if (!strcmp(str, "true") || !strcmp(str, "TRUE")) {
+               if (strcmp(str, "true") == 0 || strcmp(str, "TRUE") == 0) {
                        ret = TRUE;
-               } else if (!strcmp(str, "false") || !strcmp(str, "FALSE")) {
+               } else if (strcmp(str, "false") == 0 || strcmp(str, "FALSE") == 0) {
                        ret = FALSE;
                } else {
                        _BT_COMP_LOGE_NODE(unary_expr,
@@ -1074,11 +1074,11 @@ enum ctf_byte_order byte_order_from_unary_expr(struct ctx *ctx,
 
        str = unary_expr->u.unary_expression.u.string;
 
-       if (!strcmp(str, "be") || !strcmp(str, "network")) {
+       if (strcmp(str, "be") == 0 || strcmp(str, "network") == 0) {
                bo = CTF_BYTE_ORDER_BIG;
-       } else if (!strcmp(str, "le")) {
+       } else if (strcmp(str, "le") == 0) {
                bo = CTF_BYTE_ORDER_LITTLE;
-       } else if (!strcmp(str, "native")) {
+       } else if (strcmp(str, "native") == 0) {
                bo = CTF_BYTE_ORDER_DEFAULT;
        } else {
                _BT_COMP_LOGE_NODE(unary_expr,
@@ -2396,7 +2396,7 @@ int visit_integer_decl(struct ctx *ctx,
                        goto error;
                }
 
-               if (!strcmp(left->u.unary_expression.u.string, "signed")) {
+               if (strcmp(left->u.unary_expression.u.string, "signed") == 0) {
                        if (_IS_SET(&set, _INTEGER_SIGNED_SET)) {
                                _BT_COMP_LOGE_DUP_ATTR(left, "signed",
                                        "integer field class");
@@ -2414,8 +2414,7 @@ int visit_integer_decl(struct ctx *ctx,
                        }
 
                        _SET(&set, _INTEGER_SIGNED_SET);
-               } else if (!strcmp(left->u.unary_expression.u.string,
-                               "byte_order")) {
+               } else if (strcmp(left->u.unary_expression.u.string, "byte_order") == 0) {
                        if (_IS_SET(&set, _INTEGER_BYTE_ORDER_SET)) {
                                _BT_COMP_LOGE_DUP_ATTR(left, "byte_order",
                                        "integer field class");
@@ -2433,7 +2432,7 @@ int visit_integer_decl(struct ctx *ctx,
                        }
 
                        _SET(&set, _INTEGER_BYTE_ORDER_SET);
-               } else if (!strcmp(left->u.unary_expression.u.string, "size")) {
+               } else if (strcmp(left->u.unary_expression.u.string, "size") == 0) {
                        if (_IS_SET(&set, _INTEGER_SIZE_SET)) {
                                _BT_COMP_LOGE_DUP_ATTR(left, "size",
                                        "integer field class");
@@ -2470,8 +2469,7 @@ int visit_integer_decl(struct ctx *ctx,
                        }
 
                        _SET(&set, _INTEGER_SIZE_SET);
-               } else if (!strcmp(left->u.unary_expression.u.string,
-                               "align")) {
+               } else if (strcmp(left->u.unary_expression.u.string, "align") == 0) {
                        if (_IS_SET(&set, _INTEGER_ALIGN_SET)) {
                                _BT_COMP_LOGE_DUP_ATTR(left, "align",
                                        "integer field class");
@@ -2502,7 +2500,7 @@ int visit_integer_decl(struct ctx *ctx,
                        }
 
                        _SET(&set, _INTEGER_ALIGN_SET);
-               } else if (!strcmp(left->u.unary_expression.u.string, "base")) {
+               } else if (strcmp(left->u.unary_expression.u.string, "base") == 0) {
                        if (_IS_SET(&set, _INTEGER_BASE_SET)) {
                                _BT_COMP_LOGE_DUP_ATTR(left, "base",
                                        "integer field class");
@@ -2550,24 +2548,24 @@ int visit_integer_decl(struct ctx *ctx,
                                        goto error;
                                }
 
-                               if (!strcmp(s_right, "decimal") ||
-                                               !strcmp(s_right, "dec") ||
-                                               !strcmp(s_right, "d") ||
-                                               !strcmp(s_right, "i") ||
-                                               !strcmp(s_right, "u")) {
+                               if (strcmp(s_right, "decimal") == 0 ||
+                                               strcmp(s_right, "dec") == 0 ||
+                                               strcmp(s_right, "d") == 0 ||
+                                               strcmp(s_right, "i") == 0 ||
+                                               strcmp(s_right, "u") == 0) {
                                        base = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL;
-                               } else if (!strcmp(s_right, "hexadecimal") ||
-                                               !strcmp(s_right, "hex") ||
-                                               !strcmp(s_right, "x") ||
-                                               !strcmp(s_right, "X") ||
-                                               !strcmp(s_right, "p")) {
+                               } else if (strcmp(s_right, "hexadecimal") == 0 ||
+                                               strcmp(s_right, "hex") == 0 ||
+                                               strcmp(s_right, "x") == 0 ||
+                                               strcmp(s_right, "X") == 0 ||
+                                               strcmp(s_right, "p") == 0) {
                                        base = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL;
-                               } else if (!strcmp(s_right, "octal") ||
-                                               !strcmp(s_right, "oct") ||
-                                               !strcmp(s_right, "o")) {
+                               } else if (strcmp(s_right, "octal") == 0 ||
+                                               strcmp(s_right, "oct") == 0 ||
+                                               strcmp(s_right, "o") == 0) {
                                        base = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL;
-                               } else if (!strcmp(s_right, "binary") ||
-                                               !strcmp(s_right, "b")) {
+                               } else if (strcmp(s_right, "binary") == 0 ||
+                                               strcmp(s_right, "b") == 0) {
                                        base = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY;
                                } else {
                                        _BT_COMP_LOGE_NODE(right,
@@ -2590,8 +2588,7 @@ int visit_integer_decl(struct ctx *ctx,
                        }
 
                        _SET(&set, _INTEGER_BASE_SET);
-               } else if (!strcmp(left->u.unary_expression.u.string,
-                               "encoding")) {
+               } else if (strcmp(left->u.unary_expression.u.string, "encoding") == 0) {
                        char *s_right;
 
                        if (_IS_SET(&set, _INTEGER_ENCODING_SET)) {
@@ -2618,14 +2615,14 @@ int visit_integer_decl(struct ctx *ctx,
                                goto error;
                        }
 
-                       if (!strcmp(s_right, "UTF8") ||
-                                       !strcmp(s_right, "utf8") ||
-                                       !strcmp(s_right, "utf-8") ||
-                                       !strcmp(s_right, "UTF-8") ||
-                                       !strcmp(s_right, "ASCII") ||
-                                       !strcmp(s_right, "ascii")) {
+                       if (strcmp(s_right, "UTF8") == 0 ||
+                                       strcmp(s_right, "utf8") == 0 ||
+                                       strcmp(s_right, "utf-8") == 0 ||
+                                       strcmp(s_right, "UTF-8") == 0 ||
+                                       strcmp(s_right, "ASCII") == 0 ||
+                                       strcmp(s_right, "ascii") == 0) {
                                encoding = CTF_ENCODING_UTF8;
-                       } else if (!strcmp(s_right, "none")) {
+                       } else if (strcmp(s_right, "none") == 0) {
                                encoding = CTF_ENCODING_NONE;
                        } else {
                                _BT_COMP_LOGE_NODE(right,
@@ -2639,7 +2636,7 @@ int visit_integer_decl(struct ctx *ctx,
 
                        g_free(s_right);
                        _SET(&set, _INTEGER_ENCODING_SET);
-               } else if (!strcmp(left->u.unary_expression.u.string, "map")) {
+               } else if (strcmp(left->u.unary_expression.u.string, "map") == 0) {
                        const char *clock_name;
 
                        if (_IS_SET(&set, _INTEGER_MAP_SET)) {
@@ -2764,7 +2761,7 @@ int visit_floating_point_number_decl(struct ctx *ctx,
                        goto error;
                }
 
-               if (!strcmp(left->u.unary_expression.u.string, "byte_order")) {
+               if (strcmp(left->u.unary_expression.u.string, "byte_order") == 0) {
                        if (_IS_SET(&set, _FLOAT_BYTE_ORDER_SET)) {
                                _BT_COMP_LOGE_DUP_ATTR(left, "byte_order",
                                        "floating point number field class");
@@ -2782,8 +2779,7 @@ int visit_floating_point_number_decl(struct ctx *ctx,
                        }
 
                        _SET(&set, _FLOAT_BYTE_ORDER_SET);
-               } else if (!strcmp(left->u.unary_expression.u.string,
-                               "exp_dig")) {
+               } else if (strcmp(left->u.unary_expression.u.string, "exp_dig") == 0) {
                        if (_IS_SET(&set, _FLOAT_EXP_DIG_SET)) {
                                _BT_COMP_LOGE_DUP_ATTR(left, "exp_dig",
                                        "floating point number field class");
@@ -2804,8 +2800,7 @@ int visit_floating_point_number_decl(struct ctx *ctx,
 
                        exp_dig = right->u.unary_expression.u.unsigned_constant;
                        _SET(&set, _FLOAT_EXP_DIG_SET);
-               } else if (!strcmp(left->u.unary_expression.u.string,
-                               "mant_dig")) {
+               } else if (strcmp(left->u.unary_expression.u.string, "mant_dig") == 0) {
                        if (_IS_SET(&set, _FLOAT_MANT_DIG_SET)) {
                                _BT_COMP_LOGE_DUP_ATTR(left, "mant_dig",
                                        "floating point number field class");
@@ -2827,8 +2822,7 @@ int visit_floating_point_number_decl(struct ctx *ctx,
                        mant_dig = right->u.unary_expression.u.
                                unsigned_constant;
                        _SET(&set, _FLOAT_MANT_DIG_SET);
-               } else if (!strcmp(left->u.unary_expression.u.string,
-                               "align")) {
+               } else if (strcmp(left->u.unary_expression.u.string, "align") == 0) {
                        if (_IS_SET(&set, _FLOAT_ALIGN_SET)) {
                                _BT_COMP_LOGE_DUP_ATTR(left, "align",
                                        "floating point number field class");
@@ -2950,7 +2944,7 @@ int visit_string_decl(struct ctx *ctx,
                        goto error;
                }
 
-               if (!strcmp(left->u.unary_expression.u.string, "encoding")) {
+               if (strcmp(left->u.unary_expression.u.string, "encoding") == 0) {
                        char *s_right;
 
                        if (_IS_SET(&set, _STRING_ENCODING_SET)) {
@@ -2977,14 +2971,14 @@ int visit_string_decl(struct ctx *ctx,
                                goto error;
                        }
 
-                       if (!strcmp(s_right, "UTF8") ||
-                                       !strcmp(s_right, "utf8") ||
-                                       !strcmp(s_right, "utf-8") ||
-                                       !strcmp(s_right, "UTF-8") ||
-                                       !strcmp(s_right, "ASCII") ||
-                                       !strcmp(s_right, "ascii")) {
+                       if (strcmp(s_right, "UTF8") == 0 ||
+                                       strcmp(s_right, "utf8") == 0 ||
+                                       strcmp(s_right, "utf-8") == 0 ||
+                                       strcmp(s_right, "UTF-8") == 0 ||
+                                       strcmp(s_right, "ASCII") == 0 ||
+                                       strcmp(s_right, "ascii") == 0) {
                                encoding = CTF_ENCODING_UTF8;
-                       } else if (!strcmp(s_right, "none")) {
+                       } else if (strcmp(s_right, "none") == 0) {
                                encoding = CTF_ENCODING_NONE;
                        } else {
                                _BT_COMP_LOGE_NODE(right,
@@ -3175,7 +3169,7 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node,
                        goto error;
                }
 
-               if (!strcmp(left, "name")) {
+               if (strcmp(left, "name") == 0) {
                        /* This is already known at this stage */
                        if (_IS_SET(set, _EVENT_NAME_SET)) {
                                _BT_COMP_LOGE_DUP_ATTR(node, "name", "event class");
@@ -3184,7 +3178,7 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node,
                        }
 
                        _SET(set, _EVENT_NAME_SET);
-               } else if (!strcmp(left, "id")) {
+               } else if (strcmp(left, "id") == 0) {
                        int64_t id = -1;
 
                        if (_IS_SET(set, _EVENT_ID_SET)) {
@@ -3206,7 +3200,7 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node,
 
                        event_class->id = id;
                        _SET(set, _EVENT_ID_SET);
-               } else if (!strcmp(left, "stream_id")) {
+               } else if (strcmp(left, "stream_id") == 0) {
                        if (_IS_SET(set, _EVENT_STREAM_ID_SET)) {
                                _BT_COMP_LOGE_DUP_ATTR(node, "stream_id",
                                        "event class");
@@ -3229,7 +3223,7 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node,
                        }
 
                        _SET(set, _EVENT_STREAM_ID_SET);
-               } else if (!strcmp(left, "context")) {
+               } else if (strcmp(left, "context") == 0) {
                        if (_IS_SET(set, _EVENT_CONTEXT_SET)) {
                                _BT_COMP_LOGE_NODE(node,
                                        "Duplicate `context` entry in event class.");
@@ -3250,7 +3244,7 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node,
 
                        BT_ASSERT(event_class->spec_context_fc);
                        _SET(set, _EVENT_CONTEXT_SET);
-               } else if (!strcmp(left, "fields")) {
+               } else if (strcmp(left, "fields") == 0) {
                        if (_IS_SET(set, _EVENT_FIELDS_SET)) {
                                _BT_COMP_LOGE_NODE(node,
                                        "Duplicate `fields` entry in event class.");
@@ -3271,7 +3265,7 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node,
 
                        BT_ASSERT(event_class->payload_fc);
                        _SET(set, _EVENT_FIELDS_SET);
-               } else if (!strcmp(left, "loglevel")) {
+               } else if (strcmp(left, "loglevel") == 0) {
                        uint64_t loglevel_value;
                        bt_event_class_log_level log_level = -1;
 
@@ -3347,7 +3341,7 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node,
                        }
 
                        _SET(set, _EVENT_LOG_LEVEL_SET);
-               } else if (!strcmp(left, "model.emf.uri")) {
+               } else if (strcmp(left, "model.emf.uri") == 0) {
                        char *right;
 
                        if (_IS_SET(set, _EVENT_MODEL_EMF_URI_SET)) {
@@ -3420,7 +3414,7 @@ char *get_event_decl_name(struct ctx *ctx, struct ctf_node *node)
                        goto error;
                }
 
-               if (!strcmp(left, "name")) {
+               if (strcmp(left, "name") == 0) {
                        name = concatenate_unary_strings(
                                &iter->u.ctf_expression.right);
                        if (!name) {
@@ -3733,7 +3727,7 @@ int visit_stream_decl_entry(struct ctx *ctx, struct ctf_node *node,
                        goto error;
                }
 
-               if (!strcmp(left, "id")) {
+               if (strcmp(left, "id") == 0) {
                        int64_t id;
 
                        if (_IS_SET(set, _STREAM_ID_SET)) {
@@ -3766,7 +3760,7 @@ int visit_stream_decl_entry(struct ctx *ctx, struct ctf_node *node,
 
                        stream_class->id = id;
                        _SET(set, _STREAM_ID_SET);
-               } else if (!strcmp(left, "event.header")) {
+               } else if (strcmp(left, "event.header") == 0) {
                        if (_IS_SET(set, _STREAM_EVENT_HEADER_SET)) {
                                _BT_COMP_LOGE_NODE(node,
                                        "Duplicate `event.header` entry in stream class.");
@@ -3795,7 +3789,7 @@ int visit_stream_decl_entry(struct ctx *ctx, struct ctf_node *node,
                        }
 
                        _SET(set, _STREAM_EVENT_HEADER_SET);
-               } else if (!strcmp(left, "event.context")) {
+               } else if (strcmp(left, "event.context") == 0) {
                        if (_IS_SET(set, _STREAM_EVENT_CONTEXT_SET)) {
                                _BT_COMP_LOGE_NODE(node,
                                        "Duplicate `event.context` entry in stream class.");
@@ -3816,7 +3810,7 @@ int visit_stream_decl_entry(struct ctx *ctx, struct ctf_node *node,
 
                        BT_ASSERT(stream_class->event_common_context_fc);
                        _SET(set, _STREAM_EVENT_CONTEXT_SET);
-               } else if (!strcmp(left, "packet.context")) {
+               } else if (strcmp(left, "packet.context") == 0) {
                        if (_IS_SET(set, _STREAM_PACKET_CONTEXT_SET)) {
                                _BT_COMP_LOGE_NODE(node,
                                        "Duplicate `packet.context` entry in stream class.");
@@ -4009,7 +4003,7 @@ int visit_trace_decl_entry(struct ctx *ctx, struct ctf_node *node, int *set)
                        goto error;
                }
 
-               if (!strcmp(left, "major")) {
+               if (strcmp(left, "major") == 0) {
                        if (_IS_SET(set, _TRACE_MAJOR_SET)) {
                                _BT_COMP_LOGE_DUP_ATTR(node, "major", "trace");
                                ret = -EPERM;
@@ -4033,7 +4027,7 @@ int visit_trace_decl_entry(struct ctx *ctx, struct ctf_node *node, int *set)
 
                        ctx->ctf_tc->major = val;
                        _SET(set, _TRACE_MAJOR_SET);
-               } else if (!strcmp(left, "minor")) {
+               } else if (strcmp(left, "minor") == 0) {
                        if (_IS_SET(set, _TRACE_MINOR_SET)) {
                                _BT_COMP_LOGE_DUP_ATTR(node, "minor", "trace");
                                ret = -EPERM;
@@ -4057,7 +4051,7 @@ int visit_trace_decl_entry(struct ctx *ctx, struct ctf_node *node, int *set)
 
                        ctx->ctf_tc->minor = val;
                        _SET(set, _TRACE_MINOR_SET);
-               } else if (!strcmp(left, "uuid")) {
+               } else if (strcmp(left, "uuid") == 0) {
                        if (_IS_SET(set, _TRACE_UUID_SET)) {
                                _BT_COMP_LOGE_DUP_ATTR(node, "uuid", "trace");
                                ret = -EPERM;
@@ -4075,7 +4069,7 @@ int visit_trace_decl_entry(struct ctx *ctx, struct ctf_node *node, int *set)
 
                        ctx->ctf_tc->is_uuid_set = true;
                        _SET(set, _TRACE_UUID_SET);
-               } else if (!strcmp(left, "byte_order")) {
+               } else if (strcmp(left, "byte_order") == 0) {
                        /* Default byte order is already known at this stage */
                        if (_IS_SET(set, _TRACE_BYTE_ORDER_SET)) {
                                _BT_COMP_LOGE_DUP_ATTR(node, "byte_order",
@@ -4086,7 +4080,7 @@ int visit_trace_decl_entry(struct ctx *ctx, struct ctf_node *node, int *set)
 
                        BT_ASSERT(ctx->ctf_tc->default_byte_order != -1);
                        _SET(set, _TRACE_BYTE_ORDER_SET);
-               } else if (!strcmp(left, "packet.header")) {
+               } else if (strcmp(left, "packet.header") == 0) {
                        if (_IS_SET(set, _TRACE_PACKET_HEADER_SET)) {
                                _BT_COMP_LOGE_NODE(node,
                                        "Duplicate `packet.header` entry in trace.");
@@ -4314,7 +4308,7 @@ int set_trace_byte_order(struct ctx *ctx, struct ctf_node *trace_node)
                                goto error;
                        }
 
-                       if (!strcmp(left, "byte_order")) {
+                       if (strcmp(left, "byte_order") == 0) {
                                enum ctf_byte_order bo;
 
                                if (_IS_SET(&set, _TRACE_BYTE_ORDER_SET)) {
@@ -4389,7 +4383,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node,
                goto error;
        }
 
-       if (!strcmp(left, "name")) {
+       if (strcmp(left, "name") == 0) {
                char *right;
 
                if (_IS_SET(set, _CLOCK_NAME_SET)) {
@@ -4410,7 +4404,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node,
                g_string_assign(clock->name, right);
                g_free(right);
                _SET(set, _CLOCK_NAME_SET);
-       } else if (!strcmp(left, "uuid")) {
+       } else if (strcmp(left, "uuid") == 0) {
                bt_uuid_t uuid;
 
                if (_IS_SET(set, _CLOCK_UUID_SET)) {
@@ -4430,7 +4424,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node,
                clock->has_uuid = true;
                bt_uuid_copy(clock->uuid, uuid);
                _SET(set, _CLOCK_UUID_SET);
-       } else if (!strcmp(left, "description")) {
+       } else if (strcmp(left, "description") == 0) {
                char *right;
 
                if (_IS_SET(set, _CLOCK_DESCRIPTION_SET)) {
@@ -4452,7 +4446,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node,
                g_string_assign(clock->description, right);
                g_free(right);
                _SET(set, _CLOCK_DESCRIPTION_SET);
-       } else if (!strcmp(left, "freq")) {
+       } else if (strcmp(left, "freq") == 0) {
                uint64_t freq = UINT64_C(-1);
 
                if (_IS_SET(set, _CLOCK_FREQ_SET)) {
@@ -4480,7 +4474,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node,
 
                clock->frequency = freq;
                _SET(set, _CLOCK_FREQ_SET);
-       } else if (!strcmp(left, "precision")) {
+       } else if (strcmp(left, "precision") == 0) {
                uint64_t precision;
 
                if (_IS_SET(set, _CLOCK_PRECISION_SET)) {
@@ -4501,7 +4495,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node,
 
                clock->precision = precision;
                _SET(set, _CLOCK_PRECISION_SET);
-       } else if (!strcmp(left, "offset_s")) {
+       } else if (strcmp(left, "offset_s") == 0) {
                if (_IS_SET(set, _CLOCK_OFFSET_S_SET)) {
                        _BT_COMP_LOGE_DUP_ATTR(entry_node, "offset_s",
                                "clock class");
@@ -4519,7 +4513,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node,
                }
 
                _SET(set, _CLOCK_OFFSET_S_SET);
-       } else if (!strcmp(left, "offset")) {
+       } else if (strcmp(left, "offset") == 0) {
                if (_IS_SET(set, _CLOCK_OFFSET_SET)) {
                        _BT_COMP_LOGE_DUP_ATTR(entry_node, "offset", "clock class");
                        ret = -EPERM;
@@ -4536,7 +4530,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node,
                }
 
                _SET(set, _CLOCK_OFFSET_SET);
-       } else if (!strcmp(left, "absolute")) {
+       } else if (strcmp(left, "absolute") == 0) {
                struct ctf_node *right;
 
                if (_IS_SET(set, _CLOCK_ABSOLUTE_SET)) {
index 0d9e884207c0e5b34dce86888b2d8665edadf25e..d9493e6639e290170642bd2b9dc2dbc352392247 100644 (file)
@@ -899,7 +899,7 @@ int create_ds_file_groups(struct ctf_fs_trace *ctf_fs_trace)
        while ((basename = g_dir_read_name(dir))) {
                struct ctf_fs_file *file;
 
-               if (!strcmp(basename, CTF_FS_METADATA_FILENAME)) {
+               if (strcmp(basename, CTF_FS_METADATA_FILENAME) == 0) {
                        /* Ignore the metadata stream. */
                        BT_COMP_LOGI("Ignoring metadata file `%s" G_DIR_SEPARATOR_S "%s`",
                                ctf_fs_trace->path->str, basename);
@@ -1997,10 +1997,10 @@ bt_component_class_query_method_status ctf_fs_query(
        bt_component_class_query_method_status status =
                BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK;
 
-       if (!strcmp(object, "metadata-info")) {
+       if (strcmp(object, "metadata-info") == 0) {
                status = metadata_info_query(comp_class, params, log_level,
                        result);
-       } else if (!strcmp(object, "trace-info")) {
+       } else if (strcmp(object, "trace-info") == 0) {
                status = trace_info_query(comp_class, params, log_level,
                        result);
        } else {
index 01b4b82315f63b143e4dada262b04a2c38f42ccb..65433896ea3953e58f0151fa9aa047f2e5bec38d 100644 (file)
@@ -347,9 +347,8 @@ int list_update_session(bt_value *results,
                hostname_str = bt_value_string_get(hostname);
                session_name_str = bt_value_string_get(session_name);
 
-               if (!strcmp(session->hostname, hostname_str)
-                               && !strcmp(session->session_name,
-                                       session_name_str)) {
+               if (strcmp(session->hostname, hostname_str) == 0
+                               && strcmp(session->session_name, session_name_str) == 0) {
                        int64_t val;
                        uint32_t streams = be32toh(session->streams);
                        uint32_t clients = be32toh(session->clients);
index 30fc7be9701dd850c4c2664e759d2d5c7d2e991c..48c7a9a002d6fc4066d2c668c4dfc69f618bcc48 100644 (file)
@@ -415,9 +415,9 @@ int apply_params(struct pretty_component *pretty, const bt_value *params)
        apply_one_string("name-default", params, &str);
        if (!str) {
                pretty->options.name_default = PRETTY_DEFAULT_UNSET;
-       } else if (!strcmp(str, "show")) {
+       } else if (strcmp(str, "show") == 0) {
                pretty->options.name_default = PRETTY_DEFAULT_SHOW;
-       } else if (!strcmp(str, "hide")) {
+       } else if (strcmp(str, "hide") == 0) {
                pretty->options.name_default = PRETTY_DEFAULT_HIDE;
        } else {
                ret = -1;
@@ -482,9 +482,9 @@ int apply_params(struct pretty_component *pretty, const bt_value *params)
        apply_one_string("field-default", params, &str);
        if (!str) {
                pretty->options.field_default = PRETTY_DEFAULT_UNSET;
-       } else if (!strcmp(str, "show")) {
+       } else if (strcmp(str, "show") == 0) {
                pretty->options.field_default = PRETTY_DEFAULT_SHOW;
-       } else if (!strcmp(str, "hide")) {
+       } else if (strcmp(str, "hide") == 0) {
                pretty->options.field_default = PRETTY_DEFAULT_HIDE;
        } else {
                ret = -1;
index 73edf75c9857a550cf68914f9c45448af10ba3fd..91b2e6337d406cde49b4dbac3199b223617dbb88 100644 (file)
@@ -247,7 +247,7 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
        ok(bt_ctf_field_type_enumeration_signed_get_mapping_by_index(enum_type, 6, &ret_char,
                &ret_range_start_int64_t, &ret_range_end_int64_t) == 0,
                "bt_ctf_field_type_enumeration_signed_get_mapping_by_index returns a value");
-       ok(!strcmp(ret_char, mapping_name_test),
+       ok(strcmp(ret_char, mapping_name_test) == 0,
                "bt_ctf_field_type_enumeration_signed_get_mapping_by_index returns a correct mapping name");
        ok(ret_range_start_int64_t == 42,
                "bt_ctf_field_type_enumeration_signed_get_mapping_by_index returns a correct mapping start");
@@ -289,7 +289,7 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
        ok(bt_ctf_field_type_enumeration_unsigned_get_mapping_by_index(enum_type_unsigned, 4, &ret_char,
                &ret_range_start_uint64_t, &ret_range_end_uint64_t) == 0,
                "bt_ctf_field_type_enumeration_unsigned_get_mapping_by_index returns a value");
-       ok(!strcmp(ret_char, mapping_name_test),
+       ok(strcmp(ret_char, mapping_name_test) == 0,
                "bt_ctf_field_type_enumeration_unsigned_get_mapping_by_index returns a correct mapping name");
        ok(ret_range_start_uint64_t == 42,
                "bt_ctf_field_type_enumeration_unsigned_get_mapping_by_index returns a correct mapping start");
@@ -580,7 +580,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
        bt_ctf_object_put_ref(ret_field_type);
 
        ret_string = bt_ctf_field_type_variant_get_tag_name(variant_type);
-       ok(ret_string ? !strcmp(ret_string, "variant_selector") : 0,
+       ok(ret_string ? strcmp(ret_string, "variant_selector") == 0 : 0,
                "bt_ctf_field_type_variant_get_tag_name returns the correct variant tag name");
        ret_field_type = bt_ctf_field_type_variant_get_field_type_by_name(
                variant_type, "INT16_TYPE");
@@ -598,7 +598,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
                "bt_ctf_field_type_variant_get_field handles a NULL field type correctly");
        ok(bt_ctf_field_type_variant_get_field_by_index(variant_type, &ret_string, &ret_field_type, 1) == 0,
                "bt_ctf_field_type_variant_get_field returns a field");
-       ok(!strcmp("INT16_TYPE", ret_string),
+       ok(strcmp("INT16_TYPE", ret_string) == 0,
                "bt_ctf_field_type_variant_get_field returns a correct field name");
        ok(ret_field_type == int_16_type,
                "bt_ctf_field_type_variant_get_field returns a correct field type");
@@ -635,7 +635,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
                "Add composite structure to an event");
 
        ret_string = bt_ctf_event_class_get_name(event_class);
-       ok(!strcmp(ret_string, complex_test_event_string),
+       ok(strcmp(ret_string, complex_test_event_string) == 0,
                "bt_ctf_event_class_get_name returns a correct name");
        ok(bt_ctf_event_class_get_id(event_class) < 0,
                "bt_ctf_event_class_get_id returns a negative value when not set");
@@ -758,7 +758,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
 
        ret_string = bt_ctf_field_string_get_value(a_string_field);
        ok(ret_string, "bt_ctf_field_string_get_value returns a string");
-       ok(ret_string ? !strcmp(ret_string, test_string_cat) : 0,
+       ok(ret_string ? strcmp(ret_string, test_string_cat) == 0 : 0,
                "bt_ctf_field_string_get_value returns a correct value");
        bt_ctf_field_integer_unsigned_set_value(uint_35_field,
                SEQUENCE_TEST_LENGTH);
@@ -933,7 +933,7 @@ void type_field_tests()
 
        ret_string = bt_ctf_field_type_sequence_get_length_field_name(
                sequence_type);
-       ok(!strcmp(ret_string, "seq_len"),
+       ok(strcmp(ret_string, "seq_len") == 0,
                "bt_ctf_field_type_sequence_get_length_field_name returns the correct value");
        returned_type = bt_ctf_field_type_sequence_get_element_field_type(
                sequence_type);
@@ -982,7 +982,7 @@ void type_field_tests()
        ok(bt_ctf_field_type_structure_get_field(structure_seq_type,
                &ret_string, &returned_type, 1) == 0,
                "bt_ctf_field_type_structure_get_field returns a field");
-       ok(!strcmp(ret_string, "a_sequence"),
+       ok(strcmp(ret_string, "a_sequence") == 0,
                "bt_ctf_field_type_structure_get_field returns a correct field name");
        ok(returned_type == sequence_type,
                "bt_ctf_field_type_structure_get_field returns a correct field type");
@@ -1717,7 +1717,7 @@ int main(int argc, char **argv)
        ok(clock, "Clock created sucessfully");
        returned_clock_name = bt_ctf_clock_get_name(clock);
        ok(returned_clock_name, "bt_ctf_clock_get_name returns a clock name");
-       ok(returned_clock_name ? !strcmp(returned_clock_name, clock_name) : 0,
+       ok(returned_clock_name ? strcmp(returned_clock_name, clock_name) == 0 : 0,
                "Returned clock name is valid");
 
        returned_clock_description = bt_ctf_clock_get_description(clock);
@@ -1729,7 +1729,7 @@ int main(int argc, char **argv)
        ok(returned_clock_description,
                "bt_ctf_clock_get_description returns a description.");
        ok(returned_clock_description ?
-               !strcmp(returned_clock_description, clock_description) : 0,
+               strcmp(returned_clock_description, clock_description) == 0 : 0,
                "Returned clock description is valid");
 
        ok(bt_ctf_clock_get_frequency(clock) == DEFAULT_CLOCK_FREQ,
@@ -1795,7 +1795,7 @@ int main(int argc, char **argv)
        /* Define a stream class */
        stream_class = bt_ctf_stream_class_create("test_stream");
        ret_string = bt_ctf_stream_class_get_name(stream_class);
-       ok(ret_string && !strcmp(ret_string, "test_stream"),
+       ok(ret_string && strcmp(ret_string, "test_stream") == 0,
                "bt_ctf_stream_class_get_name returns a correct stream class name");
 
        ok(bt_ctf_stream_class_get_clock(stream_class) == NULL,
index ed7e4049a99b4f8aa3dfd337c3fbfaa9577194d7..b0cd85931f19108b926017151b15e30e2185df55 100644 (file)
@@ -177,12 +177,12 @@ void test_string(void)
                "bt_value_string_create() returns a string value object");
 
        value = bt_value_string_get(obj);
-       ok(value && !strcmp(value, ""),
+       ok(value && strcmp(value, "") == 0,
                "default string value object value is \"\"");
 
        bt_value_string_set(obj, "hello worldz");
        value = bt_value_string_get(obj);
-       ok(value && !strcmp(value, "hello worldz"),
+       ok(value && strcmp(value, "hello worldz") == 0,
                "bt_value_string_get() works");
 
        BT_VALUE_PUT_REF_AND_RESET(obj);
@@ -192,7 +192,7 @@ void test_string(void)
        ok(obj && bt_value_is_string(obj),
                "bt_value_string_create_init() returns a string value object");
        value = bt_value_string_get(obj);
-       ok(value && !strcmp(value, "initial value"),
+       ok(value && strcmp(value, "initial value") == 0,
                "bt_value_string_create_init() sets the appropriate initial value");
 
        BT_VALUE_PUT_REF_AND_RESET(obj);
@@ -327,7 +327,7 @@ void test_array(void)
        ok(obj && bt_value_is_string(obj),
                "bt_value_array_append_string_element() appends a string value object");
        string_value = bt_value_string_get(obj);
-       ok(!ret && string_value && !strcmp(string_value, "bt_value"),
+       ok(!ret && string_value && strcmp(string_value, "bt_value") == 0,
                "bt_value_array_append_string_element() appends the appropriate value");
        obj = bt_value_array_borrow_element_by_index(array_obj, 10);
        ok(obj && bt_value_is_array(obj),
@@ -379,7 +379,7 @@ bt_bool test_map_foreach_cb_check(const char *key, bt_value *object,
 {
        struct map_foreach_checklist *checklist = data;
 
-       if (!strcmp(key, "bt_bool")) {
+       if (strcmp(key, "bt_bool") == 0) {
                if (checklist->bool1) {
                        fail("test_map_foreach_cb_check(): duplicate key \"bt_bool\"");
                } else {
@@ -394,7 +394,7 @@ bt_bool test_map_foreach_cb_check(const char *key, bt_value *object,
                                fail("test_map_foreach_cb_check(): \"bt_bool\" value object has the wrong value");
                        }
                }
-       } else if (!strcmp(key, "uint")) {
+       } else if (strcmp(key, "uint") == 0) {
                if (checklist->uint) {
                        fail("test_map_foreach_cb_check(): duplicate key \"uint\"");
                } else {
@@ -409,7 +409,7 @@ bt_bool test_map_foreach_cb_check(const char *key, bt_value *object,
                                fail("test_map_foreach_cb_check(): \"uint\" value object has the wrong value");
                        }
                }
-       } else if (!strcmp(key, "int")) {
+       } else if (strcmp(key, "int") == 0) {
                if (checklist->int1) {
                        fail("test_map_foreach_cb_check(): duplicate key \"int\"");
                } else {
@@ -424,7 +424,7 @@ bt_bool test_map_foreach_cb_check(const char *key, bt_value *object,
                                fail("test_map_foreach_cb_check(): \"int\" value object has the wrong value");
                        }
                }
-       } else if (!strcmp(key, "real")) {
+       } else if (strcmp(key, "real") == 0) {
                if (checklist->real1) {
                        fail("test_map_foreach_cb_check(): duplicate key \"real\"");
                } else {
@@ -439,14 +439,14 @@ bt_bool test_map_foreach_cb_check(const char *key, bt_value *object,
                                fail("test_map_foreach_cb_check(): \"real\" value object has the wrong value");
                        }
                }
-       } else if (!strcmp(key, "null")) {
+       } else if (strcmp(key, "null") == 0) {
                if (checklist->null1) {
                        fail("test_map_foreach_cb_check(): duplicate key \"bt_bool\"");
                } else {
                        ok(bt_value_is_null(object), "test_map_foreach_cb_check(): success getting \"null\" value object");
                        checklist->null1 = BT_TRUE;
                }
-       } else if (!strcmp(key, "bool2")) {
+       } else if (strcmp(key, "bool2") == 0) {
                if (checklist->bool2) {
                        fail("test_map_foreach_cb_check(): duplicate key \"bool2\"");
                } else {
@@ -461,7 +461,7 @@ bt_bool test_map_foreach_cb_check(const char *key, bt_value *object,
                                fail("test_map_foreach_cb_check(): \"bool2\" value object has the wrong value");
                        }
                }
-       } else if (!strcmp(key, "int2")) {
+       } else if (strcmp(key, "int2") == 0) {
                if (checklist->int2) {
                        fail("test_map_foreach_cb_check(): duplicate key \"int2\"");
                } else {
@@ -476,7 +476,7 @@ bt_bool test_map_foreach_cb_check(const char *key, bt_value *object,
                                fail("test_map_foreach_cb_check(): \"int2\" value object has the wrong value");
                        }
                }
-       } else if (!strcmp(key, "real2")) {
+       } else if (strcmp(key, "real2") == 0) {
                if (checklist->real2) {
                        fail("test_map_foreach_cb_check(): duplicate key \"real2\"");
                } else {
@@ -491,7 +491,7 @@ bt_bool test_map_foreach_cb_check(const char *key, bt_value *object,
                                fail("test_map_foreach_cb_check(): \"real2\" value object has the wrong value");
                        }
                }
-       } else if (!strcmp(key, "string2")) {
+       } else if (strcmp(key, "string2") == 0) {
                if (checklist->string2) {
                        fail("test_map_foreach_cb_check(): duplicate key \"string2\"");
                } else {
@@ -499,14 +499,14 @@ bt_bool test_map_foreach_cb_check(const char *key, bt_value *object,
 
                        val = bt_value_string_get(object);
 
-                       if (val && !strcmp(val, "bt_value")) {
+                       if (val && strcmp(val, "bt_value") == 0) {
                                pass("test_map_foreach_cb_check(): \"string2\" value object has the right value");
                                checklist->string2 = BT_TRUE;
                        } else {
                                fail("test_map_foreach_cb_check(): \"string2\" value object has the wrong value");
                        }
                }
-       } else if (!strcmp(key, "array2")) {
+       } else if (strcmp(key, "array2") == 0) {
                if (checklist->array2) {
                        fail("test_map_foreach_cb_check(): duplicate key \"array2\"");
                } else {
@@ -515,7 +515,7 @@ bt_bool test_map_foreach_cb_check(const char *key, bt_value *object,
                                "test_map_foreach_cb_check(): \"array2\" value object is empty");
                        checklist->array2 = BT_TRUE;
                }
-       } else if (!strcmp(key, "map2")) {
+       } else if (strcmp(key, "map2") == 0) {
                if (checklist->map2) {
                        fail("test_map_foreach_cb_check(): duplicate key \"map2\"");
                } else {
This page took 0.045851 seconds and 4 git commands to generate.