Revert "Fix parser bug with ranges"
authorJens Axboe <jaxboe@fusionio.com>
Wed, 7 Sep 2011 20:10:11 +0000 (22:10 +0200)
committerJens Axboe <jaxboe@fusionio.com>
Wed, 7 Sep 2011 20:10:11 +0000 (22:10 +0200)
This reverts commit f20485ad77872d6c5084dead547420386a6ecd5e.

options.c
parse.c
parse.h

index 06ac6596292851ed0f95a4df8d096a513076026b..74c24d02d5d4bc200da3cf671c64d363d02e92a4 100644 (file)
--- a/options.c
+++ b/options.c
@@ -102,7 +102,7 @@ static int bssplit_ddir(struct thread_data *td, int ddir, char *str)
                } else
                        perc = -1;
 
-               if (str_to_decimal(fname, &val, 1, 1, td)) {
+               if (str_to_decimal(fname, &val, 1, td)) {
                        log_err("fio: bssplit conversion failed\n");
                        free(td->o.bssplit);
                        return 1;
@@ -213,7 +213,7 @@ static int str_rw_cb(void *data, const char *str)
        else {
                long long val;
 
-               if (str_to_decimal(nr, &val, 1, 0, td)) {
+               if (str_to_decimal(nr, &val, 1, td)) {
                        log_err("fio: rw postfix parsing failed\n");
                        free(nr);
                        return 1;
diff --git a/parse.c b/parse.c
index 55de4f0b8fa3643703294e640c39ee5b32819ae8..2dee446d7a8a2ad0614e37c4a5bd09796f5e296d 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -184,7 +184,7 @@ static unsigned long long __get_mult_bytes(const char *p, void *data,
 }
 
 static unsigned long long get_mult_bytes(const char *str, int len, void *data,
-                                        int *percent, int is_range)
+                                        int *percent)
 {
        const char *p = str;
 
@@ -195,9 +195,7 @@ static unsigned long long get_mult_bytes(const char *str, int len, void *data,
          * Go forward until we hit a non-digit, or +/- sign
          */
        while ((p - str) <= len) {
-               if (!isdigit((int) *p) && (*p != '+'))
-                       break;
-               if (!is_range && (*p != '-'))
+               if (!isdigit((int) *p) && (*p != '+') && (*p != '-'))
                        break;
                p++;
        }
@@ -219,7 +217,7 @@ int str_to_float(const char *str, double *val)
 /*
  * convert string into decimal value, noting any size suffix
  */
-int str_to_decimal(const char *str, long long *val, int kilo, int is_range, void *data)
+int str_to_decimal(const char *str, long long *val, int kilo, void *data)
 {
        int len, base;
 
@@ -240,7 +238,7 @@ int str_to_decimal(const char *str, long long *val, int kilo, int is_range, void
                unsigned long long mult;
                int perc = 0;
 
-               mult = get_mult_bytes(str, len, data, &perc, is_range);
+               mult = get_mult_bytes(str, len, data, &perc);
                if (perc)
                        *val = -1ULL - *val;
                else
@@ -251,14 +249,14 @@ int str_to_decimal(const char *str, long long *val, int kilo, int is_range, void
        return 0;
 }
 
-static int check_str_bytes(const char *p, long long *val, int is_range, void *data)
+static int check_str_bytes(const char *p, long long *val, void *data)
 {
-       return str_to_decimal(p, val, 1, is_range, data);
+       return str_to_decimal(p, val, 1, data);
 }
 
 static int check_str_time(const char *p, long long *val)
 {
-       return str_to_decimal(p, val, 0, 0, NULL);
+       return str_to_decimal(p, val, 0, NULL);
 }
 
 void strip_blank_front(char **p)
@@ -295,7 +293,7 @@ static int check_range_bytes(const char *str, long *val, void *data)
 {
        long long __val;
 
-       if (!str_to_decimal(str, &__val, 1, 1, data)) {
+       if (!str_to_decimal(str, &__val, 1, data)) {
                *val = __val;
                return 0;
        }
@@ -404,7 +402,7 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data,
                if (is_time)
                        ret = check_str_time(ptr, &ull);
                else
-                       ret = check_str_bytes(ptr, &ull, 0, data);
+                       ret = check_str_bytes(ptr, &ull, data);
 
                if (ret)
                        break;
diff --git a/parse.h b/parse.h
index f1f39275d84be8ce9bb6ab871c82acbb707ba6f1..f2265a43226cf1584baf6f31fcf0e981351568fc 100644 (file)
--- a/parse.h
+++ b/parse.h
@@ -75,7 +75,7 @@ extern void options_init(struct fio_option *);
 
 extern void strip_blank_front(char **);
 extern void strip_blank_end(char *);
-extern int str_to_decimal(const char *, long long *, int, int, void *);
+extern int str_to_decimal(const char *, long long *, int, void *);
 
 /*
  * Handlers for the options