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

Commit03b8efa

Browse files
committed
Make snprintf() use already-defined int64/uint64 typedefs rather than
defining its own.
1 parent5edb76d commit03b8efa

File tree

1 file changed

+11
-30
lines changed

1 file changed

+11
-30
lines changed

‎src/port/snprintf.c

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,11 @@
3535
/* might be in either frontend or backend */
3636
#include"postgres_fe.h"
3737

38-
#ifdefENABLE_THREAD_SAFETY
39-
#errorThe replacement snprintf() is not thread-safe.\
40-
Your platform must have a thread-safe snprintf() to compile with threads.
41-
#endif
42-
4338
#ifndefWIN32
4439
#include<sys/ioctl.h>
4540
#endif
4641
#include<sys/param.h>
4742

48-
49-
/*
50-
* We do all internal arithmetic in the widest available integer type,
51-
* here called long_long (or ulong_long for unsigned).
52-
*/
53-
#ifdefHAVE_LONG_LONG_INT_64
54-
typedeflong longlong_long;
55-
typedefunsigned long longulong_long;
56-
57-
#else
58-
typedeflonglong_long;
59-
typedefunsigned longulong_long;
60-
#endif
61-
6243
#ifndefNL_ARGMAX
6344
#defineNL_ARGMAX 4096
6445
#endif
@@ -85,7 +66,7 @@ typedef unsigned long ulong_long;
8566
* causing nasty effects.
8667
**************************************************************/
8768

88-
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.8 2005/03/0100:38:11 momjian Exp $";*/
69+
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.9 2005/03/0105:47:28 momjian Exp $";*/
8970

9071
intsnprintf(char*str,size_tcount,constchar*fmt,...);
9172
intvsnprintf(char*str,size_tcount,constchar*fmt,va_listargs);
@@ -139,7 +120,7 @@ vsnprintf(char *str, size_t count, const char *fmt, va_list args)
139120
*/
140121

141122
staticvoidfmtstr(char*value,intljust,intlen,intzpad,intmaxwidth,char*end);
142-
staticvoidfmtnum(long_longvalue,intbase,intdosign,intljust,intlen,intzpad,char*end);
123+
staticvoidfmtnum(int64value,intbase,intdosign,intljust,intlen,intzpad,char*end);
143124
staticvoidfmtfloat(doublevalue,chartype,intljust,intlen,intprecision,intpointflag,char*end);
144125
staticvoiddostr(char*str,intcut,char*end);
145126
staticvoiddopr_outch(intc,char*end);
@@ -155,7 +136,7 @@ static void
155136
dopr(char*buffer,constchar*format,va_listargs,char*end)
156137
{
157138
intch;
158-
long_longvalue;
139+
int64value;
159140
doublefvalue;
160141
intlonglongflag=0;
161142
intlongflag=0;
@@ -175,7 +156,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
175156
constchar*fmtbegin;
176157
constchar*fmtend;
177158
void*value;
178-
long_longnumvalue;
159+
int64numvalue;
179160
doublefvalue;
180161
intcharvalue;
181162
intljust;
@@ -258,7 +239,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
258239
if (longflag)
259240
{
260241
if (longlongflag)
261-
value=va_arg(args,ulong_long);
242+
value=va_arg(args,uint64);
262243
else
263244
value=va_arg(args,unsignedlong);
264245
}
@@ -282,7 +263,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
282263
if (longflag)
283264
{
284265
if (longlongflag)
285-
value=va_arg(args,ulong_long);
266+
value=va_arg(args,uint64);
286267
else
287268
value=va_arg(args,unsignedlong);
288269
}
@@ -305,7 +286,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
305286
if (longflag)
306287
{
307288
if (longlongflag)
308-
value=va_arg(args,long_long);
289+
value=va_arg(args,int64);
309290
else
310291
value=va_arg(args,long);
311292
}
@@ -327,7 +308,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
327308
if (longflag)
328309
{
329310
if (longlongflag)
330-
value=va_arg(args,ulong_long);
311+
value=va_arg(args,uint64);
331312
else
332313
value=va_arg(args,unsignedlong);
333314
}
@@ -349,7 +330,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
349330
if (longflag)
350331
{
351332
if (longlongflag)
352-
value=va_arg(args,ulong_long);
333+
value=va_arg(args,uint64);
353334
else
354335
value=va_arg(args,unsignedlong);
355336
}
@@ -505,10 +486,10 @@ fmtstr(char *value, int ljust, int len, int zpad, int maxwidth, char *end)
505486
}
506487

507488
staticvoid
508-
fmtnum(long_longvalue,intbase,intdosign,intljust,intlen,intzpad,char*end)
489+
fmtnum(int64value,intbase,intdosign,intljust,intlen,intzpad,char*end)
509490
{
510491
intsignvalue=0;
511-
ulong_longuvalue;
492+
uint64uvalue;
512493
charconvert[64];
513494
intplace=0;
514495
intpadlen=0;/* amount to pad */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp