From 99d8724925641b3654ff7fd8de29c805aad2108a Mon Sep 17 00:00:00 2001 From: tradke Date: Mon, 6 Jan 2003 12:27:52 +0000 Subject: Copy pointers to string parameters to a local variable before modifying it. This prevents potential future problems in pointer assignments when we declare a pointer to a string parameters constant. This closes PR CactusIO/1351. git-svn-id: http://svn.cactuscode.org/arrangements/CactusIO/IOJpeg/trunk@79 eff87b29-5268-4891-90a3-a07138403961 --- src/Startup.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Startup.c b/src/Startup.c index 58ea1a4..f58a5a0 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -95,6 +95,7 @@ static void *SetupGH (tFleshConfig *config, int conv_level, cGH *GH) { int i, numvars; ioJpegGH *myGH; + const char *my_out_dir; DECLARE_CCTK_PARAMETERS @@ -135,20 +136,17 @@ static void *SetupGH (tFleshConfig *config, int conv_level, cGH *GH) myGH->out_every_default = out_every - 1; /* get the name for IOJpeg's output directory */ - if (*out_dir == 0) - { - out_dir = io_out_dir; - } + my_out_dir = *out_dir ? out_dir : io_out_dir; /* omit the directory if it's the current working dir */ - if (strcmp (out_dir, ".") == 0) + if (strcmp (my_out_dir, ".") == 0) { myGH->out_dir = strdup (""); } else { - myGH->out_dir = (char *) malloc (strlen (out_dir) + 2); - sprintf (myGH->out_dir, "%s/", out_dir); + myGH->out_dir = (char *) malloc (strlen (my_out_dir) + 2); + sprintf (myGH->out_dir, "%s/", my_out_dir); } /* create the output dir */ -- cgit v1.2.3