1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

Phase 2 of pgindent updates.

Change pg_bsd_indent to follow upstream rules for placement of comments
to the right of code, and remove pgindent hack that caused comments
following #endif to not obey the general rule.

Commit e3860ffa4d wasn't actually using
the published version of pg_bsd_indent, but a hacked-up version that
tried to minimize the amount of movement of comments to the right of
code.  The situation of interest is where such a comment has to be
moved to the right of its default placement at column 33 because there's
code there.  BSD indent has always moved right in units of tab stops
in such cases --- but in the previous incarnation, indent was working
in 8-space tab stops, while now it knows we use 4-space tabs.  So the
net result is that in about half the cases, such comments are placed
one tab stop left of before.  This is better all around: it leaves
more room on the line for comment text, and it means that in such
cases the comment uniformly starts at the next 4-space tab stop after
the code, rather than sometimes one and sometimes two tabs after.

Also, ensure that comments following #endif are indented the same
as comments following other preprocessor commands such as #else.
That inconsistency turns out to have been self-inflicted damage
from a poorly-thought-through post-indent "fixup" in pgindent.

This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.

Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
This commit is contained in:
Tom Lane
2017-06-21 15:18:54 -04:00
parent f669c09989
commit c7b8998ebb
1107 changed files with 3433 additions and 3514 deletions

View File

@ -187,7 +187,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
case ECPGt_unsigned_long_long:
*((long long int *) (ind + ind_offset * act_tuple)) = value_for_indicator;
break;
#endif /* HAVE_LONG_LONG_INT */
#endif /* HAVE_LONG_LONG_INT */
case ECPGt_NO_INDICATOR:
if (value_for_indicator == -1)
{
@ -275,7 +275,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
case ECPGt_unsigned_long_long:
*((long long int *) (ind + ind_offset * act_tuple)) = size;
break;
#endif /* HAVE_LONG_LONG_INT */
#endif /* HAVE_LONG_LONG_INT */
default:
break;
}
@ -369,7 +369,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
pval = scan_length;
break;
#endif /* HAVE_STRTOLL */
#endif /* HAVE_STRTOLL */
#ifdef HAVE_STRTOULL
case ECPGt_unsigned_long_long:
*((unsigned long long int *) (var + offset * act_tuple)) = strtoull(pval, &scan_length, 10);
@ -381,8 +381,8 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
pval = scan_length;
break;
#endif /* HAVE_STRTOULL */
#endif /* HAVE_LONG_LONG_INT */
#endif /* HAVE_STRTOULL */
#endif /* HAVE_LONG_LONG_INT */
case ECPGt_float:
case ECPGt_double:
@ -496,7 +496,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
case ECPGt_unsigned_long_long:
*((long long int *) (ind + ind_offset * act_tuple)) = size;
break;
#endif /* HAVE_LONG_LONG_INT */
#endif /* HAVE_LONG_LONG_INT */
default:
break;
}
@ -541,7 +541,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
case ECPGt_unsigned_long_long:
*((long long int *) (ind + ind_offset * act_tuple)) = variable->len;
break;
#endif /* HAVE_LONG_LONG_INT */
#endif /* HAVE_LONG_LONG_INT */
default:
break;
}

View File

