@@ -43,7 +43,7 @@ static int btrfs(struct img_type *img,
ERROR("Wrong operation of btrfs filesystem: %s", cmd);
return -EINVAL;
}
- bool tomount = IS_STR_EQUAL(dict_get_value(&img->properties, "mount"), "true");
+ bool tomount = strtobool(dict_get_value(&img->properties, "mount"));
if (tomount) {
if (!strlen(img->device)) {
ERROR("btrfs must be mounted, no device set");
@@ -35,7 +35,7 @@ static int diskformat(struct img_type *img,
char *force = dict_get_value(&img->properties, "force");
- if (force != NULL && strcmp(force, "true") == 0) {
+ if (force != NULL && strtobool(force)) {
; /* Skip file system exists check */
} else {
/* Check if file system exists */
@@ -1275,7 +1275,7 @@ static int diskpart(struct img_type *img,
part->flags |= DOS_FLAG_ACTIVE;
break;
case PART_FORCE:
- part->force = strcmp(equal, "true") == 0;
+ part->force = strtobool(equal);
TRACE("Force flag explicitly mentioned, value %d", part->force);
break;
}
@@ -672,8 +672,7 @@ static int get_gpio_from_property(struct dict_list *prop, struct mode_setup *gpi
return -EINVAL;
break;
case 2:
- if (!strcmp(s, "true"))
- gpio->active_low = true;
+ gpio->active_low = strtobool(s);
break;
}
@@ -731,7 +730,7 @@ static int install_uc_firmware_image(struct img_type *img,
properties = dict_get_list(&img->properties, "debug");
if (properties) {
entry = LIST_FIRST(properties);
- if (entry && !strcmp(entry->value, "true"))
+ if (entry && strtobool(entry->value))
hnd_data.debug = true;
}
Replacing occurencies of string comparison with the global function. Signed-off-by: Stefano Babic <stefano.babic@swupdate.org> --- handlers/btrfs_handler.c | 2 +- handlers/diskformat_handler.c | 2 +- handlers/diskpart_handler.c | 2 +- handlers/ucfw_handler.c | 5 ++--- 4 files changed, 5 insertions(+), 6 deletions(-) -- 2.34.1