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