@ -141,7 +141,7 @@ get_int_item(int lineno, void *var, enum ECPGttype vartype, int value)
case ECPGt_unsigned_long_long:
*(unsigned long long int *) var = (unsigned long long int) value;
break;
#endif /* HAVE_LONG_LONG_INT */
#endif /* HAVE_LONG_LONG_INT */
case ECPGt_float:
*(float *) var = (float) value;
break;
@ -186,7 +186,7 @@ set_int_item(int lineno, int *target, const void *var, enum ECPGttype vartype)
case ECPGt_unsigned_long_long:
*target = *(const unsigned long long int *) var;
break;
#endif /* HAVE_LONG_LONG_INT */
#endif /* HAVE_LONG_LONG_INT */
case ECPGt_float:
*target = *(const float *) var;
break;
@ -753,7 +753,7 @@ descriptor_deallocate_all(struct descriptor *list)
list = next;
}
}
#endif /* ENABLE_THREAD_SAFETY */
#endif /* ENABLE_THREAD_SAFETY */
bool
ECPGallocate_desc(int line, const char *name)
@ -855,7 +855,7 @@ ECPGdescribe(int line, int compat, bool input, const char *connection_name, cons
/* rest of variable parameters */
ptr = va_arg(args, void *);
(void) va_arg(args, long); /* skip args */
(void) va_arg(args, long); /* skip args */
(void) va_arg(args, long);
(void) va_arg(args, long);

View File

@ -364,7 +364,7 @@ ecpg_store_result(const PGresult *results, int act_field,
/* special mode for handling char**foo=0 */
for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
len += strlen(PQgetvalue(results, act_tuple, act_field)) + 1;
len *= var->offset; /* should be 1, but YMNK */
len *= var->offset; /* should be 1, but YMNK */
len += (ntuples + 1) * sizeof(char *);
}
else
@ -534,7 +534,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
if (*(long long int *) var->ind_value < (long long) 0)
*tobeinserted_p = NULL;
break;
#endif /* HAVE_LONG_LONG_INT */
#endif /* HAVE_LONG_LONG_INT */
case ECPGt_NO_INDICATOR:
if (force_indicator == false)
{
@ -704,7 +704,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
*tobeinserted_p = mallocedval;
break;
#endif /* HAVE_LONG_LONG_INT */
#endif /* HAVE_LONG_LONG_INT */
case ECPGt_float:
if (!(mallocedval = ecpg_alloc(asize * 25, lineno)))
return false;
@ -1361,8 +1361,8 @@ ecpg_build_params(struct statement *stmt)
if (stmt->command[position] == '?')
{
/* yes, replace with new style */
int buffersize = sizeof(int) * CHAR_BIT * 10 / 3; /* a rough guess of the
* size we need */
int buffersize = sizeof(int) * CHAR_BIT * 10 / 3; /* a rough guess of the
* size we need */
if (!(tobeinserted = (char *) ecpg_alloc(buffersize, stmt->lineno)))
{

View File

@ -220,4 +220,4 @@ void ecpg_set_native_sqlda(int, struct sqlda_struct **, const PGresult *, int,
#define ECPG_SQLSTATE_ECPG_INTERNAL_ERROR "YE000"
#define ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY "YE001"
#endif /* _ECPG_LIB_EXTERN_H */
#endif /* _ECPG_LIB_EXTERN_H */

View File

@ -23,9 +23,9 @@
#define LONG_LONG_MIN LLONG_MIN
#else
#define LONG_LONG_MIN LONGLONG_MIN
#endif /* LLONG_MIN */
#endif /* LONG_LONG_MIN */
#endif /* HAVE_LONG_LONG_INT */
#endif /* LLONG_MIN */
#endif /* LONG_LONG_MIN */
#endif /* HAVE_LONG_LONG_INT */
bool ecpg_internal_regression_mode = false;
@ -344,7 +344,7 @@ ECPGset_noind_null(enum ECPGttype type, void *ptr)
case ECPGt_unsigned_long_long:
*((long long *) ptr) = LONG_LONG_MIN;
break;
#endif /* HAVE_LONG_LONG_INT */
#endif /* HAVE_LONG_LONG_INT */
case ECPGt_float:
memset((char *) ptr, 0xff, sizeof(float));
break;
@ -417,7 +417,7 @@ ECPGis_noind_null(enum ECPGttype type, void *ptr)
if (*((long long *) ptr) == LONG_LONG_MIN)
return true;
break;
#endif /* HAVE_LONG_LONG_INT */
#endif /* HAVE_LONG_LONG_INT */
case ECPGt_float:
return (_check(ptr, sizeof(float)));
break;
@ -481,8 +481,8 @@ win32_pthread_once(volatile pthread_once_t *once, void (*fn) (void))
pthread_mutex_unlock(&win32_pthread_once_lock);
}
}
#endif /* ENABLE_THREAD_SAFETY */
#endif /* WIN32 */
#endif /* ENABLE_THREAD_SAFETY */
#endif /* WIN32 */
#ifdef ENABLE_NLS
@ -516,7 +516,7 @@ ecpg_gettext(const char *msgid)
return dgettext(PG_TEXTDOMAIN("ecpglib"), msgid);
}
#endif /* ENABLE_NLS */
#endif /* ENABLE_NLS */
struct var_list *ivlist = NULL;

View File

@ -76,4 +76,4 @@
#define JSONBOID 3802
#define INT4RANGEOID 3904
#endif /* PG_TYPE_H */
#endif /* PG_TYPE_H */

View File

@ -23,8 +23,8 @@ typedef struct
} stmtCacheEntry;
static int nextStmtID = 1;
static const int stmtCacheNBuckets = 2039; /* # buckets - a prime # */
static const int stmtCacheEntPerBucket = 8; /* # entries/bucket */
static const int stmtCacheNBuckets = 2039; /* # buckets - a prime # */
static const int stmtCacheEntPerBucket = 8; /* # entries/bucket */
static stmtCacheEntry stmtCacheEntries[16384] = {{0, {0}, 0, 0, 0}};
static bool deallocate_one(int lineno, enum COMPAT_MODE c, struct connection *con,
@ -380,7 +380,7 @@ SearchStmtCache(const char *ecpgQuery)
* OR negative error code
*/
static int
ecpg_freeStmtCacheEntry(int lineno, int compat, int entNo) /* entry # to free */
ecpg_freeStmtCacheEntry(int lineno, int compat, int entNo) /* entry # to free */
{
stmtCacheEntry *entry;
struct connection *con;
@ -416,7 +416,7 @@ ecpg_freeStmtCacheEntry(int lineno, int compat, int entNo) /* entry # to free *
*/
static int
AddStmtToCache(int lineno, /* line # of statement */
const char *stmtID, /* statement ID */
const char *stmtID, /* statement ID */
const char *connection, /* connection */
int compat, /* compatibility level */
const char *ecpgQuery) /* query */

View File

@ -75,19 +75,19 @@ ecpg_dynamic_type(Oid type)
case BOOLOID:
return SQL3_BOOLEAN; /* bool */
case INT2OID:
return SQL3_SMALLINT; /* int2 */
return SQL3_SMALLINT; /* int2 */
case INT4OID:
return SQL3_INTEGER; /* int4 */
case TEXTOID:
return SQL3_CHARACTER; /* text */
return SQL3_CHARACTER; /* text */
case FLOAT4OID:
return SQL3_REAL; /* float4 */
case FLOAT8OID:
return SQL3_DOUBLE_PRECISION; /* float8 */
return SQL3_DOUBLE_PRECISION; /* float8 */
case BPCHAROID:
return SQL3_CHARACTER; /* bpchar */
return SQL3_CHARACTER; /* bpchar */
case VARCHAROID:
return SQL3_CHARACTER_VARYING; /* varchar */
return SQL3_CHARACTER_VARYING; /* varchar */
case DATEOID:
return SQL3_DATE_TIME_TIMESTAMP; /* date */
case TIMEOID:

View File

@ -9,6 +9,6 @@
#ifndef _ECPGLIB_H
typedef timestamp dtime_t;
typedef interval intrvl_t;
#endif /* ndef _ECPGLIB_H */
#endif /* ndef _ECPGLIB_H */
#endif /* ndef _ECPG_DATETIME_H */
#endif /* ndef _ECPG_DATETIME_H */

View File

@ -8,6 +8,6 @@
/* source created by ecpg which defines this */
#ifndef _ECPGLIB_H
typedef decimal dec_t;
#endif /* ndef _ECPGLIB_H */
#endif /* ndef _ECPGLIB_H */
#endif /* ndef _ECPG_DECIMAL_H */
#endif /* ndef _ECPG_DECIMAL_H */

View File

@ -52,7 +52,7 @@ void win32_pthread_once(volatile pthread_once_t *once, void (*fn) (void));
if (!*(once)) \
win32_pthread_once((once), (fn)); \
} while(0)
#endif /* WIN32 */
#endif /* ENABLE_THREAD_SAFETY */
#endif /* WIN32 */
#endif /* ENABLE_THREAD_SAFETY */
#endif /* _ECPG_PTHREAD_WIN32_H */
#endif /* _ECPG_PTHREAD_WIN32_H */

View File

@ -87,4 +87,4 @@ extern int dtcvfmtasc(char *, char *, timestamp *);
}
#endif
#endif /* ndef _ECPG_INFORMIX_H */
#endif /* ndef _ECPG_INFORMIX_H */

View File

@ -76,4 +76,4 @@
/* WARNING: BlankPortalAssignName: portal * already exists */
#define ECPG_WARNING_PORTAL_EXISTS -605
#endif /* !_ECPG_ERRNO_H */
#endif /* !_ECPG_ERRNO_H */

View File

@ -21,23 +21,23 @@ extern char *ecpg_gettext(const char *msgid) pg_attribute_format_arg(1);
#ifndef __cplusplus
#ifndef bool
#define bool char
#endif /* ndef bool */
#endif /* ndef bool */
#ifndef true
#define true ((bool) 1)
#endif /* ndef true */
#endif /* ndef true */
#ifndef false
#define false ((bool) 0)
#endif /* ndef false */
#endif /* not C++ */
#endif /* ndef false */
#endif /* not C++ */
#ifndef TRUE
#define TRUE 1
#endif /* TRUE */
#endif /* TRUE */
#ifndef FALSE
#define FALSE 0
#endif /* FALSE */
#endif /* FALSE */
#ifdef __cplusplus
extern "C"
@ -97,4 +97,4 @@ void ecpg_pthreads_init(void);
}
#endif
#endif /* _ECPGLIB_H */
#endif /* _ECPGLIB_H */

View File

@ -103,4 +103,4 @@ enum ECPG_statement_type
}
#endif
#endif /* _ECPGTYPE_H */
#endif /* _ECPGTYPE_H */

View File

@ -28,4 +28,4 @@ extern int PGTYPESdate_fmt_asc(date, const char *, char *);
}
#endif
#endif /* PGTYPES_DATETIME */
#endif /* PGTYPES_DATETIME */

View File

@ -21,7 +21,7 @@ typedef long long int int64;
#endif
#define HAVE_INT64_TIMESTAMP
#endif /* C_H */
#endif /* C_H */
typedef struct
{
@ -44,4 +44,4 @@ extern int PGTYPESinterval_copy(interval *, interval *);
}
#endif
#endif /* PGTYPES_INTERVAL */
#endif /* PGTYPES_INTERVAL */

View File

@ -31,7 +31,7 @@ typedef struct
int rscale; /* result scale */
int dscale; /* display scale */
int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */
NumericDigit digits[DECSIZE]; /* decimal digits */
NumericDigit digits[DECSIZE]; /* decimal digits */
} decimal;
#ifdef __cplusplus
@ -64,4 +64,4 @@ int PGTYPESnumeric_from_decimal(decimal *, numeric *);
}
#endif
#endif /* PGTYPES_NUMERIC */
#endif /* PGTYPES_NUMERIC */

