Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
9d6f0606
Commit
9d6f0606
authored
26 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Fix for HAVE_LONG bug in snprintf.c.
parent
6b7cf132
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/port/snprintf.c
+18
-31
18 additions, 31 deletions
src/backend/port/snprintf.c
with
18 additions
and
31 deletions
src/backend/port/snprintf.c
+
18
−
31
View file @
9d6f0606
...
...
@@ -41,9 +41,6 @@
#include
"regex/cdefs.h"
#include
<stdarg.h>
#define VA_LOCAL_DECL va_list args;
#define VA_START(f) va_start(args, f)
#define VA_END va_end(args)
#include
<sys/ioctl.h>
#include
<sys/param.h>
...
...
@@ -75,34 +72,30 @@ typedef long long long_long;
* causing nast effects.
**************************************************************/
/*static char _id[] = "$Id: snprintf.c,v 1.1
2
1998/12/18 0
6:59:39
momjian Exp $";*/
/*static char _id[] = "$Id: snprintf.c,v 1.1
3
1998/12/18 0
7:03:06
momjian Exp $";*/
static
char
*
end
;
static
int
SnprfOverflow
;
int
snprintf
(
char
*
str
,
size_t
count
,
const
char
*
fmt
,...);
int
vsnprintf
(
char
*
str
,
size_t
count
,
const
char
*
fmt
,
...
);
static
void
dopr
(
char
*
buffer
,
const
char
*
format
,
...
);
int
vsnprintf
(
char
*
str
,
size_t
count
,
const
char
*
fmt
,
va_list
args
);
static
void
dopr
(
char
*
buffer
,
const
char
*
format
,
va_list
args
);
int
snprintf
(
char
*
str
,
size_t
count
,
const
char
*
fmt
,...)
{
int
len
;
va_list
args
;
VA_LOCAL_DECL
VA_START
(
fmt
);
va_start
(
args
,
fmt
);
len
=
vsnprintf
(
str
,
count
,
fmt
,
args
);
VA_END
;
va_end
(
args
)
;
return
len
;
}
int
vsnprintf
(
char
*
str
,
size_t
count
,
const
char
*
fmt
,
...
)
vsnprintf
(
char
*
str
,
size_t
count
,
const
char
*
fmt
,
va_list
args
)
{
VA_LOCAL_DECL
VA_START
(
fmt
);
str
[
0
]
=
0
;
end
=
str
+
count
-
1
;
SnprfOverflow
=
0
;
...
...
@@ -112,7 +105,6 @@ vsnprintf(char *str, size_t count, const char *fmt,...)
if
(
SnprfOverflow
)
elog
(
NOTICE
,
"vsnprintf overflow, len = %d, str = %s"
,
count
,
str
);
VA_END
;
return
strlen
(
str
);
}
...
...
@@ -122,7 +114,7 @@ vsnprintf(char *str, size_t count, const char *fmt,...)
static
void
fmtstr
__P
((
char
*
value
,
int
ljust
,
int
len
,
int
zpad
,
int
maxwidth
));
#ifndef HAVE_LONG_
LONG_
INT_64
#ifndef HAVE_LONG_INT_64
static
void
fmtnum
__P
((
long
value
,
int
base
,
int
dosign
,
int
ljust
,
int
len
,
int
zpad
));
#else
static
void
fmtnum
__P
((
long_long
value
,
int
base
,
int
dosign
,
int
ljust
,
int
len
,
int
zpad
));
...
...
@@ -133,16 +125,16 @@ static char *output;
static
void
dopr_outch
__P
((
int
c
));
static
void
dopr
(
char
*
buffer
,
const
char
*
format
,
...
)
dopr
(
char
*
buffer
,
const
char
*
format
,
va_list
args
)
{
int
ch
;
#ifdef HAVE_LONG_LONG_INT_64
long_long
value
;
int
longlongflag
=
0
;
#else
long
value
;
#endif
int
longflag
=
0
;
int
longlongflag
=
0
;
int
pointflag
=
0
;
int
maxwidth
=
0
;
char
*
strvalue
;
...
...
@@ -150,10 +142,6 @@ dopr(char *buffer, const char *format,...)
int
len
;
int
zpad
;
VA_LOCAL_DECL
VA_START
(
format
);
output
=
buffer
;
while
((
ch
=
*
format
++
))
{
...
...
@@ -162,13 +150,15 @@ dopr(char *buffer, const char *format,...)
case
'%'
:
ljust
=
len
=
zpad
=
maxwidth
=
0
;
longflag
=
pointflag
=
0
;
#ifdef HAVE_LONG_LONG_INT_64
longlongflag
=
0
;
#endif
nextch:
ch
=
*
format
++
;
switch
(
ch
)
{
case
0
:
dostr
(
"**end of format**"
,
0
);
VA_END
;
return
;
case
'-'
:
ljust
=
1
;
...
...
@@ -200,16 +190,13 @@ dopr(char *buffer, const char *format,...)
pointflag
=
1
;
goto
nextch
;
case
'l'
:
#ifdef HAVE_LONG_LONG_INT_64
if
(
longflag
)
{
longlongflag
=
1
;
goto
nextch
;
}
else
{
#endif
longflag
=
1
;
goto
nextch
;
}
goto
nextch
;
case
'u'
:
case
'U'
:
/* fmtnum(value,base,dosign,ljust,len,zpad) */
...
...
@@ -255,6 +242,7 @@ dopr(char *buffer, const char *format,...)
}
else
value
=
va_arg
(
args
,
int
);
fmtnum
(
value
,
10
,
1
,
ljust
,
len
,
zpad
);
break
;
case
'x'
:
...
...
@@ -311,7 +299,6 @@ dopr(char *buffer, const char *format,...)
}
}
*
output
=
0
;
VA_END
;
}
static
void
...
...
@@ -362,7 +349,7 @@ int base,
zpad
;
{
int
signvalue
=
0
;
#ifdef HAVE_LONG_
LONG_
INT_64
#ifdef HAVE_LONG_INT_64
unsigned
long_long
uvalue
;
#else
unsigned
long
uvalue
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment