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