View File

@ -27,4 +27,4 @@ extern int PGTYPEStimestamp_sub_interval(timestamp * tin, interval * span, times
}
#endif
#endif /* PGTYPES_TIMESTAMP */
#endif /* PGTYPES_TIMESTAMP */

View File

@ -40,4 +40,4 @@ enum
* standard) */
};
#endif /* !_ECPG_SQL3TYPES_H */
#endif /* !_ECPG_SQL3TYPES_H */

View File

@ -6,8 +6,8 @@
#define PGDLLIMPORT __declspec (dllimport)
#else
#define PGDLLIMPORT
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#define SQLERRMC_LEN 150

View File

@ -40,8 +40,8 @@ struct sqlda_compat
struct sqlvar_compat *sqlvar;
char desc_name[19]; /* descriptor name */
short desc_occ; /* size of sqlda structure */
struct sqlda_compat *desc_next; /* pointer to next sqlda struct */
struct sqlda_compat *desc_next; /* pointer to next sqlda struct */
void *reserved; /* reserved for future use */
};
#endif /* ECPG_SQLDA_COMPAT_H */
#endif /* ECPG_SQLDA_COMPAT_H */

View File

@ -40,4 +40,4 @@ struct sqlda_struct
struct sqlvar_struct sqlvar[1];
};
#endif /* ECPG_SQLDA_NATIVE_H */
#endif /* ECPG_SQLDA_NATIVE_H */

View File

@ -15,4 +15,4 @@ typedef struct sqlda_struct sqlda_t;
#endif
#endif /* ECPG_SQLDA_H */
#endif /* ECPG_SQLDA_H */

View File

@ -54,4 +54,4 @@
#define SQLSERIAL8 ECPGt_long
#endif
#endif /* ndef ECPG_SQLTYPES_H */
#endif /* ndef ECPG_SQLTYPES_H */

View File

@ -156,8 +156,8 @@ PGTYPESdate_today(date * d)
return;
}
#define PGTYPES_DATE_NUM_MAX_DIGITS 20 /* should suffice for most
* years... */
#define PGTYPES_DATE_NUM_MAX_DIGITS 20 /* should suffice for most
* years... */
#define PGTYPES_FMTDATE_DAY_DIGITS_LZ 1 /* LZ means "leading zeroes" */
#define PGTYPES_FMTDATE_DOW_LITERAL_SHORT 2

View File

@ -338,4 +338,4 @@ extern char *months[];
extern char *days[];
extern int day_tab[2][13];
#endif /* DT_H */
#endif /* DT_H */

View File

