[PATCH] Convert some options to use check_strstore() if they only dupe the arg
authorJens Axboe <axboe@suse.de>
Wed, 7 Jun 2006 08:34:49 +0000 (10:34 +0200)
committerJens Axboe <axboe@suse.de>
Wed, 7 Jun 2006 08:34:49 +0000 (10:34 +0200)
init.c

diff --git a/init.c b/init.c
index 46c513223481238e41dd10791007c646b89e9e7f..5c5a918312db06e3d39a251b08fac8197e746aef 100644 (file)
--- a/init.c
+++ b/init.c
@@ -649,30 +649,6 @@ static int str_ioengine_cb(struct thread_data *td, char *str)
        return 1;
 }
 
        return 1;
 }
 
-static int str_iolog_cb(struct thread_data *td, char *file)
-{
-       td->iolog_file = strdup(file);
-       return 0;
-}
-
-static int str_prerun_cb(struct thread_data *td, char *file)
-{
-       td->exec_prerun = strdup(file);
-       return 0;
-}
-
-static int str_postrun_cb(struct thread_data *td, char *file)
-{
-       td->exec_postrun = strdup(file);
-       return 0;
-}
-
-static int str_iosched_cb(struct thread_data *td, char *file)
-{
-       td->ioscheduler = strdup(file);
-       return 0;
-}
-
 int parse_jobs_ini(char *file)
 {
        unsigned int prioclass, prio, cpu, global, il;
 int parse_jobs_ini(char *file)
 {
        unsigned int prioclass, prio, cpu, global, il;
@@ -921,27 +897,32 @@ int parse_jobs_ini(char *file)
                                fgetpos(f, &off);
                                continue;
                        }
                                fgetpos(f, &off);
                                continue;
                        }
-                       if (!check_str(p, "iolog", str_iolog_cb, td)) {
+                       if (!check_strstore(p, "iolog", tmpbuf)) {
+                               td->iolog_file = strdup(tmpbuf);
                                td->read_iolog = 1;
                                td->write_iolog = 0;
                                fgetpos(f, &off);
                                continue;
                        }
                        if (!td->read_iolog &&
                                td->read_iolog = 1;
                                td->write_iolog = 0;
                                fgetpos(f, &off);
                                continue;
                        }
                        if (!td->read_iolog &&
-                           !check_str(p, "write_iolog", str_iolog_cb, td)) {
+                           !check_strstore(p, "write_iolog", tmpbuf)) {
+                               td->iolog_file = strdup(tmpbuf);
                                td->write_iolog = 1;
                                fgetpos(f, &off);
                                continue;
                        }
                                td->write_iolog = 1;
                                fgetpos(f, &off);
                                continue;
                        }
-                       if (!check_str(p, "exec_prerun", str_prerun_cb, td)) {
+                       if (!check_strstore(p, "exec_prerun", tmpbuf)) {
+                               td->exec_prerun = strdup(tmpbuf);
                                fgetpos(f, &off);
                                continue;
                        }
                                fgetpos(f, &off);
                                continue;
                        }
-                       if (!check_str(p, "exec_postrun", str_postrun_cb, td)) {
+                       if (!check_strstore(p, "exec_postrun", tmpbuf)) {
+                               td->exec_postrun = strdup(tmpbuf);
                                fgetpos(f, &off);
                                continue;
                        }
                                fgetpos(f, &off);
                                continue;
                        }
-                       if (!check_str(p, "ioscheduler", str_iosched_cb, td)) {
+                       if (!check_strstore(p, "ioscheduler", tmpbuf)) {
+                               td->ioscheduler = strdup(tmpbuf);
                                fgetpos(f, &off);
                                continue;
                        }
                                fgetpos(f, &off);
                                continue;
                        }