From: Nathan Scott Date: Fri, 9 Sep 2005 07:22:13 +0000 (+0200) Subject: [PATCH] blktrace: remove unneeded strdup X-Git-Tag: blktrace-0.99~181 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=66efebf8c83faf70cdef59da095dca019309af1d;p=blktrace.git [PATCH] blktrace: remove unneeded strdup --- diff --git a/blkparse.c b/blkparse.c index 11b854e..ea8a0af 100644 --- a/blkparse.c +++ b/blkparse.c @@ -890,10 +890,10 @@ int main(int argc, char *argv[]) while ((c = getopt_long(argc, argv, S_OPTS, l_opts, NULL)) != -1) { switch (c) { case 'i': - dev = strdup(optarg); + dev = optarg; break; case 'o': - output_name = strdup(optarg); + output_name = optarg; break; case 'b': rb_batch = atoi(optarg); diff --git a/blktrace.c b/blktrace.c index c068d4c..3ff2391 100644 --- a/blktrace.c +++ b/blktrace.c @@ -131,7 +131,7 @@ static volatile int done; static int devfd, ncpus; static struct thread_information *thread_information; -static char *buts_name_p; +static char buts_name[32]; static char *dev; static char *output_name; static int act_mask = ~0U; @@ -167,8 +167,8 @@ static int start_trace(char *dev) return 1; } + memcpy(buts_name, buts.name, sizeof(buts_name)); trace_started = 1; - buts_name_p = strdup(buts.name); return 0; } @@ -240,7 +240,7 @@ static void *extract(void *arg) } snprintf(tip->fn, sizeof(tip->fn), - "%s/block/%s/trace%d", relay_path, buts_name_p, tip->cpu); + "%s/block/%s/trace%d", relay_path, buts_name, tip->cpu); tip->fd = open(tip->fn, O_RDONLY); if (tip->fd < 0) { perror(tip->fn); @@ -456,7 +456,7 @@ int main(int argc, char *argv[]) break; case 'o': - output_name = strdup(optarg); + output_name = optarg; break; case 'k': kill_running_trace = 1; @@ -508,7 +508,7 @@ int main(int argc, char *argv[]) setlocale(LC_NUMERIC, "en_US"); if (!output_name) - output_name = strdup(buts_name_p); + output_name = buts_name; i = start_threads(); if (!i) {