From 1d2123e0c82a06bbdd02c28aadb77e0a7a0058c5 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 10 Nov 2005 11:59:23 +0100 Subject: [PATCH] [PATCH] fio: Add check_strset() --- fio-ini.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/fio-ini.c b/fio-ini.c index af93969..3df09b7 100644 --- a/fio-ini.c +++ b/fio-ini.c @@ -400,6 +400,11 @@ static int check_int(char *p, char *name, unsigned int *val) return 1; } +static int check_strset(char *p, char *name) +{ + return strncmp(p, name, strlen(name) - 1); +} + static int is_empty_or_comment(char *line) { unsigned int i; @@ -584,42 +589,42 @@ int parse_jobs_ini(char *file) fgetpos(f, &off); continue; } - if (!strncmp(p, "sequential", 10)) { + if (!check_strset(p, "sequential")) { td->sequential = 1; fgetpos(f, &off); continue; } - if (!strncmp(p, "random", 6)) { + if (!check_strset(p, "random")) { td->sequential = 0; fgetpos(f, &off); continue; } - if (!strncmp(p, "aio", 3)) { + if (!check_strset(p, "aio")) { td->use_aio = 1; fgetpos(f, &off); continue; } - if (!strncmp(p, "create", 6)) { + if (!check_strset(p, "create")) { td->create_file = 1; fgetpos(f, &off); continue; } - if (!strncmp(p, "overwrite", 9)) { + if (!check_strset(p, "overwrite")) { td->overwrite = 1; fgetpos(f, &off); continue; } - if (!strncmp(p, "exitall", 7)) { + if (!check_strset(p, "exitall")) { exitall_on_terminate = 1; fgetpos(f, &off); continue; } - if (!strncmp(p, "stonewall", 9)) { + if (!check_strset(p, "stonewall")) { td->stonewall = 1; fgetpos(f, &off); continue; } - if (!strncmp(p, "thread", 6)) { + if (!check_strset(p, "thread")) { td->use_thread = 1; fgetpos(f, &off); continue; -- 2.25.1