"!strcmp" is hard to read, and "not strcmp" is misleading.
/* Set logs and init log submodule */
for (int i = 1; i < *argc; i++) {
/* Set logs and init log submodule */
for (int i = 1; i < *argc; i++) {
- if (!strcmp("--", argv[i])) {
+ if (strcmp("--", argv[i]) == 0) {
parse_args = 0;
argv[j++] = argv[i]; // Keep the '--' for sg_config
parse_args = 0;
argv[j++] = argv[i]; // Keep the '--' for sg_config
- } else if (parse_args && !strncmp(argv[i], "--log=", strlen("--log="))) {
+ } else if (parse_args && strncmp(argv[i], "--log=", strlen("--log=")) == 0) {
char* opt = strchr(argv[i], '=');
opt++;
xbt_log_control_set(opt);
XBT_DEBUG("Did apply '%s' as log setting", opt);
char* opt = strchr(argv[i], '=');
opt++;
xbt_log_control_set(opt);
XBT_DEBUG("Did apply '%s' as log setting", opt);
- } else if (parse_args && !strcmp(argv[i], "--help-logs")) {
+ } else if (parse_args && strcmp(argv[i], "--help-logs") == 0) {
- } else if (parse_args && !strcmp(argv[i], "--help-log-categories")) {
+ } else if (parse_args && strcmp(argv[i], "--help-log-categories") == 0) {
help_requested |= 2U;
} else {
argv[j++] = argv[i];
help_requested |= 2U;
} else {
argv[j++] = argv[i];
XBT_DEBUG("Search '%s' into '%s' (firstChild='%s'; nextSibling='%s')", name,
cat->name, (cat->firstChild ? cat->firstChild->name : "none"),
(cat->nextSibling ? cat->nextSibling->name : "none"));
XBT_DEBUG("Search '%s' into '%s' (firstChild='%s'; nextSibling='%s')", name,
cat->name, (cat->firstChild ? cat->firstChild->name : "none"),
(cat->nextSibling ? cat->nextSibling->name : "none"));
- if (!strcmp(cat->name, name))
+ if (strcmp(cat->name, name) == 0)
return cat;
for (child = cat->firstChild; child != nullptr; child = child->nextSibling) {
return cat;
for (child = cat->firstChild; child != nullptr; child = child->nextSibling) {
XBT_DEBUG("Parse log settings '%s'", control_string);
/* Special handling of no_loc request, which asks for any file localization to be omitted (for tesh runs) */
XBT_DEBUG("Parse log settings '%s'", control_string);
/* Special handling of no_loc request, which asks for any file localization to be omitted (for tesh runs) */
- if (!strcmp(control_string, "no_loc")) {
+ if (strcmp(control_string, "no_loc") == 0) {
xbt_log_no_loc = 1;
return;
}
xbt_log_no_loc = 1;
return;
}