Jaromir Capik f7d47d
Subject: getdoublearr.stripwhite
Jaromir Capik f7d47d
From: Michel Normand <normand@fr.ibm.com>
Jaromir Capik f7d47d
Jaromir Capik f7d47d
GetDoubleArr must only handle the comma delimited list at string head
Jaromir Capik f7d47d
and ignore anything after the first blank character.
Jaromir Capik f7d47d
Jaromir Capik f7d47d
Signed-off-by: Michel Normand <normand@fr.ibm.com>
Jaromir Capik f7d47d
---
Jaromir Capik f7d47d
 ATLAS/include/atlas_genparse.h |   16 ++++++++++++++--
Jaromir Capik f7d47d
 1 file changed, 14 insertions(+), 2 deletions(-)
Jaromir Capik f7d47d
Jaromir Capik f7d47d
Index: atlas/ATLAS/include/atlas_genparse.h
Jaromir Capik f7d47d
===================================================================
Jaromir Capik f7d47d
--- atlas.orig/ATLAS/include/atlas_genparse.h
Jaromir Capik f7d47d
+++ atlas/ATLAS/include/atlas_genparse.h
Jaromir Capik f7d47d
@@ -149,13 +149,24 @@ static int asmNames2bitfield(char *str)
Jaromir Capik f7d47d
 }
Jaromir Capik f7d47d
 
Jaromir Capik f7d47d
 /* procedure 7 */
Jaromir Capik f7d47d
-static int GetDoubleArr(char *str, int N, double *d)
Jaromir Capik f7d47d
+static int GetDoubleArr(char *callerstr, int N, double *d)
Jaromir Capik f7d47d
 /*
Jaromir Capik f7d47d
  * Reads in a list with form "%le,%le...,%le"; N-length d recieves doubles.
Jaromir Capik f7d47d
  * RETURNS: the number of doubles found, or N, whichever is less
Jaromir Capik f7d47d
  */
Jaromir Capik f7d47d
 {
Jaromir Capik f7d47d
-   int i=1;
Jaromir Capik f7d47d
+   int i;
Jaromir Capik f7d47d
+   char *dupstr = DupString(callerstr);
Jaromir Capik f7d47d
+   char *str = dupstr;
Jaromir Capik f7d47d
+   /* strip the string to end on first white space */
Jaromir Capik f7d47d
+   for (i=0; dupstr[i]; i++)
Jaromir Capik f7d47d
+   {
Jaromir Capik f7d47d
+	if (isspace(dupstr[i])) {
Jaromir Capik f7d47d
+		dupstr[i] = '\0';
Jaromir Capik f7d47d
+		break;
Jaromir Capik f7d47d
+	}
Jaromir Capik f7d47d
+   }
Jaromir Capik f7d47d
+   i = 1;
Jaromir Capik f7d47d
    assert(sscanf(str, "%le", d) == 1);
Jaromir Capik f7d47d
    while (i < N)
Jaromir Capik f7d47d
    {
Jaromir Capik f7d47d
@@ -166,6 +177,7 @@ static int GetDoubleArr(char *str, int N
Jaromir Capik f7d47d
	break;
Jaromir Capik f7d47d
       i++;
Jaromir Capik f7d47d
    }
Jaromir Capik f7d47d
+   free(dupstr);
Jaromir Capik f7d47d
    return(i);
Jaromir Capik f7d47d
 }
Jaromir Capik f7d47d