@ -30,7 +30,7 @@ static datetkn datetktbl[] = {
{"ahst", TZ, -36000}, /* Alaska-Hawaii Std Time */
{"akdt", DTZ, -28800}, /* Alaska Daylight Time */
{"akst", DTZ, -32400}, /* Alaska Standard Time */
{"allballs", RESERV, DTK_ZULU}, /* 00:00:00 */
{"allballs", RESERV, DTK_ZULU}, /* 00:00:00 */
{"almst", TZ, 25200}, /* Almaty Savings Time */
{"almt", TZ, 21600}, /* Almaty Time */
{"am", AMPM, AM},
@ -201,12 +201,12 @@ static datetkn datetktbl[] = {
idt /* Israeli, Iran, Indian Daylight Time */
#endif
{LATE, RESERV, DTK_LATE}, /* "infinity" reserved for "late time" */
{INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for bad time */
{INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for bad time */
{"iot", TZ, 18000}, /* Indian Chagos Time */
{"irkst", DTZ, 32400}, /* Irkutsk Summer Time */
{"irkt", TZ, 28800}, /* Irkutsk Time */
{"irt", TZ, 12600}, /* Iran Time */
{"isodow", UNITS, DTK_ISODOW}, /* ISO day of week, Sunday == 7 */
{"isodow", UNITS, DTK_ISODOW}, /* ISO day of week, Sunday == 7 */
#if 0
isst
#endif
@ -425,33 +425,33 @@ static datetkn deltatktbl[] = {
{"@", IGNORE_DTF, 0}, /* postgres relative prefix */
{DAGO, AGO, 0}, /* "ago" indicates negative time offset */
{"c", UNITS, DTK_CENTURY}, /* "century" relative */
{"cent", UNITS, DTK_CENTURY}, /* "century" relative */
{"cent", UNITS, DTK_CENTURY}, /* "century" relative */
{"centuries", UNITS, DTK_CENTURY}, /* "centuries" relative */
{DCENTURY, UNITS, DTK_CENTURY}, /* "century" relative */
{DCENTURY, UNITS, DTK_CENTURY}, /* "century" relative */
{"d", UNITS, DTK_DAY}, /* "day" relative */
{DDAY, UNITS, DTK_DAY}, /* "day" relative */
{"days", UNITS, DTK_DAY}, /* "days" relative */
{"dec", UNITS, DTK_DECADE}, /* "decade" relative */
{DDECADE, UNITS, DTK_DECADE}, /* "decade" relative */
{"decades", UNITS, DTK_DECADE}, /* "decades" relative */
{DDECADE, UNITS, DTK_DECADE}, /* "decade" relative */
{"decades", UNITS, DTK_DECADE}, /* "decades" relative */
{"decs", UNITS, DTK_DECADE}, /* "decades" relative */
{"h", UNITS, DTK_HOUR}, /* "hour" relative */
{DHOUR, UNITS, DTK_HOUR}, /* "hour" relative */
{"hours", UNITS, DTK_HOUR}, /* "hours" relative */
{"hr", UNITS, DTK_HOUR}, /* "hour" relative */
{"hrs", UNITS, DTK_HOUR}, /* "hours" relative */
{INVALID, RESERV, DTK_INVALID}, /* reserved for invalid time */
{INVALID, RESERV, DTK_INVALID}, /* reserved for invalid time */
{"m", UNITS, DTK_MINUTE}, /* "minute" relative */
{"microsecon", UNITS, DTK_MICROSEC}, /* "microsecond" relative */
{"mil", UNITS, DTK_MILLENNIUM}, /* "millennium" relative */
{"millennia", UNITS, DTK_MILLENNIUM}, /* "millennia" relative */
{DMILLENNIUM, UNITS, DTK_MILLENNIUM}, /* "millennium" relative */
{"millisecon", UNITS, DTK_MILLISEC}, /* relative */
{"microsecon", UNITS, DTK_MICROSEC}, /* "microsecond" relative */
{"mil", UNITS, DTK_MILLENNIUM}, /* "millennium" relative */
{"millennia", UNITS, DTK_MILLENNIUM}, /* "millennia" relative */
{DMILLENNIUM, UNITS, DTK_MILLENNIUM}, /* "millennium" relative */
{"millisecon", UNITS, DTK_MILLISEC}, /* relative */
{"mils", UNITS, DTK_MILLENNIUM}, /* "millennia" relative */
{"min", UNITS, DTK_MINUTE}, /* "minute" relative */
{"mins", UNITS, DTK_MINUTE}, /* "minutes" relative */
{DMINUTE, UNITS, DTK_MINUTE}, /* "minute" relative */
{"minutes", UNITS, DTK_MINUTE}, /* "minutes" relative */
{DMINUTE, UNITS, DTK_MINUTE}, /* "minute" relative */
{"minutes", UNITS, DTK_MINUTE}, /* "minutes" relative */
{"mon", UNITS, DTK_MONTH}, /* "months" relative */
{"mons", UNITS, DTK_MONTH}, /* "months" relative */
{DMONTH, UNITS, DTK_MONTH}, /* "month" relative */
@ -462,7 +462,7 @@ static datetkn deltatktbl[] = {
{"mseconds", UNITS, DTK_MILLISEC},
{"msecs", UNITS, DTK_MILLISEC},
{"qtr", UNITS, DTK_QUARTER}, /* "quarter" relative */
{DQUARTER, UNITS, DTK_QUARTER}, /* "quarter" relative */
{DQUARTER, UNITS, DTK_QUARTER}, /* "quarter" relative */
{"s", UNITS, DTK_SECOND},
{"sec", UNITS, DTK_SECOND},
{DSECOND, UNITS, DTK_SECOND},
@ -470,13 +470,13 @@ static datetkn deltatktbl[] = {
{"secs", UNITS, DTK_SECOND},
{DTIMEZONE, UNITS, DTK_TZ}, /* "timezone" time offset */
{"timezone_h", UNITS, DTK_TZ_HOUR}, /* timezone hour units */
{"timezone_m", UNITS, DTK_TZ_MINUTE}, /* timezone minutes units */
{"timezone_m", UNITS, DTK_TZ_MINUTE}, /* timezone minutes units */
{"undefined", RESERV, DTK_INVALID}, /* pre-v6.1 invalid time */
{"us", UNITS, DTK_MICROSEC}, /* "microsecond" relative */
{"usec", UNITS, DTK_MICROSEC}, /* "microsecond" relative */
{"usec", UNITS, DTK_MICROSEC}, /* "microsecond" relative */
{DMICROSEC, UNITS, DTK_MICROSEC}, /* "microsecond" relative */
{"useconds", UNITS, DTK_MICROSEC}, /* "microseconds" relative */
{"usecs", UNITS, DTK_MICROSEC}, /* "microseconds" relative */
{"usecs", UNITS, DTK_MICROSEC}, /* "microseconds" relative */
{"w", UNITS, DTK_WEEK}, /* "week" relative */
{DWEEK, UNITS, DTK_WEEK}, /* "week" relative */
{"weeks", UNITS, DTK_WEEK}, /* "weeks" relative */

View File

@ -11,13 +11,12 @@
#define PGTYPES_TYPE_STRING_MALLOCED 1
#define PGTYPES_TYPE_STRING_CONSTANT 2
#define PGTYPES_TYPE_CHAR 3
#define PGTYPES_TYPE_DOUBLE_NF 4 /* no fractional part */
#define PGTYPES_TYPE_DOUBLE_NF 4 /* no fractional part */
#define PGTYPES_TYPE_INT64 5
#define PGTYPES_TYPE_UINT 6
#define PGTYPES_TYPE_UINT_2_LZ 7 /* 2 digits, pad with leading
* zero */
#define PGTYPES_TYPE_UINT_2_LS 8 /* 2 digits, pad with leading
* space */
#define PGTYPES_TYPE_UINT_2_LZ 7 /* 2 digits, pad with leading zero */
#define PGTYPES_TYPE_UINT_2_LS 8 /* 2 digits, pad with leading
* space */
#define PGTYPES_TYPE_UINT_3_LZ 9
#define PGTYPES_TYPE_UINT_4_LZ 10
#define PGTYPES_TYPE_UINT_LONG 11
@ -41,14 +40,14 @@ char *pgtypes_strdup(const char *);
#ifndef bool
#define bool char
#endif /* ndef bool */
#endif /* ndef bool */
#ifndef FALSE
#define FALSE 0
#endif /* FALSE */
#endif /* FALSE */
#ifndef TRUE
#define TRUE 1
#endif /* TRUE */
#endif /* TRUE */
#endif /* __PGTYPES_COMMON_H__ */
#endif /* __PGTYPES_COMMON_H__ */

View File

@ -335,7 +335,7 @@ DecodeISO8601Interval(char *str,
* * Assert wasn't available so removed it.
*/
int
DecodeInterval(char **field, int *ftype, int nf, /* int range, */
DecodeInterval(char **field, int *ftype, int nf, /* int range, */
int *dtype, struct /* pg_ */ tm *tm, fsec_t *fsec)
{
int IntervalStyle = INTSTYLE_POSTGRES_VERBOSE;

View File

@ -152,7 +152,7 @@ timestamp2tm(timestamp dt, int *tzp, struct tm *tm, fsec_t *fsec, const char **t
tm->tm_gmtoff = tx->tm_gmtoff;
tm->tm_zone = tx->tm_zone;
*tzp = -tm->tm_gmtoff; /* tm_gmtoff is Sun/DEC-ism */
*tzp = -tm->tm_gmtoff; /* tm_gmtoff is Sun/DEC-ism */
if (tzn != NULL)
*tzn = tm->tm_zone;
#elif defined(HAVE_INT_TIMEZONE)

View File

@ -128,4 +128,4 @@ extern enum COMPAT_MODE compat;
#define INFORMIX_MODE (compat == ECPG_COMPAT_INFORMIX || compat == ECPG_COMPAT_INFORMIX_SE)
#endif /* _ECPG_PREPROC_EXTERN_H */
#endif /* _ECPG_PREPROC_EXTERN_H */

View File

@ -228,8 +228,8 @@ output_escaped_str(char *str, bool quoted)
j++;
} while (str[j] == ' ' || str[j] == '\t');
if ((str[j] != '\n') && (str[j] != '\r' || str[j + 1] != '\n')) /* not followed by a
* newline */
if ((str[j] != '\n') && (str[j] != '\r' || str[j + 1] != '\n')) /* not followed by a
* newline */
fputs("\\\\", base_yyout);
}
else if (str[i] == '\r' && str[i + 1] == '\n')

View File

@ -178,7 +178,7 @@ get_type(enum ECPGttype type)
case ECPGt_NO_INDICATOR: /* no indicator */
return ("ECPGt_NO_INDICATOR");
break;
case ECPGt_char_variable: /* string that should not be quoted */
case ECPGt_char_variable: /* string that should not be quoted */
return ("ECPGt_char_variable");
break;
case ECPGt_const: /* constant string quoted */

View File

@ -25,10 +25,9 @@ struct ECPGtype
* string */
union
{
struct ECPGtype *element; /* For an array this is the type of
* the element */
struct ECPGstruct_member *members; /* A pointer to a list of
* members. */
struct ECPGtype *element; /* For an array this is the type of the
* element */
struct ECPGstruct_member *members; /* A pointer to a list of members. */
} u;
int counter;
};
@ -195,4 +194,4 @@ struct fetch_desc
char *name;
};
#endif /* _ECPG_PREPROC_TYPE_H */
#endif /* _ECPG_PREPROC_TYPE_H */

View File

@ -41,7 +41,7 @@ typedef struct sqlda_struct sqlda_t;
#endif
#endif /* ECPG_SQLDA_H */
#endif /* ECPG_SQLDA_H */
#line 5 "describe.pgc"

View File

@ -43,7 +43,7 @@ typedef struct sqlda_struct sqlda_t;
#endif
#endif /* ECPG_SQLDA_H */
#endif /* ECPG_SQLDA_H */
#line 7 "sqlda.pgc"
@ -105,7 +105,7 @@ typedef struct sqlda_struct sqlda_t;
#define SQLSERIAL8 ECPGt_long
#endif
#endif /* ndef ECPG_SQLTYPES_H */
#endif /* ndef ECPG_SQLTYPES_H */
#line 8 "sqlda.pgc"

View File

@ -23,8 +23,8 @@
#define PGDLLIMPORT __declspec (dllimport)
#else
#define PGDLLIMPORT
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#define SQLERRMC_LEN 150

View File

@ -17,8 +17,8 @@
#define PGDLLIMPORT __declspec (dllimport)
#else
#define PGDLLIMPORT
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#define SQLERRMC_LEN 150

View File

@ -58,7 +58,7 @@ typedef struct
int rscale; /* result scale */
int dscale; /* display scale */
int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */
NumericDigit digits[DECSIZE]; /* decimal digits */
NumericDigit digits[DECSIZE]; /* decimal digits */
} decimal;
#ifdef __cplusplus
@ -91,7 +91,7 @@ int PGTYPESnumeric_from_decimal(decimal *, numeric *);
}
#endif
#endif /* PGTYPES_NUMERIC */
#endif /* PGTYPES_NUMERIC */
#line 8 "outofscope.pgc"

View File

@ -30,8 +30,8 @@
#define PGDLLIMPORT __declspec (dllimport)
#else
#define PGDLLIMPORT
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#define SQLERRMC_LEN 150

View File

@ -17,8 +17,8 @@
#define PGDLLIMPORT __declspec (dllimport)
#else
#define PGDLLIMPORT
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#define SQLERRMC_LEN 150

View File

@ -19,8 +19,8 @@
#define PGDLLIMPORT __declspec (dllimport)
#else
#define PGDLLIMPORT
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#define SQLERRMC_LEN 150

View File

@ -17,8 +17,8 @@
#define PGDLLIMPORT __declspec (dllimport)
#else
#define PGDLLIMPORT
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#define SQLERRMC_LEN 150

View File

@ -39,7 +39,7 @@ typedef struct sqlda_struct sqlda_t;
#endif
#endif /* ECPG_SQLDA_H */
#endif /* ECPG_SQLDA_H */
#line 5 "describe.pgc"

View File

@ -18,8 +18,8 @@
#define PGDLLIMPORT __declspec (dllimport)
#else
#define PGDLLIMPORT
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#define SQLERRMC_LEN 150

View File

@ -18,8 +18,8 @@
#define PGDLLIMPORT __declspec (dllimport)
#else
#define PGDLLIMPORT
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#define SQLERRMC_LEN 150

View File

@ -57,7 +57,7 @@ enum
* standard) */
};
#endif /* !_ECPG_SQL3TYPES_H */
#endif /* !_ECPG_SQL3TYPES_H */
#line 7 "dyntest.pgc"
@ -71,8 +71,8 @@ enum
#define PGDLLIMPORT __declspec (dllimport)
#else
#define PGDLLIMPORT
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#define SQLERRMC_LEN 150

View File

@ -19,8 +19,8 @@
#define PGDLLIMPORT __declspec (dllimport)
#else
#define PGDLLIMPORT
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#define SQLERRMC_LEN 150

View File

@ -41,7 +41,7 @@ typedef struct sqlda_struct sqlda_t;
#endif
#endif /* ECPG_SQLDA_H */
#endif /* ECPG_SQLDA_H */
#line 7 "sqlda.pgc"
@ -80,7 +80,7 @@ typedef struct
int rscale; /* result scale */
int dscale; /* display scale */
int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */
NumericDigit digits[DECSIZE]; /* decimal digits */
NumericDigit digits[DECSIZE]; /* decimal digits */
} decimal;
#ifdef __cplusplus
@ -113,7 +113,7 @@ int PGTYPESnumeric_from_decimal(decimal *, numeric *);
}
#endif
#endif /* PGTYPES_NUMERIC */
#endif /* PGTYPES_NUMERIC */
#line 8 "sqlda.pgc"

View File

@ -40,8 +40,8 @@ main(void)
#define PGDLLIMPORT __declspec (dllimport)
#else
#define PGDLLIMPORT
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#define SQLERRMC_LEN 150

View File

@ -31,8 +31,8 @@
#define PGDLLIMPORT __declspec (dllimport)
#else
#define PGDLLIMPORT
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#define SQLERRMC_LEN 150

View File

@ -40,8 +40,8 @@ main(void)
#define PGDLLIMPORT __declspec (dllimport)
#else
#define PGDLLIMPORT
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#endif /* __CYGWIN__ */
#endif /* PGDLLIMPORT */
#define SQLERRMC_LEN 150

View File

@ -251,7 +251,7 @@ pg_GSS_startup(PGconn *conn, int payloadlen)
return pg_GSS_continue(conn, payloadlen);
}
#endif /* ENABLE_GSS */
#endif /* ENABLE_GSS */
#ifdef ENABLE_SSPI
@ -477,7 +477,7 @@ pg_SSPI_startup(PGconn *conn, int use_negotiate, int payloadlen)
return pg_SSPI_continue(conn, payloadlen);
}
#endif /* ENABLE_SSPI */
#endif /* ENABLE_SSPI */
/*
* Initialize SASL authentication exchange.
@ -901,7 +901,7 @@ pg_fe_sendauth(AuthRequest areq, int payloadlen, PGconn *conn)
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("GSSAPI authentication not supported\n"));
return STATUS_ERROR;
#endif /* defined(ENABLE_GSS) || defined(ENABLE_SSPI) */
#endif /* defined(ENABLE_GSS) || defined(ENABLE_SSPI) */
#ifdef ENABLE_SSPI
case AUTH_REQ_SSPI:
@ -933,8 +933,8 @@ pg_fe_sendauth(AuthRequest areq, int payloadlen, PGconn *conn)
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("SSPI authentication not supported\n"));
return STATUS_ERROR;
#endif /* !define(ENABLE_GSSAPI) */
#endif /* ENABLE_SSPI */
#endif /* !define(ENABLE_GSSAPI) */
#endif /* ENABLE_SSPI */
case AUTH_REQ_CRYPT:

View File

@ -30,4 +30,4 @@ extern void pg_fe_scram_exchange(void *opaq, char *input, int inputlen,
bool *done, bool *success, PQExpBuffer errorMessage);
extern char *pg_fe_scram_build_verifier(const char *password);
#endif /* FE_AUTH_H */
#endif /* FE_AUTH_H */

View File

@ -184,7 +184,7 @@ static const internalPQconninfoOption PQconninfoOptions[] = {
offsetof(struct pg_conn, pgpassfile)},
{"connect_timeout", "PGCONNECT_TIMEOUT", NULL, NULL,
"Connect-timeout", "", 10, /* strlen(INT32_MAX) == 10 */
"Connect-timeout", "", 10, /* strlen(INT32_MAX) == 10 */
offsetof(struct pg_conn, connect_timeout)},
{"dbname", "PGDATABASE", NULL, NULL,
@ -236,7 +236,7 @@ static const internalPQconninfoOption PQconninfoOptions[] = {
offsetof(struct pg_conn, keepalives_idle)},
{"keepalives_interval", NULL, NULL, NULL,
"TCP-Keepalives-Interval", "", 10, /* strlen(INT32_MAX) == 10 */
"TCP-Keepalives-Interval", "", 10, /* strlen(INT32_MAX) == 10 */
offsetof(struct pg_conn, keepalives_interval)},
{"keepalives_count", NULL, NULL, NULL,
@ -1369,7 +1369,7 @@ connectFailureMessage(PGconn *conn, int errorno)
service);
}
else
#endif /* HAVE_UNIX_SOCKETS */
#endif /* HAVE_UNIX_SOCKETS */
{
char host_addr[NI_MAXHOST];
const char *displayed_host;
@ -1608,8 +1608,8 @@ setKeepalivesWin32(PGconn *conn)
}
return 1;
}
#endif /* SIO_KEEPALIVE_VALS */
#endif /* WIN32 */
#endif /* SIO_KEEPALIVE_VALS */
#endif /* WIN32 */
/* ----------
* connectDBStart -
@ -2086,7 +2086,7 @@ keep_going: /* We will come back to here until there is
conn->addr_cur = addr_cur->ai_next;
continue;
}
#endif /* F_SETFD */
#endif /* F_SETFD */
if (!IS_AF_UNIX(addr_cur->ai_family))
{
@ -2124,8 +2124,8 @@ keep_going: /* We will come back to here until there is
#ifdef SIO_KEEPALIVE_VALS
else if (!setKeepalivesWin32(conn))
err = 1;
#endif /* SIO_KEEPALIVE_VALS */
#endif /* WIN32 */
#endif /* SIO_KEEPALIVE_VALS */
#endif /* WIN32 */
if (err)
{
@ -2163,7 +2163,7 @@ keep_going: /* We will come back to here until there is
conn->sigpipe_flag = true;
#else
conn->sigpipe_flag = false;
#endif /* MSG_NOSIGNAL */
#endif /* MSG_NOSIGNAL */
#ifdef SO_NOSIGPIPE
optval = 1;
@ -2173,7 +2173,7 @@ keep_going: /* We will come back to here until there is
conn->sigpipe_so = true;
conn->sigpipe_flag = false;
}
#endif /* SO_NOSIGPIPE */
#endif /* SO_NOSIGPIPE */
/*
* Start/make connection. This should not block, since we
@ -2357,7 +2357,7 @@ keep_going: /* We will come back to here until there is
goto error_return;
}
}
#endif /* HAVE_UNIX_SOCKETS */
#endif /* HAVE_UNIX_SOCKETS */
#ifdef USE_SSL
@ -2394,7 +2394,7 @@ keep_going: /* We will come back to here until there is
conn->status = CONNECTION_SSL_STARTUP;
return PGRES_POLLING_READING;
}
#endif /* USE_SSL */
#endif /* USE_SSL */
/*
* Build the startup packet.
@ -2559,7 +2559,7 @@ keep_going: /* We will come back to here until there is
#else /* !USE_SSL */
/* can't get here */
goto error_return;
#endif /* USE_SSL */
#endif /* USE_SSL */
}
/*
@ -2962,11 +2962,11 @@ keep_going: /* We will come back to here until there is
case PGRES_POLLING_OK: /* Success */
break;
case PGRES_POLLING_READING: /* Still going */
case PGRES_POLLING_READING: /* Still going */
conn->status = CONNECTION_SETENV;
return PGRES_POLLING_READING;
case PGRES_POLLING_WRITING: /* Still going */
case PGRES_POLLING_WRITING: /* Still going */
conn->status = CONNECTION_SETENV;
return PGRES_POLLING_WRITING;
@ -3510,8 +3510,7 @@ closePGconn(PGconn *conn)
* Close the connection, reset all transient state, flush I/O buffers.
*/
pqDropConnection(conn, true);
conn->status = CONNECTION_BAD; /* Well, not really _bad_ - just
* absent */
conn->status = CONNECTION_BAD; /* Well, not really _bad_ - just absent */
conn->asyncStatus = PGASYNC_IDLE;
pqClearAsyncResult(conn); /* deallocate result */
resetPQExpBuffer(&conn->errorMessage);
@ -4158,7 +4157,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options,
ldap_unbind(ld);
return 3;
}
#endif /* WIN32 */
#endif /* WIN32 */
/* search */
res = NULL;
@ -4383,7 +4382,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options,
return 0;
}
#endif /* USE_LDAP */
#endif /* USE_LDAP */
#define MAXBUFSIZE 256
@ -5412,7 +5411,7 @@ conninfo_uri_parse_options(PQconninfoOption *options, const char *uri,
if (prevchar == ':')
{
const char *port = ++p; /* advance past host terminator */
const char *port = ++p; /* advance past host terminator */
while (*p && *p != '/' && *p != '?' && *p != ',')
++p;
@ -5444,7 +5443,7 @@ conninfo_uri_parse_options(PQconninfoOption *options, const char *uri,
if (prevchar && prevchar != '?')
{
const char *dbname = ++p; /* advance past host terminator */
const char *dbname = ++p; /* advance past host terminator */
/* Look for query parameters */
while (*p && *p != '?')

View File

@ -125,7 +125,7 @@ static int check_field_number(const PGresult *res, int field_num);
*/
#define PGRESULT_DATA_BLOCKSIZE 2048
#define PGRESULT_ALIGN_BOUNDARY MAXIMUM_ALIGNOF /* from configure */
#define PGRESULT_ALIGN_BOUNDARY MAXIMUM_ALIGNOF /* from configure */
#define PGRESULT_BLOCK_OVERHEAD Max(sizeof(PGresult_data), PGRESULT_ALIGN_BOUNDARY)
#define PGRESULT_SEP_ALLOC_THRESHOLD (PGRESULT_DATA_BLOCKSIZE / 2)
@ -3026,7 +3026,7 @@ PQcmdTuples(PGresult *res)
while (*p && *p != ' ')
p++;
if (*p == 0)
goto interpret_error; /* no space? */
goto interpret_error; /* no space? */
p++;
}
else if (strncmp(res->cmdStatus, "SELECT ", 7) == 0 ||

View File

@ -814,7 +814,7 @@ definitelyEOF:
definitelyFailed:
/* Do *not* drop any already-read data; caller still wants it */
pqDropConnection(conn, false);
conn->status = CONNECTION_BAD; /* No more connection to backend */
conn->status = CONNECTION_BAD; /* No more connection to backend */
return -1;
}
@ -1165,7 +1165,7 @@ pqSocketPoll(int sock, int forRead, int forWrite, time_t end_time)
return select(sock + 1, &input_mask, &output_mask,
&except_mask, ptr_timeout);
#endif /* HAVE_POLL */
#endif /* HAVE_POLL */
}
@ -1259,4 +1259,4 @@ libpq_ngettext(const char *msgid, const char *msgid_plural, unsigned long n)
return dngettext(PG_TEXTDOMAIN("libpq"), msgid, msgid_plural, n);
}
#endif /* ENABLE_NLS */
#endif /* ENABLE_NLS */

View File

@ -177,7 +177,7 @@ PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po)
(1 + (po->standard != 0)) >= screen_size.ws_row -
(po->header != 0) *
(total_line_length / screen_size.ws_col + 1) * 2
- (po->header != 0) * 2 /* row count and newline */
- (po->header != 0) * 2 /* row count and newline */
)))
{
fout = popen(pagerenv, "w");
@ -190,8 +190,8 @@ PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po)
sigpipe_masked = true;
#else
oldsigpipehandler = pqsignal(SIGPIPE, SIG_IGN);
#endif /* ENABLE_THREAD_SAFETY */
#endif /* WIN32 */
#endif /* ENABLE_THREAD_SAFETY */
#endif /* WIN32 */
}
else
fout = stdout;
@ -313,8 +313,8 @@ PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po)
pq_reset_sigpipe(&osigset, sigpipe_pending, true);
#else
pqsignal(SIGPIPE, oldsigpipehandler);
#endif /* ENABLE_THREAD_SAFETY */
#endif /* WIN32 */
#endif /* ENABLE_THREAD_SAFETY */
#endif /* WIN32 */
}
if (po->html3 && !po->expanded)
fputs("</table>\n", fout);

View File

@ -1099,7 +1099,7 @@ checkXactStatus(PGconn *conn, const char *cmdTag)
* However, if we see one of these tags then we know for sure the server
* is in abort state ...
*/
else if (strcmp(cmdTag, "*ABORT STATE*") == 0) /* pre-7.3 only */
else if (strcmp(cmdTag, "*ABORT STATE*") == 0) /* pre-7.3 only */
conn->xactStatus = PQTRANS_INERROR;
}
@ -1526,7 +1526,7 @@ pqFunctionCall2(PGconn *conn, Oid fnid,
conn))
continue;
}
if (pqGetc(&id, conn)) /* get the last '0' */
if (pqGetc(&id, conn)) /* get the last '0' */
continue;
}
if (id == '0')

View File

@ -458,7 +458,7 @@ handleSyncLoss(PGconn *conn, char id, int msgLength)
conn->asyncStatus = PGASYNC_READY; /* drop out of GetResult wait loop */
/* flush input data since we're giving up on processing it */
pqDropConnection(conn, true);
conn->status = CONNECTION_BAD; /* No more connection to backend */
conn->status = CONNECTION_BAD; /* No more connection to backend */
}
/*
@ -1679,7 +1679,7 @@ pqGetCopyData3(PGconn *conn, char **buffer, int async)
return -2;
}
memcpy(*buffer, &conn->inBuffer[conn->inCursor], msgLength);
(*buffer)[msgLength] = '\0'; /* Add terminating null */
(*buffer)[msgLength] = '\0'; /* Add terminating null */
/* Mark message consumed */
conn->inStart = conn->inCursor + msgLength;
@ -1915,8 +1915,8 @@ pqFunctionCall3(PGconn *conn, Oid fnid,
if (pqPutMsgStart('F', false, conn) < 0 || /* function call msg */
pqPutInt(fnid, 4, conn) < 0 || /* function id */
pqPutInt(1, 2, conn) < 0 || /* # of format codes */
pqPutInt(1, 2, conn) < 0 || /* format code: BINARY */
pqPutInt(1, 2, conn) < 0 || /* # of format codes */
pqPutInt(1, 2, conn) < 0 || /* format code: BINARY */
pqPutInt(nargs, 2, conn) < 0) /* # of args */
{
pqHandleSendFailure(conn);
@ -1951,7 +1951,7 @@ pqFunctionCall3(PGconn *conn, Oid fnid,
}
}
if (pqPutInt(1, 2, conn) < 0) /* result format code: BINARY */
if (pqPutInt(1, 2, conn) < 0) /* result format code: BINARY */
{
pqHandleSendFailure(conn);
return NULL;

View File

@ -91,7 +91,7 @@ static pthread_mutex_t ssl_config_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t ssl_config_mutex = NULL;
static long win32_ssl_create_mutex = 0;
#endif
#endif /* ENABLE_THREAD_SAFETY */
#endif /* ENABLE_THREAD_SAFETY */
/* ------------------------------------------------------------ */
@ -730,7 +730,7 @@ pq_lockingcallback(int mode, int n, const char *file, int line)
PGTHREAD_ERROR("failed to unlock mutex");
}
}
#endif /* ENABLE_THREAD_SAFETY && HAVE_CRYPTO_LOCK */
#endif /* ENABLE_THREAD_SAFETY && HAVE_CRYPTO_LOCK */
/*
* Initialize SSL library.
@ -809,8 +809,8 @@ pgtls_init(PGconn *conn)
CRYPTO_set_locking_callback(pq_lockingcallback);
}
}
#endif /* HAVE_CRYPTO_LOCK */
#endif /* ENABLE_THREAD_SAFETY */
#endif /* HAVE_CRYPTO_LOCK */
#endif /* ENABLE_THREAD_SAFETY */
if (!ssl_lib_initialized)
{
@ -1142,7 +1142,7 @@ initialize_SSL(PGconn *conn)
/* cannot return NULL because we already checked before strdup */
engine_colon = strchr(engine_str, ':');
*engine_colon = '\0'; /* engine_str now has engine name */
*engine_colon = '\0'; /* engine_str now has engine name */
engine_colon++; /* engine_colon now has key name */
conn->engine = ENGINE_by_id(engine_str);
@ -1209,7 +1209,7 @@ initialize_SSL(PGconn *conn)
* file */
}
else
#endif /* USE_SSL_ENGINE */
#endif /* USE_SSL_ENGINE */
{
/* PGSSLKEY is not an engine, treat it as a filename */
strlcpy(fnbuf, conn->sslkey, sizeof(fnbuf));

View File

@ -115,14 +115,14 @@ struct sigpipe_info
if (!SIGPIPE_MASKED(conn)) \
pqsignal(SIGPIPE, spinfo); \
} while (0)
#endif /* ENABLE_THREAD_SAFETY */
#endif /* ENABLE_THREAD_SAFETY */
#else /* WIN32 */
#define DECLARE_SIGPIPE_INFO(spinfo)
#define DISABLE_SIGPIPE(conn, spinfo, failaction)
#define REMEMBER_EPIPE(spinfo, cond)
#define RESTORE_SIGPIPE(conn, spinfo)
#endif /* WIN32 */
#endif /* WIN32 */
/* ------------------------------------------------------------ */
/* Procedures common to all secure sessions */
@ -312,7 +312,7 @@ pqsecure_raw_write(PGconn *conn, const void *ptr, size_t len)
flags |= MSG_NOSIGNAL;
retry_masked:
#endif /* MSG_NOSIGNAL */
#endif /* MSG_NOSIGNAL */
DISABLE_SIGPIPE(conn, spinfo, return -1);
@ -334,7 +334,7 @@ retry_masked:
flags = 0;
goto retry_masked;
}
#endif /* MSG_NOSIGNAL */
#endif /* MSG_NOSIGNAL */
/* Set error message if appropriate */
switch (result_errno)
@ -415,7 +415,7 @@ PQsslAttributeNames(PGconn *conn)
return result;
}
#endif /* USE_SSL */
#endif /* USE_SSL */
#if defined(ENABLE_THREAD_SAFETY) && !defined(WIN32)
@ -502,4 +502,4 @@ pq_reset_sigpipe(sigset_t *osigset, bool sigpipe_pending, bool got_epipe)
SOCK_ERRNO_SET(save_errno);
}
#endif /* ENABLE_THREAD_SAFETY && !WIN32 */
#endif /* ENABLE_THREAD_SAFETY && !WIN32 */

