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

Commit48fa357

Browse files
committed
Fix vcregress check
1 parentceca852 commit48fa357

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

‎src/port/snprintf.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,20 +1186,30 @@ int pg_fputs(const char *s, FILE *stream)
11861186
}
11871187

11881188
/* replacement to puts function which uses flushBuffer */
1189-
intpg_puts(constchar*tmps)
1189+
intpg_puts(constchar*s)
11901190
{
11911191
PrintfTargettarget;
1192-
char*s=NULL;
1193-
1194-
s= (char*)malloc(strlen(tmps)+1);
1195-
sprintf(s,"%s\n",tmps);
1196-
target.bufstart=s;
1192+
char*t=NULL;
1193+
size_tlen=strlen(s);
1194+
1195+
t= (char*)malloc(len+2);
1196+
if (t==NULL) {
1197+
return-1;
1198+
}
1199+
1200+
memcpy(t,s,len);
1201+
t[len]='\n';
1202+
t[len+1]='\0';
1203+
1204+
target.bufstart=t;
11971205
target.nchars=0;
1198-
target.bufptr=s+strlen(s);
1206+
target.bufptr=t+len+1;
11991207
target.bufend=NULL;
12001208
target.failed= false;
12011209
target.stream=stdout;
12021210
flushbuffer(&target);
1211+
1212+
free(t);
12031213
returntarget.failed ?-1 :target.nchars;
12041214
}
12051215
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp