mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
pgindent snprintf.c for consistency.
This commit is contained in:
@ -65,7 +65,7 @@
|
|||||||
* causing nasty effects.
|
* causing nasty effects.
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
||||||
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.21 2005/03/16 15:11:43 momjian Exp $";*/
|
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.22 2005/03/16 15:12:18 momjian Exp $";*/
|
||||||
|
|
||||||
int pg_snprintf(char *str, size_t count, const char *fmt,...);
|
int pg_snprintf(char *str, size_t count, const char *fmt,...);
|
||||||
int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
|
int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
|
||||||
@ -82,6 +82,7 @@ int
|
|||||||
pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args)
|
pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
char *end;
|
char *end;
|
||||||
|
|
||||||
str[0] = '\0';
|
str[0] = '\0';
|
||||||
end = str + count - 1;
|
end = str + count - 1;
|
||||||
dopr(str, fmt, args, end);
|
dopr(str, fmt, args, end);
|
||||||
@ -178,7 +179,8 @@ dopr(char *buffer, const char *format, va_list args, char *end)
|
|||||||
char *output;
|
char *output;
|
||||||
int percents = 1;
|
int percents = 1;
|
||||||
const char *p;
|
const char *p;
|
||||||
struct fmtpar {
|
struct fmtpar
|
||||||
|
{
|
||||||
const char *fmtbegin;
|
const char *fmtbegin;
|
||||||
const char *fmtend;
|
const char *fmtend;
|
||||||
void *value;
|
void *value;
|
||||||
@ -288,6 +290,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
|
|||||||
longflag = 1;
|
longflag = 1;
|
||||||
goto nextch;
|
goto nextch;
|
||||||
#ifdef NOT_USED
|
#ifdef NOT_USED
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We might export this to client apps so we should
|
* We might export this to client apps so we should
|
||||||
* support 'qd' and 'I64d'(MinGW) also in case the
|
* support 'qd' and 'I64d'(MinGW) also in case the
|
||||||
@ -433,8 +436,10 @@ performpr:
|
|||||||
fmtparptr[i] = &fmtpar[fmtpar[i].realpos];
|
fmtparptr[i] = &fmtpar[fmtpar[i].realpos];
|
||||||
|
|
||||||
/* assign values */
|
/* assign values */
|
||||||
for(i = 1; i < fmtpos; i++){
|
for (i = 1; i < fmtpos; i++)
|
||||||
switch(fmtparptr[i]->func){
|
{
|
||||||
|
switch (fmtparptr[i]->func)
|
||||||
|
{
|
||||||
case FMTSTR:
|
case FMTSTR:
|
||||||
fmtparptr[i]->value = va_arg(args, char *);
|
fmtparptr[i]->value = va_arg(args, char *);
|
||||||
break;
|
break;
|
||||||
@ -495,7 +500,8 @@ performpr:
|
|||||||
}
|
}
|
||||||
if (fmtpar[i].fmtbegin == format - 1)
|
if (fmtpar[i].fmtbegin == format - 1)
|
||||||
{
|
{
|
||||||
switch(fmtparptr[i]->func){
|
switch (fmtparptr[i]->func)
|
||||||
|
{
|
||||||
case FMTSTR:
|
case FMTSTR:
|
||||||
fmtstr(fmtparptr[i]->value, fmtparptr[i]->ljust,
|
fmtstr(fmtparptr[i]->value, fmtparptr[i]->ljust,
|
||||||
fmtparptr[i]->len, fmtparptr[i]->zpad,
|
fmtparptr[i]->len, fmtparptr[i]->zpad,
|
||||||
@ -524,7 +530,8 @@ performpr:
|
|||||||
dopr_outch(ch, end, &output);
|
dopr_outch(ch, end, &output);
|
||||||
nochar:
|
nochar:
|
||||||
/* nothing */
|
/* nothing */
|
||||||
; /* semicolon required because a goto has to be attached to a statement */
|
; /* semicolon required because a goto has to be
|
||||||
|
* attached to a statement */
|
||||||
}
|
}
|
||||||
*output = '\0';
|
*output = '\0';
|
||||||
|
|
||||||
@ -579,8 +586,8 @@ fmtnum(int64 value, int base, int dosign, int ljust, int len, int zpad,
|
|||||||
int caps = 0;
|
int caps = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DEBUGP(("value 0x%x, base %d, dosign %d, ljust %d, len %d, zpad
|
* DEBUGP(("value 0x%x, base %d, dosign %d, ljust %d, len %d, zpad %d\n",
|
||||||
* %d\n", value, base, dosign, ljust, len, zpad ));
|
* value, base, dosign, ljust, len, zpad ));
|
||||||
*/
|
*/
|
||||||
uvalue = value;
|
uvalue = value;
|
||||||
if (dosign)
|
if (dosign)
|
||||||
|
Reference in New Issue
Block a user