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