Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc775b42

Browse files
committed
Fix unportable usages in new pgbench code (strndup, ctype macros)
1 parent9b19abd commitc775b42

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

‎contrib/pgbench/pgbench.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
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 $
33
*
44
* pgbench: a simple TPC-B like benchmark program for PostgreSQL
55
* written by Tatsuo Ishii
@@ -21,8 +21,6 @@
2121

2222
#include"libpq-fe.h"
2323

24-
#include<errno.h>
25-
2624
#ifdefWIN32
2725
#include"win32.h"
2826
#else
@@ -275,14 +273,17 @@ assignVariables(CState * st, char *sql)
275273
while ((p=strchr(&sql[i],':'))!=NULL)
276274
{
277275
i=j=p-sql;
278-
do
276+
do {
279277
i++;
280-
while (isalnum(sql[i])!=0||sql[i]=='_');
278+
}while (isalnum((unsignedchar)sql[i])||sql[i]=='_');
281279
if (i==j+1)
282280
continue;
283281

284-
if ((name=strndup(&sql[j+1],i- (j+1)))==NULL)
282+
name=malloc(i-j);
283+
if (name==NULL)
285284
returnNULL;
285+
memcpy(name,&sql[j+1],i- (j+1));
286+
name[i- (j+1)]='\0';
286287
val=getVariable(st,name);
287288
free(name);
288289
if (val==NULL)
@@ -966,7 +967,7 @@ process_file(char *filename)
966967
if ((p=strchr(buf,'\n'))!=NULL)
967968
*p='\0';
968969
p=buf;
969-
while (isspace(*p))
970+
while (isspace((unsignedchar)*p))
970971
p++;
971972
if (*p=='\0'||strncmp(p,"--",2)==0)
972973
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp