|
1 | 1 | /* |
2 | | - * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.37 2005/09/2913:44:25 ishii Exp $ |
| 2 | + * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.38 2005/09/2916:18:26 tgl Exp $ |
3 | 3 | * |
4 | 4 | * pgbench: a simple TPC-B like benchmark program for PostgreSQL |
5 | 5 | * written by Tatsuo Ishii |
|
21 | 21 |
|
22 | 22 | #include"libpq-fe.h" |
23 | 23 |
|
24 | | -#include<errno.h> |
25 | | - |
26 | 24 | #ifdefWIN32 |
27 | 25 | #include"win32.h" |
28 | 26 | #else |
@@ -275,14 +273,17 @@ assignVariables(CState * st, char *sql) |
275 | 273 | while ((p=strchr(&sql[i],':'))!=NULL) |
276 | 274 | { |
277 | 275 | i=j=p-sql; |
278 | | -do |
| 276 | +do { |
279 | 277 | i++; |
280 | | -while (isalnum(sql[i])!=0||sql[i]=='_'); |
| 278 | +}while (isalnum((unsignedchar)sql[i])||sql[i]=='_'); |
281 | 279 | if (i==j+1) |
282 | 280 | continue; |
283 | 281 |
|
284 | | -if ((name=strndup(&sql[j+1],i- (j+1)))==NULL) |
| 282 | +name=malloc(i-j); |
| 283 | +if (name==NULL) |
285 | 284 | returnNULL; |
| 285 | +memcpy(name,&sql[j+1],i- (j+1)); |
| 286 | +name[i- (j+1)]='\0'; |
286 | 287 | val=getVariable(st,name); |
287 | 288 | free(name); |
288 | 289 | if (val==NULL) |
@@ -966,7 +967,7 @@ process_file(char *filename) |
966 | 967 | if ((p=strchr(buf,'\n'))!=NULL) |
967 | 968 | *p='\0'; |
968 | 969 | p=buf; |
969 | | -while (isspace(*p)) |
| 970 | +while (isspace((unsignedchar)*p)) |
970 | 971 | p++; |
971 | 972 | if (*p=='\0'||strncmp(p,"--",2)==0) |
972 | 973 | { |
|