View File

@ -91,4 +91,4 @@ extern int PQfireResultCreateEvents(PGconn *conn, PGresult *res);
}
#endif
#endif /* LIBPQ_EVENTS_H */
#endif /* LIBPQ_EVENTS_H */

View File

@ -56,8 +56,8 @@ typedef enum
*/
CONNECTION_STARTED, /* Waiting for connection to be made. */
CONNECTION_MADE, /* Connection OK; waiting to send. */
CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the
* postmaster. */
CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the
* postmaster. */
CONNECTION_AUTH_OK, /* Received authentication; waiting for
* backend startup. */
CONNECTION_SETENV, /* Negotiating environment. */
@ -609,4 +609,4 @@ extern int pg_valid_server_encoding_id(int encoding);
}
#endif
#endif /* LIBPQ_FE_H */
#endif /* LIBPQ_FE_H */

View File

@ -69,7 +69,7 @@ typedef struct
int length;
} gss_buffer_desc;
#endif
#endif /* ENABLE_SSPI */
#endif /* ENABLE_SSPI */
#ifdef USE_OPENSSL
#include <openssl/ssl.h>
@ -78,7 +78,7 @@ typedef struct
#ifndef OPENSSL_NO_ENGINE
#define USE_SSL_ENGINE
#endif
#endif /* USE_OPENSSL */
#endif /* USE_OPENSSL */
/*
* POSTGRES backend dependent Constants.
@ -143,7 +143,7 @@ typedef struct pgMessageField
{
struct pgMessageField *next; /* list link */
char code; /* field code */
char contents[FLEXIBLE_ARRAY_MEMBER]; /* value, nul-terminated */
char contents[FLEXIBLE_ARRAY_MEMBER]; /* value, nul-terminated */
} PGMessageField;
/* Fields needed for notice handling */
@ -151,7 +151,7 @@ typedef struct
{
PQnoticeReceiver noticeRec; /* notice message receiver */
void *noticeRecArg;
PQnoticeProcessor noticeProc; /* notice message processor */
PQnoticeProcessor noticeProc; /* notice message processor */
void *noticeProcArg;
} PGNoticeHooks;
@ -161,7 +161,7 @@ typedef struct PGEvent
char *name; /* used only for error messages */
void *passThrough; /* pointer supplied at registration time */
void *data; /* optional state (instance) data */
bool resultInitialized; /* T if RESULTCREATE/COPY succeeded */
bool resultInitialized; /* T if RESULTCREATE/COPY succeeded */
} PGEvent;
struct pg_result
@ -175,7 +175,7 @@ struct pg_result
int numParameters;
PGresParamDesc *paramDescs;
ExecStatusType resultStatus;
char cmdStatus[CMDSTATUS_LEN]; /* cmd status from the query */
char cmdStatus[CMDSTATUS_LEN]; /* cmd status from the query */
int binary; /* binary tuple values if binary == 1,
* otherwise text */
@ -255,7 +255,7 @@ typedef struct PQEnvironmentOption
/* Typedef for parameter-status list entries */
typedef struct pgParameterStatus
{
struct pgParameterStatus *next; /* list link */
struct pgParameterStatus *next; /* list link */
char *name; /* parameter name */
char *value; /* parameter value */
/* Note: name and value are stored in same malloc block as struct is */
@ -274,7 +274,7 @@ typedef struct pgLobjfuncs
Oid fn_lo_tell; /* OID of backend function lo_tell */
Oid fn_lo_tell64; /* OID of backend function lo_tell64 */
Oid fn_lo_truncate; /* OID of backend function lo_truncate */
Oid fn_lo_truncate64; /* OID of function lo_truncate64 */
Oid fn_lo_truncate64; /* OID of function lo_truncate64 */
Oid fn_lo_read; /* OID of backend function LOread */
Oid fn_lo_write; /* OID of backend function LOwrite */
} PGlobjfuncs;
@ -333,7 +333,7 @@ struct pg_conn
char *pgtty; /* tty on which the backend messages is
* displayed (OBSOLETE, NOT USED) */
char *connect_timeout; /* connection timeout (numeric string) */
char *client_encoding_initial; /* encoding to use */
char *client_encoding_initial; /* encoding to use */
char *pgoptions; /* options to start the backend with */
char *appname; /* application name */
char *fbappname; /* fallback application name */
@ -346,8 +346,8 @@ struct pg_conn
char *keepalives_idle; /* time between TCP keepalives */
char *keepalives_interval; /* time between TCP keepalive
* retransmits */
char *keepalives_count; /* maximum number of TCP keepalive
* retransmits */
char *keepalives_count; /* maximum number of TCP keepalive
* retransmits */
char *sslmode; /* SSL mode (require,prefer,allow,disable) */
char *sslcompression; /* SSL compression (0 or 1) */
char *sslkey; /* client key filename */
@ -380,14 +380,13 @@ struct pg_conn
PGTransactionStatusType xactStatus; /* never changes to ACTIVE */
PGQueryClass queryclass;
char *last_query; /* last SQL command, or NULL if unknown */
char last_sqlstate[6]; /* last reported SQLSTATE */
char last_sqlstate[6]; /* last reported SQLSTATE */
bool options_valid; /* true if OK to attempt connection */
bool nonblocking; /* whether this connection is using nonblock
* sending semantics */
bool singleRowMode; /* return current query result row-by-row? */
char copy_is_binary; /* 1 = copy binary, 0 = copy text */
int copy_already_done; /* # bytes already returned in COPY
* OUT */
int copy_already_done; /* # bytes already returned in COPY OUT */
PGnotify *notifyHead; /* oldest unreported Notify msg */
PGnotify *notifyTail; /* newest unreported Notify msg */
@ -403,8 +402,7 @@ struct pg_conn
SockAddr raddr; /* Remote address */
ProtocolVersion pversion; /* FE/BE protocol version in use */
int sversion; /* server version, e.g. 70401 for 7.4.1 */
bool auth_req_received; /* true if any type of auth req
* received */
bool auth_req_received; /* true if any type of auth req received */
bool password_needed; /* true if server demanded a password */
bool pgpassfile_used; /* true if password is from pgpassfile */
bool sigpipe_so; /* have we masked SIGPIPE via SO_NOSIGPIPE? */
@ -468,8 +466,8 @@ struct pg_conn
void *engine; /* dummy field to keep struct the same if
* OpenSSL version changes */
#endif
#endif /* USE_OPENSSL */
#endif /* USE_SSL */
#endif /* USE_OPENSSL */
#endif /* USE_SSL */
#ifdef ENABLE_GSS
gss_ctx_id_t gctx; /* GSS context */
@ -489,7 +487,7 @@ struct pg_conn
#endif
/* Buffer for current error message */
PQExpBufferData errorMessage; /* expansible string */
PQExpBufferData errorMessage; /* expansible string */
/* Buffer for receiving various parts of messages */
PQExpBufferData workBuffer; /* expansible string */
@ -528,7 +526,7 @@ extern char *const pgresStatus[];
#define ROOT_CRL_FILE "root.crl"
#endif
#endif /* USE_SSL */
#endif /* USE_SSL */
/* ----------------
* Internal functions of libpq
@ -698,4 +696,4 @@ extern char *libpq_ngettext(const char *msgid, const char *msgid_plural, unsigne
#define SOCK_ERRNO_SET(e) (errno = (e))
#endif
#endif /* LIBPQ_INT_H */
#endif /* LIBPQ_INT_H */

View File

@ -91,7 +91,7 @@ initPQExpBuffer(PQExpBuffer str)
str->data = (char *) malloc(INITIAL_EXPBUFFER_SIZE);
if (str->data == NULL)
{
str->data = (char *) oom_buffer; /* see comment above */
str->data = (char *) oom_buffer; /* see comment above */
str->maxlen = 0;
str->len = 0;
}

View File

@ -179,4 +179,4 @@ extern void appendPQExpBufferChar(PQExpBuffer str, char ch);
extern void appendBinaryPQExpBuffer(PQExpBuffer str,
const char *data, size_t datalen);
#endif /* PQEXPBUFFER_H */
#endif /* PQEXPBUFFER_H */