Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
03b8efa5
Commit
03b8efa5
authored
Mar 01, 2005
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make snprintf() use already-defined int64/uint64 typedefs rather than
defining its own.
parent
5edb76d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
30 deletions
+11
-30
src/port/snprintf.c
src/port/snprintf.c
+11
-30
No files found.
src/port/snprintf.c
View file @
03b8efa5
...
@@ -35,30 +35,11 @@
...
@@ -35,30 +35,11 @@
/* might be in either frontend or backend */
/* might be in either frontend or backend */
#include "postgres_fe.h"
#include "postgres_fe.h"
#ifdef ENABLE_THREAD_SAFETY
#error The replacement snprintf() is not thread-safe. \
Your platform must have a thread-safe snprintf() to compile with threads.
#endif
#ifndef WIN32
#ifndef WIN32
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#endif
#endif
#include <sys/param.h>
#include <sys/param.h>
/*
* We do all internal arithmetic in the widest available integer type,
* here called long_long (or ulong_long for unsigned).
*/
#ifdef HAVE_LONG_LONG_INT_64
typedef
long
long
long_long
;
typedef
unsigned
long
long
ulong_long
;
#else
typedef
long
long_long
;
typedef
unsigned
long
ulong_long
;
#endif
#ifndef NL_ARGMAX
#ifndef NL_ARGMAX
#define NL_ARGMAX 4096
#define NL_ARGMAX 4096
#endif
#endif
...
@@ -85,7 +66,7 @@ typedef unsigned long ulong_long;
...
@@ -85,7 +66,7 @@ typedef unsigned long ulong_long;
* causing nasty effects.
* causing nasty effects.
**************************************************************/
**************************************************************/
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.
8 2005/03/01 00:38:11
momjian Exp $";*/
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.
9 2005/03/01 05:47:28
momjian Exp $";*/
int
snprintf
(
char
*
str
,
size_t
count
,
const
char
*
fmt
,...);
int
snprintf
(
char
*
str
,
size_t
count
,
const
char
*
fmt
,...);
int
vsnprintf
(
char
*
str
,
size_t
count
,
const
char
*
fmt
,
va_list
args
);
int
vsnprintf
(
char
*
str
,
size_t
count
,
const
char
*
fmt
,
va_list
args
);
...
@@ -139,7 +120,7 @@ vsnprintf(char *str, size_t count, const char *fmt, va_list args)
...
@@ -139,7 +120,7 @@ vsnprintf(char *str, size_t count, const char *fmt, va_list args)
*/
*/
static
void
fmtstr
(
char
*
value
,
int
ljust
,
int
len
,
int
zpad
,
int
maxwidth
,
char
*
end
);
static
void
fmtstr
(
char
*
value
,
int
ljust
,
int
len
,
int
zpad
,
int
maxwidth
,
char
*
end
);
static
void
fmtnum
(
long_long
value
,
int
base
,
int
dosign
,
int
ljust
,
int
len
,
int
zpad
,
char
*
end
);
static
void
fmtnum
(
int64
value
,
int
base
,
int
dosign
,
int
ljust
,
int
len
,
int
zpad
,
char
*
end
);
static
void
fmtfloat
(
double
value
,
char
type
,
int
ljust
,
int
len
,
int
precision
,
int
pointflag
,
char
*
end
);
static
void
fmtfloat
(
double
value
,
char
type
,
int
ljust
,
int
len
,
int
precision
,
int
pointflag
,
char
*
end
);
static
void
dostr
(
char
*
str
,
int
cut
,
char
*
end
);
static
void
dostr
(
char
*
str
,
int
cut
,
char
*
end
);
static
void
dopr_outch
(
int
c
,
char
*
end
);
static
void
dopr_outch
(
int
c
,
char
*
end
);
...
@@ -155,7 +136,7 @@ static void
...
@@ -155,7 +136,7 @@ static void
dopr
(
char
*
buffer
,
const
char
*
format
,
va_list
args
,
char
*
end
)
dopr
(
char
*
buffer
,
const
char
*
format
,
va_list
args
,
char
*
end
)
{
{
int
ch
;
int
ch
;
long_long
value
;
int64
value
;
double
fvalue
;
double
fvalue
;
int
longlongflag
=
0
;
int
longlongflag
=
0
;
int
longflag
=
0
;
int
longflag
=
0
;
...
@@ -175,7 +156,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
...
@@ -175,7 +156,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
const
char
*
fmtbegin
;
const
char
*
fmtbegin
;
const
char
*
fmtend
;
const
char
*
fmtend
;
void
*
value
;
void
*
value
;
long_long
numvalue
;
int64
numvalue
;
double
fvalue
;
double
fvalue
;
int
charvalue
;
int
charvalue
;
int
ljust
;
int
ljust
;
...
@@ -258,7 +239,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
...
@@ -258,7 +239,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
if
(
longflag
)
if
(
longflag
)
{
{
if
(
longlongflag
)
if
(
longlongflag
)
value
=
va_arg
(
args
,
u
long_long
);
value
=
va_arg
(
args
,
u
int64
);
else
else
value
=
va_arg
(
args
,
unsigned
long
);
value
=
va_arg
(
args
,
unsigned
long
);
}
}
...
@@ -282,7 +263,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
...
@@ -282,7 +263,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
if
(
longflag
)
if
(
longflag
)
{
{
if
(
longlongflag
)
if
(
longlongflag
)
value
=
va_arg
(
args
,
u
long_long
);
value
=
va_arg
(
args
,
u
int64
);
else
else
value
=
va_arg
(
args
,
unsigned
long
);
value
=
va_arg
(
args
,
unsigned
long
);
}
}
...
@@ -305,7 +286,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
...
@@ -305,7 +286,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
if
(
longflag
)
if
(
longflag
)
{
{
if
(
longlongflag
)
if
(
longlongflag
)
value
=
va_arg
(
args
,
long_long
);
value
=
va_arg
(
args
,
int64
);
else
else
value
=
va_arg
(
args
,
long
);
value
=
va_arg
(
args
,
long
);
}
}
...
@@ -327,7 +308,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
...
@@ -327,7 +308,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
if
(
longflag
)
if
(
longflag
)
{
{
if
(
longlongflag
)
if
(
longlongflag
)
value
=
va_arg
(
args
,
u
long_long
);
value
=
va_arg
(
args
,
u
int64
);
else
else
value
=
va_arg
(
args
,
unsigned
long
);
value
=
va_arg
(
args
,
unsigned
long
);
}
}
...
@@ -349,7 +330,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
...
@@ -349,7 +330,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
if
(
longflag
)
if
(
longflag
)
{
{
if
(
longlongflag
)
if
(
longlongflag
)
value
=
va_arg
(
args
,
u
long_long
);
value
=
va_arg
(
args
,
u
int64
);
else
else
value
=
va_arg
(
args
,
unsigned
long
);
value
=
va_arg
(
args
,
unsigned
long
);
}
}
...
@@ -505,10 +486,10 @@ fmtstr(char *value, int ljust, int len, int zpad, int maxwidth, char *end)
...
@@ -505,10 +486,10 @@ fmtstr(char *value, int ljust, int len, int zpad, int maxwidth, char *end)
}
}
static
void
static
void
fmtnum
(
long_long
value
,
int
base
,
int
dosign
,
int
ljust
,
int
len
,
int
zpad
,
char
*
end
)
fmtnum
(
int64
value
,
int
base
,
int
dosign
,
int
ljust
,
int
len
,
int
zpad
,
char
*
end
)
{
{
int
signvalue
=
0
;
int
signvalue
=
0
;
u
long_long
uvalue
;
u
int64
uvalue
;
char
convert
[
64
];
char
convert
[
64
];
int
place
=
0
;
int
place
=
0
;
int
padlen
=
0
;
/* amount to pad */
int
padlen
=
0
;
/* amount to pad */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment