Blame SOURCES/getdoublearr.stripwhite.patch

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