1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-25 01:02:05 +03:00

pgindent run for 9.4

This includes removing tabs after periods in C comments, which was
applied to back branches, so this change should not effect backpatching.
This commit is contained in:
Bruce Momjian
2014-05-06 12:12:18 -04:00
parent fb85cd4320
commit 0a78320057
854 changed files with 7848 additions and 7368 deletions

View File

@ -461,7 +461,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
* character pointers. So, use extra indirection.
*/
if (varcharsize == 0 && offset == sizeof(char *))
str = *(char **)str;
str = *(char **) str;
if (varcharsize == 0 || varcharsize > size)
{

View File

@ -855,7 +855,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
for (element = 0; element < var->arrsize; element++)
{
int result;
int result;
nval = PGTYPESnumeric_new();
if (!nval)
@ -890,7 +890,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
}
else
{
int result;
int result;
nval = PGTYPESnumeric_new();
if (!nval)
@ -1345,8 +1345,8 @@ ecpg_build_params(struct statement * stmt)
}
/*
* now tobeinserted points to an area that contains the next parameter;
* now find the position in the string where it belongs
* now tobeinserted points to an area that contains the next
* parameter; now find the position in the string where it belongs
*/
if ((position = next_insert(stmt->command, position, stmt->questionmarks) + 1) == 0)
{
@ -1512,9 +1512,9 @@ ecpg_execute(struct statement * stmt)
*
* Parameters
* stmt statement structure holding the PGresult and
* the list of output variables
* the list of output variables
* clear_result
* PQclear() the result upon returning from this function
* PQclear() the result upon returning from this function
*
* Returns success as boolean. Also an SQL error is raised in case of failure.
*-------
@ -1930,14 +1930,14 @@ ecpg_do_prologue(int lineno, const int compat, const int force_indicator,
var->arrsize = va_arg(args, long);
var->offset = va_arg(args, long);
/*
* Unknown array size means pointer to an array.
* Unknown varcharsize usually also means pointer. But if the
* type is character and the array size is known, it is an
* array of pointers to char, so use var->pointer as it is.
/*
* Unknown array size means pointer to an array. Unknown
* varcharsize usually also means pointer. But if the type is
* character and the array size is known, it is an array of
* pointers to char, so use var->pointer as it is.
*/
if (var->arrsize == 0 ||
(var->varcharsize == 0 && ((var->type != ECPGt_char && var->type != ECPGt_unsigned_char) || (var->arrsize <= 1))))
(var->varcharsize == 0 && ((var->type != ECPGt_char && var->type != ECPGt_unsigned_char) || (var->arrsize <= 1))))
var->value = *((char **) (var->pointer));
else
var->value = var->pointer;

View File

@ -61,7 +61,7 @@ struct statement
struct variable *inlist;
struct variable *outlist;
char *oldlocale;
int nparams;
int nparams;
char **paramvalues;
PGresult *results;
};
@ -168,17 +168,17 @@ struct prepared_statement *ecpg_find_prepared_statement(const char *,
bool ecpg_store_result(const PGresult *results, int act_field,
const struct statement * stmt, struct variable * var);
bool ecpg_store_input(const int, const bool, const struct variable *, char **, bool);
void ecpg_free_params(struct statement *stmt, bool print);
bool ecpg_do_prologue(int, const int, const int, const char *, const bool,
enum ECPG_statement_type, const char *, va_list,
struct statement **);
void ecpg_free_params(struct statement * stmt, bool print);
bool ecpg_do_prologue(int, const int, const int, const char *, const bool,
enum ECPG_statement_type, const char *, va_list,
struct statement **);
bool ecpg_build_params(struct statement *);
bool ecpg_autostart_transaction(struct statement * stmt);
bool ecpg_execute(struct statement * stmt);
bool ecpg_process_output(struct statement *, bool);
void ecpg_do_epilogue(struct statement *);
bool ecpg_do(const int, const int, const int, const char *, const bool,
const int, const char *, va_list);
bool ecpg_do(const int, const int, const int, const char *, const bool,
const int, const char *, va_list);
bool ecpg_check_PQresult(PGresult *, int, PGconn *, enum COMPAT_MODE);
void ecpg_raise(int line, int code, const char *sqlstate, const char *str);

View File

@ -40,7 +40,7 @@ struct sqlca_t
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred

View File

@ -255,7 +255,7 @@ do { \
* DAYS_PER_MONTH is very imprecise. The more accurate value is
* 365.2425/12 = 30.436875, or '30 days 10:29:06'. Right now we only
* return an integral number of days, but someday perhaps we should
* also return a 'time' value to be used as well. ISO 8601 suggests
* also return a 'time' value to be used as well. ISO 8601 suggests
* 30 days.
*/
#define DAYS_PER_MONTH 30 /* assumes exactly 30 days per month */
@ -353,7 +353,7 @@ void GetCurrentDateTime(struct tm *);
int date2j(int, int, int);
void TrimTrailingZeros(char *);
void dt2time(double, int *, int *, int *, fsec_t *);
int PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp * d,
int PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp * d,
int *year, int *month, int *day,
int *hour, int *minute, int *second,
int *tz);

View File

@ -1178,11 +1178,11 @@ DecodeNumberField(int len, char *str, int fmask,
/*
* OK, we have at most six digits to care about. Let's construct a
* string with those digits, zero-padded on the right, and then do
* the conversion to an integer.
* string with those digits, zero-padded on the right, and then do the
* conversion to an integer.
*
* XXX This truncates the seventh digit, unlike rounding it as do
* the backend and the !HAVE_INT64_TIMESTAMP case.
* XXX This truncates the seventh digit, unlike rounding it as do the
* backend and the !HAVE_INT64_TIMESTAMP case.
*/
for (i = 0; i < 6; i++)
fstr[i] = *cp != '\0' ? *cp++ : '0';

View File

@ -160,7 +160,7 @@ DecodeISO8601Interval(char *str,
return dterr;
/*
* Note: we could step off the end of the string here. Code below
* Note: we could step off the end of the string here. Code below
* *must* exit the loop if unit == '\0'.
*/
unit = *str++;
@ -1036,8 +1036,8 @@ recalc:
static int
tm2interval(struct tm * tm, fsec_t fsec, interval * span)
{
if ((double)tm->tm_year * MONTHS_PER_YEAR + tm->tm_mon > INT_MAX ||
(double)tm->tm_year * MONTHS_PER_YEAR + tm->tm_mon < INT_MIN)
if ((double) tm->tm_year * MONTHS_PER_YEAR + tm->tm_mon > INT_MAX ||
(double) tm->tm_year * MONTHS_PER_YEAR + tm->tm_mon < INT_MIN)
return -1;
span->month = tm->tm_year * MONTHS_PER_YEAR + tm->tm_mon;
#ifdef HAVE_INT64_TIMESTAMP

View File

@ -974,7 +974,7 @@ PGTYPESnumeric_sub(numeric *var1, numeric *var2, numeric *result)
* mul_var() -
*
* Multiplication on variable level. Product of var1 * var2 is stored
* in result. Accuracy of result is determined by global_rscale.
* in result. Accuracy of result is determined by global_rscale.
* ----------
*/
int

View File

@ -57,7 +57,7 @@ static const ScanKeyword ScanCKeywords[] = {
/*
* Do a binary search using plain strcmp() comparison. This is much like
* Do a binary search using plain strcmp() comparison. This is much like
* ScanKeywordLookup(), except we want case-sensitive matching.
*/
const ScanKeyword *

View File

@ -73,8 +73,8 @@ extern int base_yylex(void);
extern void base_yyerror(const char *);
extern void *mm_alloc(size_t), *mm_realloc(void *, size_t);
extern char *mm_strdup(const char *);
extern void mmerror(int errorcode, enum errortype type, const char *error, ...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4)));
extern void mmfatal(int errorcode, const char *error, ...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3),noreturn));
extern void mmerror(int errorcode, enum errortype type, const char *error,...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4)));
extern void mmfatal(int errorcode, const char *error,...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3), noreturn));
extern void output_get_descr_header(char *);
extern void output_get_descr(char *, char *);
extern void output_set_descr_header(char *);

View File

@ -96,7 +96,7 @@ hashline_number(void)
)
{
/* "* 2" here is for escaping '\' and '"' below */
char *line = mm_alloc(strlen("\n#line %d \"%s\"\n") + sizeof(int) * CHAR_BIT * 10 / 3 + strlen(input_filename) * 2);
char *line = mm_alloc(strlen("\n#line %d \"%s\"\n") + sizeof(int) * CHAR_BIT * 10 / 3 + strlen(input_filename) *2);
char *src,
*dest;

View File

@ -42,13 +42,13 @@ my %replace_token = (
# or in the block
my %replace_string = (
'WITH_TIME' => 'with time',
'WITH_TIME' => 'with time',
'WITH_ORDINALITY' => 'with ordinality',
'NULLS_FIRST' => 'nulls first',
'NULLS_LAST' => 'nulls last',
'TYPECAST' => '::',
'DOT_DOT' => '..',
'COLON_EQUALS' => ':=',);
'NULLS_FIRST' => 'nulls first',
'NULLS_LAST' => 'nulls last',
'TYPECAST' => '::',
'DOT_DOT' => '..',
'COLON_EQUALS' => ':=',);
# specific replace_types for specific non-terminals - never include the ':'
# ECPG-only replace_types are defined in ecpg-replace_types

View File

@ -35,7 +35,7 @@ static YYLTYPE lookahead_yylloc; /* yylloc for lookahead token */
* Intermediate filter between parser and base lexer (base_yylex in scan.l).
*
* The filter is needed because in some cases the standard SQL grammar
* requires more than one token lookahead. We reduce these cases to one-token
* requires more than one token lookahead. We reduce these cases to one-token
* lookahead by combining tokens here, in order to keep the grammar LALR(1).
*
* Using a filter is simpler than trying to recognize multiword tokens

View File

@ -310,7 +310,8 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int bra
{
if (ind_type->type == ECPGt_NO_INDICATOR)
{
char *str_neg_one = mm_strdup("-1");
char *str_neg_one = mm_strdup("-1");
ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, str_neg_one, NULL, ind_prefix, 0);
free(str_neg_one);
}
@ -324,7 +325,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int bra
break;
case ECPGt_struct:
{
char *str_one = mm_strdup("1");
char *str_one = mm_strdup("1");
if (indicator_set && ind_type->type != ECPGt_struct)
mmfatal(INDICATOR_NOT_STRUCT, "indicator for struct has to be a struct");
@ -338,10 +339,13 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int bra
break;
case ECPGt_char_variable:
{
/* Allocate for each, as there are code-paths where the values get stomped on. */
char *str_varchar_one = mm_strdup("1");
char *str_arr_one = mm_strdup("1");
char *str_neg_one = mm_strdup("-1");
/*
* Allocate for each, as there are code-paths where the values
* get stomped on.
*/
char *str_varchar_one = mm_strdup("1");
char *str_arr_one = mm_strdup("1");
char *str_neg_one = mm_strdup("-1");
if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array))
mmfatal(INDICATOR_NOT_SIMPLE, "indicator for simple data type has to be simple");
@ -357,9 +361,12 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int bra
break;
case ECPGt_descriptor:
{
/* Allocate for each, as there are code-paths where the values get stomped on. */
char *str_neg_one = mm_strdup("-1");
char *ind_type_neg_one = mm_strdup("-1");
/*
* Allocate for each, as there are code-paths where the values
* get stomped on.
*/
char *str_neg_one = mm_strdup("-1");
char *ind_type_neg_one = mm_strdup("-1");
if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array))
mmfatal(INDICATOR_NOT_SIMPLE, "indicator for simple data type has to be simple");
@ -374,9 +381,12 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int bra
break;
default:
{
/* Allocate for each, as there are code-paths where the values get stomped on. */
char *str_neg_one = mm_strdup("-1");
char *ind_type_neg_one = mm_strdup("-1");
/*
* Allocate for each, as there are code-paths where the values
* get stomped on.
*/
char *str_neg_one = mm_strdup("-1");
char *ind_type_neg_one = mm_strdup("-1");
if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array))
mmfatal(INDICATOR_NOT_SIMPLE, "indicator for simple data type has to be simple");
@ -448,35 +458,36 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type,
case ECPGt_unsigned_char:
case ECPGt_char_variable:
case ECPGt_string:
{
char *sizeof_name = "char";
/*
* we have to use the pointer except for arrays with given
* bounds, ecpglib will distinguish between * and []
*/
if ((atoi(varcharsize) > 1 ||
(atoi(arrsize) > 0) ||
(atoi(varcharsize) == 0 && strcmp(varcharsize, "0") != 0) ||
(atoi(arrsize) == 0 && strcmp(arrsize, "0") != 0))
&& siz == NULL)
{
sprintf(variable, "(%s%s)", prefix ? prefix : "", name);
if ((type == ECPGt_char || type == ECPGt_unsigned_char) &&
strcmp(varcharsize, "0") == 0)
{
/*
* If this is an array of char *, the offset would be
* sizeof(char *) and not sizeof(char).
*/
sizeof_name = "char *";
}
}
else
sprintf(variable, "&(%s%s)", prefix ? prefix : "", name);
char *sizeof_name = "char";
sprintf(offset, "(%s)*sizeof(%s)", strcmp(varcharsize, "0") == 0 ? "1" : varcharsize, sizeof_name);
break;
}
/*
* we have to use the pointer except for arrays with given
* bounds, ecpglib will distinguish between * and []
*/
if ((atoi(varcharsize) > 1 ||
(atoi(arrsize) > 0) ||
(atoi(varcharsize) == 0 && strcmp(varcharsize, "0") != 0) ||
(atoi(arrsize) == 0 && strcmp(arrsize, "0") != 0))
&& siz == NULL)
{
sprintf(variable, "(%s%s)", prefix ? prefix : "", name);
if ((type == ECPGt_char || type == ECPGt_unsigned_char) &&
strcmp(varcharsize, "0") == 0)
{
/*
* If this is an array of char *, the offset would
* be sizeof(char *) and not sizeof(char).
*/
sizeof_name = "char *";
}
}
else
sprintf(variable, "&(%s%s)", prefix ? prefix : "", name);
sprintf(offset, "(%s)*sizeof(%s)", strcmp(varcharsize, "0") == 0 ? "1" : varcharsize, sizeof_name);
break;
}
case ECPGt_numeric:
/*
@ -542,8 +553,8 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type,
strcpy(arrsize, "1");
/*
* If siz i.e. the size of structure of which this variable is part of,
* that gives the offset to the next element, if required
* If siz i.e. the size of structure of which this variable is part
* of, that gives the offset to the next element, if required
*/
if (siz == NULL || strlen(siz) == 0)
fprintf(o, "\n\t%s,%s,(long)%s,(long)%s,%s, ", get_type(type), variable, varcharsize, arrsize, offset);

View File

@ -437,7 +437,8 @@ remove_variable_from_list(struct arguments ** list, struct variable * var)
void
dump_variables(struct arguments * list, int mode)
{
char *str_zero = mm_strdup("0");
char *str_zero = mm_strdup("0");
if (list == NULL)
return;
@ -529,7 +530,7 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
if (pointer_len > 2)
mmfatal(PARSE_ERROR, ngettext("multilevel pointers (more than 2 levels) are not supported; found %d level",
"multilevel pointers (more than 2 levels) are not supported; found %d levels", pointer_len),
"multilevel pointers (more than 2 levels) are not supported; found %d levels", pointer_len),
pointer_len);
if (pointer_len > 1 && type_enum != ECPGt_char && type_enum != ECPGt_unsigned_char && type_enum != ECPGt_string)

View File

@ -57,7 +57,7 @@ struct sqlca_t
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred

View File

@ -51,7 +51,7 @@ struct sqlca_t
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred

View File

@ -59,7 +59,7 @@ struct sqlca_t
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred

View File

@ -51,7 +51,7 @@ struct sqlca_t
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred

View File

@ -53,7 +53,7 @@ struct sqlca_t
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred

View File

@ -51,7 +51,7 @@ struct sqlca_t
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred

View File

@ -52,7 +52,7 @@ struct sqlca_t
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred

View File

@ -52,7 +52,7 @@ struct sqlca_t
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred

View File

@ -105,7 +105,7 @@ struct sqlca_t
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred

View File

@ -53,7 +53,7 @@ struct sqlca_t
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred

View File

@ -74,7 +74,7 @@ struct sqlca_t
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred

View File

@ -65,7 +65,7 @@ struct sqlca_t
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred

View File

@ -74,7 +74,7 @@ struct sqlca_t
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred

View File

@ -78,9 +78,9 @@ ecpg_filter(const char *sourcefile, const char *outfile)
static PID_TYPE
ecpg_start_test(const char *testname,
_stringlist ** resultfiles,
_stringlist ** expectfiles,
_stringlist ** tags)
_stringlist **resultfiles,
_stringlist **expectfiles,
_stringlist **tags)
{
PID_TYPE pid;
char inprg[MAXPGPATH];

View File

@ -742,9 +742,9 @@ pg_fe_getauthname(void)
pglock_thread();
/*
* We document PQconndefaults() to return NULL for a memory allocation
* failure. We don't have an API to return a user name lookup failure,
* so we just assume it always succeeds.
* We document PQconndefaults() to return NULL for a memory allocation
* failure. We don't have an API to return a user name lookup failure, so
* we just assume it always succeeds.
*/
#ifdef WIN32
if (GetUserName(username, &namesize))
@ -767,7 +767,7 @@ pg_fe_getauthname(void)
*
* This is intended to be used by client applications that wish to send
* commands like ALTER USER joe PASSWORD 'pwd'. The password need not
* be sent in cleartext if it is encrypted on the client side. This is
* be sent in cleartext if it is encrypted on the client side. This is
* good because it ensures the cleartext password won't end up in logs,
* pg_stat displays, etc. We export the function so that clients won't
* be dependent on low-level details like whether the enceyption is MD5

View File

@ -134,7 +134,7 @@ static int ldapServiceLookup(const char *purl, PQconninfoOption *options,
*
* PQconninfoOptions[] is a constant static array that we use to initialize
* a dynamically allocated working copy. All the "val" fields in
* PQconninfoOptions[] *must* be NULL. In a working copy, non-null "val"
* PQconninfoOptions[] *must* be NULL. In a working copy, non-null "val"
* fields point to malloc'd strings that should be freed when the working
* array is freed (see PQconninfoFree).
*
@ -389,7 +389,7 @@ pgthreadlock_t pg_g_threadlock = default_threadlock;
* pqDropConnection
*
* Close any physical connection to the server, and reset associated
* state inside the connection object. We don't release state that
* state inside the connection object. We don't release state that
* would be needed to reconnect, though.
*/
void
@ -544,7 +544,7 @@ PQping(const char *conninfo)
* See comment for PQconnectdbParams for the definition of the string format.
*
* Returns a PGconn*. If NULL is returned, a malloc error has occurred, and
* you should not attempt to proceed with this connection. If the status
* you should not attempt to proceed with this connection. If the status
* field of the connection returned is CONNECTION_BAD, an error has
* occurred. In this case you should call PQfinish on the result, (perhaps
* inspecting the error message first). Other fields of the structure may not
@ -619,7 +619,7 @@ PQconnectStartParams(const char *const * keywords,
* See comment for PQconnectdb for the definition of the string format.
*
* Returns a PGconn*. If NULL is returned, a malloc error has occurred, and
* you should not attempt to proceed with this connection. If the status
* you should not attempt to proceed with this connection. If the status
* field of the connection returned is CONNECTION_BAD, an error has
* occurred. In this case you should call PQfinish on the result, (perhaps
* inspecting the error message first). Other fields of the structure may not
@ -856,7 +856,7 @@ connectOptions2(PGconn *conn)
* and their current default values.
*
* NOTE: as of PostgreSQL 7.0, the returned array is dynamically allocated
* and should be freed when no longer needed via PQconninfoFree(). (In prior
* and should be freed when no longer needed via PQconninfoFree(). (In prior
* versions, the returned array was static, but that's not thread-safe.)
* Pre-7.0 applications that use this function will see a small memory leak
* until they are updated to call PQconninfoFree.
@ -1480,7 +1480,7 @@ connectDBComplete(PGconn *conn)
for (;;)
{
/*
* Wait, if necessary. Note that the initial state (just after
* Wait, if necessary. Note that the initial state (just after
* PQconnectStart) is to wait for the socket to select for writing.
*/
switch (flag)
@ -1542,7 +1542,7 @@ connectDBComplete(PGconn *conn)
* will not block.
* o If you do not supply an IP address for the remote host (i.e. you
* supply a host name instead) then PQconnectStart will block on
* gethostbyname. You will be fine if using Unix sockets (i.e. by
* gethostbyname. You will be fine if using Unix sockets (i.e. by
* supplying neither a host name nor a host address).
* o If your backend wants to use Kerberos authentication then you must
* supply both a host name and a host address, otherwise this function
@ -1606,7 +1606,7 @@ PQconnectPoll(PGconn *conn)
libpq_gettext(
"invalid connection state, "
"probably indicative of memory corruption\n"
));
));
goto error_return;
}
@ -1809,7 +1809,7 @@ keep_going: /* We will come back to here until there is
/*
* This connection failed --- set up error report, then
* close socket (do it this way in case close() affects
* the value of errno...). We will ignore the connect()
* the value of errno...). We will ignore the connect()
* failure and keep going if there are more addresses.
*/
connectFailureMessage(conn, SOCK_ERRNO);
@ -2097,7 +2097,7 @@ keep_going: /* We will come back to here until there is
{
/*
* Server failure of some sort, such as failure to
* fork a backend process. We need to process and
* fork a backend process. We need to process and
* report the error message, which might be formatted
* according to either protocol 2 or protocol 3.
* Rather than duplicate the code for that, we flip
@ -2478,7 +2478,7 @@ keep_going: /* We will come back to here until there is
/*
* If we tried to send application_name, check to see
* if the error is about that --- pre-9.0 servers will
* reject it at this stage of the process. If so,
* reject it at this stage of the process. If so,
* close the connection and retry without sending
* application_name. We could possibly get a false
* SQLSTATE match here and retry uselessly, but there
@ -2624,9 +2624,9 @@ internal_ping(PGconn *conn)
/*
* If we failed to get any ERROR response from the postmaster, report
* PQPING_NO_RESPONSE. This result could be somewhat misleading for a
* PQPING_NO_RESPONSE. This result could be somewhat misleading for a
* pre-7.4 server, since it won't send back a SQLSTATE, but those are long
* out of support. Another corner case where the server could return a
* out of support. Another corner case where the server could return a
* failure without a SQLSTATE is fork failure, but NO_RESPONSE isn't
* totally unreasonable for that anyway. We expect that every other
* failure case in a modern server will produce a report with a SQLSTATE.
@ -2666,6 +2666,7 @@ makeEmptyPGconn(void)
PGconn *conn;
#ifdef WIN32
/*
* Make sure socket support is up and running.
*/
@ -2853,7 +2854,7 @@ freePGconn(PGconn *conn)
* - properly close a connection to the backend
*
* This should reset or release all transient state, but NOT the connection
* parameters. On exit, the PGconn should be in condition to start a fresh
* parameters. On exit, the PGconn should be in condition to start a fresh
* connection with the same parameters (see PQreset()).
*/
static void
@ -2982,7 +2983,7 @@ PQreset(PGconn *conn)
if (connectDBStart(conn) && connectDBComplete(conn))
{
/*
* Notify event procs of successful reset. We treat an event proc
* Notify event procs of successful reset. We treat an event proc
* failure as disabling the connection ... good idea?
*/
int i;
@ -3042,7 +3043,7 @@ PQresetPoll(PGconn *conn)
if (status == PGRES_POLLING_OK)
{
/*
* Notify event procs of successful reset. We treat an event proc
* Notify event procs of successful reset. We treat an event proc
* failure as disabling the connection ... good idea?
*/
int i;
@ -3231,7 +3232,7 @@ cancel_errReturn:
* Returns TRUE if able to send the cancel request, FALSE if not.
*
* On failure, an error message is stored in *errbuf, which must be of size
* errbufsize (recommended size is 256 bytes). *errbuf is not changed on
* errbufsize (recommended size is 256 bytes). *errbuf is not changed on
* success return.
*/
int
@ -3516,12 +3517,12 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options,
*
* LDAP does not require that an anonymous bind is performed explicitly,
* but we want to distinguish between the case where LDAP bind does not
* succeed within PGLDAP_TIMEOUT seconds (return 2 to continue parsing
* the service control file) and the case where querying the LDAP server
* fails (return 1 to end parsing).
* succeed within PGLDAP_TIMEOUT seconds (return 2 to continue parsing the
* service control file) and the case where querying the LDAP server fails
* (return 1 to end parsing).
*
* Unfortunately there is no way of setting a timeout that works for
* both Windows and OpenLDAP.
* Unfortunately there is no way of setting a timeout that works for both
* Windows and OpenLDAP.
*/
#ifdef WIN32
/* the nonstandard ldap_connect function performs an anonymous bind */
@ -3532,7 +3533,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options,
ldap_unbind(ld);
return 2;
}
#else /* !WIN32 */
#else /* !WIN32 */
/* in OpenLDAP, use the LDAP_OPT_NETWORK_TIMEOUT option */
if (ldap_set_option(ld, LDAP_OPT_NETWORK_TIMEOUT, &time) != LDAP_SUCCESS)
{
@ -3572,7 +3573,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options,
ldap_unbind(ld);
return 3;
}
#endif /* WIN32 */
#endif /* WIN32 */
/* search */
res = NULL;
@ -3788,7 +3789,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options,
return 0;
}
#endif /* USE_LDAP */
#endif /* USE_LDAP */
#define MAXBUFSIZE 256
@ -4008,7 +4009,7 @@ parseServiceFile(const char *serviceFile,
* PQconninfoParse
*
* Parse a string like PQconnectdb() would do and return the
* resulting connection options array. NULL is returned on failure.
* resulting connection options array. NULL is returned on failure.
* The result contains only options specified directly in the string,
* not any possible default values.
*
@ -4461,8 +4462,8 @@ conninfo_add_defaults(PQconninfoOption *options, PQExpBuffer errorMessage)
/*
* If there's a service spec, use it to obtain any not-explicitly-given
* parameters. Ignore error if no error message buffer is passed
* because there is no way to pass back the failure message.
* parameters. Ignore error if no error message buffer is passed because
* there is no way to pass back the failure message.
*/
if (parseServiceInfo(options, errorMessage) != 0 && errorMessage)
return false;
@ -4792,7 +4793,7 @@ cleanup:
* Connection URI parameters parser routine
*
* If successful, returns true while connOptions is filled with parsed
* parameters. Otherwise, returns false and fills errorMessage appropriately.
* parameters. Otherwise, returns false and fills errorMessage appropriately.
*
* Destructively modifies 'params' buffer.
*/

View File

@ -94,7 +94,7 @@ static int check_field_number(const PGresult *res, int field_num);
* doesn't tell us up front how many tuples will be returned.)
* All other subsidiary storage for a PGresult is kept in PGresult_data blocks
* of size PGRESULT_DATA_BLOCKSIZE. The overhead at the start of each block
* is just a link to the next one, if any. Free-space management info is
* is just a link to the next one, if any. Free-space management info is
* kept in the owning PGresult.
* A query returning a small amount of data will thus require three malloc
* calls: one for the PGresult, one for the tuples pointer array, and one
@ -113,7 +113,7 @@ static int check_field_number(const PGresult *res, int field_num);
* blocks, instead of being crammed into a regular allocation block.
* Requirements for correct function are:
* PGRESULT_ALIGN_BOUNDARY must be a multiple of the alignment requirements
* of all machine data types. (Currently this is set from configure
* of all machine data types. (Currently this is set from configure
* tests, so it should be OK automatically.)
* PGRESULT_SEP_ALLOC_THRESHOLD + PGRESULT_BLOCK_OVERHEAD <=
* PGRESULT_DATA_BLOCKSIZE
@ -268,10 +268,10 @@ PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs)
* Returns a deep copy of the provided 'src' PGresult, which cannot be NULL.
* The 'flags' argument controls which portions of the result will or will
* NOT be copied. The created result is always put into the
* PGRES_TUPLES_OK status. The source result error message is not copied,
* PGRES_TUPLES_OK status. The source result error message is not copied,
* although cmdStatus is.
*
* To set custom attributes, use PQsetResultAttrs. That function requires
* To set custom attributes, use PQsetResultAttrs. That function requires
* that there are no attrs contained in the result, so to use that
* function you cannot use the PG_COPYRES_ATTRS or PG_COPYRES_TUPLES
* options with this function.
@ -299,7 +299,7 @@ PQcopyResult(const PGresult *src, int flags)
if (!dest)
return NULL;
/* Always copy these over. Is cmdStatus really useful here? */
/* Always copy these over. Is cmdStatus really useful here? */
dest->client_encoding = src->client_encoding;
strcpy(dest->cmdStatus, src->cmdStatus);
@ -757,7 +757,7 @@ pqPrepareAsyncResult(PGconn *conn)
PGresult *res;
/*
* conn->result is the PGresult to return. If it is NULL (which probably
* conn->result is the PGresult to return. If it is NULL (which probably
* shouldn't happen) we assume there is an appropriate error message in
* conn->errorMessage.
*/
@ -778,7 +778,7 @@ pqPrepareAsyncResult(PGconn *conn)
/*
* Replace conn->result with next_result, if any. In the normal case
* there isn't a next result and we're just dropping ownership of the
* current result. In single-row mode this restores the situation to what
* current result. In single-row mode this restores the situation to what
* it was before we created the current single-row result.
*/
conn->result = conn->next_result;
@ -1569,7 +1569,7 @@ pqHandleSendFailure(PGconn *conn)
/* loop until no more data readable */ ;
/*
* Parse any available input messages. Since we are in PGASYNC_IDLE
* Parse any available input messages. Since we are in PGASYNC_IDLE
* state, only NOTICE and NOTIFY messages will be eaten.
*/
parseInput(conn);
@ -1789,7 +1789,7 @@ getCopyResult(PGconn *conn, ExecStatusType copytype)
* If the server connection has been lost, don't pretend everything is
* hunky-dory; instead return a PGRES_FATAL_ERROR result, and reset the
* asyncStatus to idle (corresponding to what we'd do if we'd detected I/O
* error in the earlier steps in PQgetResult). The text returned in the
* error in the earlier steps in PQgetResult). The text returned in the
* result is whatever is in conn->errorMessage; we hope that was filled
* with something relevant when the lost connection was detected.
*/
@ -2031,7 +2031,7 @@ PQexecFinish(PGconn *conn)
* If the query was not even sent, return NULL; conn->errorMessage is set to
* a relevant message.
* If the query was sent, a new PGresult is returned (which could indicate
* either success or failure). On success, the PGresult contains status
* either success or failure). On success, the PGresult contains status
* PGRES_COMMAND_OK, and its parameter and column-heading fields describe
* the statement's inputs and outputs respectively.
* The user is responsible for freeing the PGresult via PQclear()
@ -2374,7 +2374,7 @@ PQgetCopyData(PGconn *conn, char **buffer, int async)
* PQgetline - gets a newline-terminated string from the backend.
*
* Chiefly here so that applications can use "COPY <rel> to stdout"
* and read the output string. Returns a null-terminated string in s.
* and read the output string. Returns a null-terminated string in s.
*
* XXX this routine is now deprecated, because it can't handle binary data.
* If called during a COPY BINARY we return EOF.
@ -2488,7 +2488,7 @@ PQputnbytes(PGconn *conn, const char *buffer, int nbytes)
* the application must call this routine to finish the command protocol.
*
* When using protocol 3.0 this is deprecated; it's cleaner to use PQgetResult
* to get the transfer status. Note however that when using 2.0 protocol,
* to get the transfer status. Note however that when using 2.0 protocol,
* recovering from a copy failure often requires a PQreset. PQendcopy will
* take care of that, PQgetResult won't.
*
@ -2716,7 +2716,7 @@ PQfname(const PGresult *res, int field_num)
* downcasing in the frontend might follow different locale rules than
* downcasing in the backend...
*
* Returns -1 if no match. In the present backend it is also possible
* Returns -1 if no match. In the present backend it is also possible
* to have multiple matches, in which case the first one is found.
*/
int
@ -3149,7 +3149,7 @@ PQfreemem(void *ptr)
*
* This function is here only for binary backward compatibility.
* New code should use PQfreemem(). A macro will automatically map
* calls to PQfreemem. It should be removed in the future. bjm 2003-03-24
* calls to PQfreemem. It should be removed in the future. bjm 2003-03-24
*/
#undef PQfreeNotify
@ -3344,7 +3344,7 @@ PQescapeInternal(PGconn *conn, const char *str, size_t len, bool as_ident)
/*
* If we are escaping a literal that contains backslashes, we use the
* escape string syntax so that the result is correct under either value
* of standard_conforming_strings. We also emit a leading space in this
* of standard_conforming_strings. We also emit a leading space in this
* case, to guard against the possibility that the result might be
* interpolated immediately following an identifier.
*/

View File

@ -899,7 +899,7 @@ lo_initialize(PGconn *conn)
MemSet((char *) lobjfuncs, 0, sizeof(PGlobjfuncs));
/*
* Execute the query to get all the functions at once. In 7.3 and later
* Execute the query to get all the functions at once. In 7.3 and later
* we need to be schema-safe. lo_create only exists in 8.1 and up.
* lo_truncate only exists in 8.3 and up.
*/

View File

@ -681,13 +681,13 @@ retry3:
/*
* Hack to deal with the fact that some kernels will only give us back
* 1 packet per recv() call, even if we asked for more and there is
* more available. If it looks like we are reading a long message,
* more available. If it looks like we are reading a long message,
* loop back to recv() again immediately, until we run out of data or
* buffer space. Without this, the block-and-restart behavior of
* libpq's higher levels leads to O(N^2) performance on long messages.
*
* Since we left-justified the data above, conn->inEnd gives the
* amount of data already read in the current message. We consider
* amount of data already read in the current message. We consider
* the message "long" once we have acquired 32k ...
*/
if (conn->inEnd > 32768 &&

View File

@ -231,7 +231,7 @@ pqSetenvPoll(PGconn *conn)
case SETENV_STATE_QUERY1_SEND:
{
/*
* Issue query to get information we need. Here we must
* Issue query to get information we need. Here we must
* use begin/commit in case autocommit is off by default
* in a 7.3 server.
*
@ -725,7 +725,7 @@ getRowDescriptions(PGconn *conn)
advance_and_error:
/*
* Discard the failed message. Unfortunately we don't know for sure where
* Discard the failed message. Unfortunately we don't know for sure where
* the end is, so just throw away everything in the input buffer. This is
* not very desirable but it's the best we can do in protocol v2.
*/
@ -898,7 +898,7 @@ getAnotherTuple(PGconn *conn, bool binary)
advance_and_error:
/*
* Discard the failed message. Unfortunately we don't know for sure where
* Discard the failed message. Unfortunately we don't know for sure where
* the end is, so just throw away everything in the input buffer. This is
* not very desirable but it's the best we can do in protocol v2.
*/
@ -954,7 +954,7 @@ pqGetErrorNotice2(PGconn *conn, bool isError)
/*
* Since the message might be pretty long, we create a temporary
* PQExpBuffer rather than using conn->workBuffer. workBuffer is intended
* PQExpBuffer rather than using conn->workBuffer. workBuffer is intended
* for stuff that is expected to be short.
*/
initPQExpBuffer(&workBuf);
@ -1048,10 +1048,10 @@ failure:
/*
* checkXactStatus - attempt to track transaction-block status of server
*
* This is called each time we receive a command-complete message. By
* This is called each time we receive a command-complete message. By
* watching for messages from BEGIN/COMMIT/ROLLBACK commands, we can do
* a passable job of tracking the server's xact status. BUT: this does
* not work at all on 7.3 servers with AUTOCOMMIT OFF. (Man, was that
* not work at all on 7.3 servers with AUTOCOMMIT OFF. (Man, was that
* feature ever a mistake.) Caveat user.
*
* The tags known here are all those used as far back as 7.0; is it worth

View File

@ -166,7 +166,7 @@ pqParseInput3(PGconn *conn)
* ERROR messages are displayed using the notice processor;
* ParameterStatus is handled normally; anything else is just
* dropped on the floor after displaying a suitable warning
* notice. (An ERROR is very possibly the backend telling us why
* notice. (An ERROR is very possibly the backend telling us why
* it is about to close the connection, so we don't want to just
* discard it...)
*/
@ -364,7 +364,7 @@ pqParseInput3(PGconn *conn)
case 'd': /* Copy Data */
/*
* If we see Copy Data, just silently drop it. This would
* If we see Copy Data, just silently drop it. This would
* only occur if application exits COPY OUT mode too
* early.
*/
@ -373,7 +373,7 @@ pqParseInput3(PGconn *conn)
case 'c': /* Copy Done */
/*
* If we see Copy Done, just silently drop it. This is
* If we see Copy Done, just silently drop it. This is
* the normal case during PQendcopy. We will keep
* swallowing data, expecting to see command-complete for
* the COPY command.
@ -603,7 +603,7 @@ advance_and_error:
pqSaveErrorResult(conn);
/*
* Return zero to allow input parsing to continue. Subsequent "D"
* Return zero to allow input parsing to continue. Subsequent "D"
* messages will be ignored until we get to end of data, since an error
* result is already set up.
*/
@ -785,7 +785,7 @@ set_error_result:
pqSaveErrorResult(conn);
/*
* Return zero to allow input parsing to continue. Subsequent "D"
* Return zero to allow input parsing to continue. Subsequent "D"
* messages will be ignored until we get to end of data, since an error
* result is already set up.
*/
@ -812,14 +812,14 @@ pqGetErrorNotice3(PGconn *conn, bool isError)
/*
* Since the fields might be pretty long, we create a temporary
* PQExpBuffer rather than using conn->workBuffer. workBuffer is intended
* for stuff that is expected to be short. We shouldn't use
* PQExpBuffer rather than using conn->workBuffer. workBuffer is intended
* for stuff that is expected to be short. We shouldn't use
* conn->errorMessage either, since this might be only a notice.
*/
initPQExpBuffer(&workBuf);
/*
* Make a PGresult to hold the accumulated fields. We temporarily lie
* Make a PGresult to hold the accumulated fields. We temporarily lie
* about the result status, so that PQmakeEmptyPGresult doesn't uselessly
* copy conn->errorMessage.
*/
@ -1031,7 +1031,7 @@ reportErrorPosition(PQExpBuffer msg, const char *query, int loc, int encoding)
/*
* Each character might occupy multiple physical bytes in the string, and
* in some Far Eastern character sets it might take more than one screen
* column as well. We compute the starting byte offset and starting
* column as well. We compute the starting byte offset and starting
* screen column of each logical character, and store these in qidx[] and
* scridx[] respectively.
*/
@ -1059,8 +1059,8 @@ reportErrorPosition(PQExpBuffer msg, const char *query, int loc, int encoding)
/*
* Within the scanning loop, cno is the current character's logical
* number, qoffset is its offset in wquery, and scroffset is its starting
* logical screen column (all indexed from 0). "loc" is the logical
* character number of the error location. We scan to determine loc_line
* logical screen column (all indexed from 0). "loc" is the logical
* character number of the error location. We scan to determine loc_line
* (the 1-based line number containing loc) and ibeg/iend (first character
* number and last+1 character number of the line containing loc). Note
* that qidx[] and scridx[] are filled only as far as iend.
@ -1511,7 +1511,7 @@ pqGetCopyData3(PGconn *conn, char **buffer, int async)
for (;;)
{
/*
* Collect the next input message. To make life simpler for async
* Collect the next input message. To make life simpler for async
* callers, we keep returning 0 until the next message is fully
* available, even if it is not Copy Data.
*/
@ -1718,7 +1718,7 @@ pqEndcopy3(PGconn *conn)
/*
* Non blocking connections may have to abort at this point. If everyone
* played the game there should be no problem, but in error scenarios the
* expected messages may not have arrived yet. (We are assuming that the
* expected messages may not have arrived yet. (We are assuming that the
* backend's packetizing will ensure that CommandComplete arrives along
* with the CopyDone; are there corner cases where that doesn't happen?)
*/

View File

@ -257,7 +257,7 @@ pqsecure_open_client(PGconn *conn)
if (conn->ssl == NULL)
{
#ifdef ENABLE_THREAD_SAFETY
int rc;
int rc;
#endif
/* We cannot use MSG_NOSIGNAL to block SIGPIPE when using SSL */
@ -267,7 +267,7 @@ pqsecure_open_client(PGconn *conn)
if ((rc = pthread_mutex_lock(&ssl_config_mutex)))
{
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("could not acquire mutex: %s\n"), strerror(rc));
libpq_gettext("could not acquire mutex: %s\n"), strerror(rc));
return PGRES_POLLING_FAILED;
}
#endif
@ -292,6 +292,7 @@ pqsecure_open_client(PGconn *conn)
#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_unlock(&ssl_config_mutex);
#endif
/*
* Load client certificate, private key, and trusted CA certs.
*/
@ -1049,7 +1050,7 @@ destroy_ssl_system(void)
* Initialize (potentially) per-connection SSL data, namely the
* client certificate, private key, and trusted CA certs.
*
* conn->ssl must already be created. It receives the connection's client
* conn->ssl must already be created. It receives the connection's client
* certificate and private key. Note however that certificates also get
* loaded into the SSL_context object, and are therefore accessible to all
* connections in this process. This should be OK as long as there aren't
@ -1129,12 +1130,12 @@ initialize_SSL(PGconn *conn)
* SSL_context struct.
*/
#ifdef ENABLE_THREAD_SAFETY
int rc;
int rc;
if ((rc = pthread_mutex_lock(&ssl_config_mutex)))
{
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("could not acquire mutex: %s\n"), strerror(rc));
libpq_gettext("could not acquire mutex: %s\n"), strerror(rc));
return -1;
}
#endif
@ -1349,12 +1350,12 @@ initialize_SSL(PGconn *conn)
X509_STORE *cvstore;
#ifdef ENABLE_THREAD_SAFETY
int rc;
int rc;
if ((rc = pthread_mutex_lock(&ssl_config_mutex)))
{
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("could not acquire mutex: %s\n"), strerror(rc));
libpq_gettext("could not acquire mutex: %s\n"), strerror(rc));
return -1;
}
#endif
@ -1414,7 +1415,7 @@ initialize_SSL(PGconn *conn)
{
/*
* stat() failed; assume root file doesn't exist. If sslmode is
* verify-ca or verify-full, this is an error. Otherwise, continue
* verify-ca or verify-full, this is an error. Otherwise, continue
* without performing any server cert verification.
*/
if (conn->sslmode[0] == 'v') /* "verify-ca" or "verify-full" */
@ -1547,7 +1548,7 @@ open_client_SSL(PGconn *conn)
static void
close_SSL(PGconn *conn)
{
bool destroy_needed = false;
bool destroy_needed = false;
if (conn->ssl)
{
@ -1586,9 +1587,9 @@ close_SSL(PGconn *conn)
/*
* This will remove our SSL locking hooks, if this is the last SSL
* connection, which means we must wait to call it until after all
* SSL calls have been made, otherwise we can end up with a race
* condition and possible deadlocks.
* connection, which means we must wait to call it until after all SSL
* calls have been made, otherwise we can end up with a race condition and
* possible deadlocks.
*
* See comments above destroy_ssl_system().
*/
@ -1663,7 +1664,7 @@ PQgetssl(PGconn *conn)
#if defined(ENABLE_THREAD_SAFETY) && !defined(WIN32)
/*
* Block SIGPIPE for this thread. This prevents send()/write() from exiting
* Block SIGPIPE for this thread. This prevents send()/write() from exiting
* the application.
*/
int
@ -1702,7 +1703,7 @@ pq_block_sigpipe(sigset_t *osigset, bool *sigpipe_pending)
* Discard any pending SIGPIPE and reset the signal mask.
*
* Note: we are effectively assuming here that the C library doesn't queue
* up multiple SIGPIPE events. If it did, then we'd accidentally leave
* up multiple SIGPIPE events. If it did, then we'd accidentally leave
* ours in the queue when an event was already pending and we got another.
* As long as it doesn't queue multiple events, we're OK because the caller
* can't tell the difference.
@ -1713,7 +1714,7 @@ pq_block_sigpipe(sigset_t *osigset, bool *sigpipe_pending)
* gotten one, pass got_epipe = TRUE.
*
* We do not want this to change errno, since if it did that could lose
* the error code from a preceding send(). We essentially assume that if
* the error code from a preceding send(). We essentially assume that if
* we were able to do pq_block_sigpipe(), this can't fail.
*/
void

View File

@ -55,9 +55,9 @@ typedef enum
* be used for user feedback or similar purposes.
*/
CONNECTION_STARTED, /* Waiting for connection to be made. */
CONNECTION_MADE, /* Connection OK; waiting to send. */
CONNECTION_MADE, /* Connection OK; waiting to send. */
CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the
* postmaster. */
* postmaster. */
CONNECTION_AUTH_OK, /* Received authentication; waiting for
* backend startup. */
CONNECTION_SETENV, /* Negotiating environment. */

View File

@ -365,7 +365,8 @@ struct pg_conn
/* Connection data */
/* See PQconnectPoll() for how we use 'int' and not 'pgsocket'. */
pgsocket sock; /* FD for socket, PGINVALID_SOCKET if unconnected */
pgsocket sock; /* FD for socket, PGINVALID_SOCKET if
* unconnected */
SockAddr laddr; /* Local address */
SockAddr raddr; /* Remote address */
ProtocolVersion pversion; /* FE/BE protocol version in use */

View File

@ -166,7 +166,7 @@ resetPQExpBuffer(PQExpBuffer str)
* Make sure there is enough space for 'needed' more bytes in the buffer
* ('needed' does not include the terminating null).
*
* Returns 1 if OK, 0 if failed to enlarge buffer. (In the latter case
* Returns 1 if OK, 0 if failed to enlarge buffer. (In the latter case
* the buffer is left in "broken" state.)
*/
int
@ -180,7 +180,7 @@ enlargePQExpBuffer(PQExpBuffer str, size_t needed)
/*
* Guard against ridiculous "needed" values, which can occur if we're fed
* bogus data. Without this, we can get an overflow or infinite loop in
* bogus data. Without this, we can get an overflow or infinite loop in
* the following.
*/
if (needed >= ((size_t) INT_MAX - str->len))
@ -207,7 +207,7 @@ enlargePQExpBuffer(PQExpBuffer str, size_t needed)
/*
* Clamp to INT_MAX in case we went past it. Note we are assuming here
* that INT_MAX <= UINT_MAX/2, else the above loop could overflow. We
* that INT_MAX <= UINT_MAX/2, else the above loop could overflow. We
* will still have newlen >= needed.
*/
if (newlen > (size_t) INT_MAX)
@ -228,7 +228,7 @@ enlargePQExpBuffer(PQExpBuffer str, size_t needed)
/*
* printfPQExpBuffer
* Format text data under the control of fmt (an sprintf-like format string)
* and insert it into str. More space is allocated to str if necessary.
* and insert it into str. More space is allocated to str if necessary.
* This is a convenience routine that does the same thing as
* resetPQExpBuffer() followed by appendPQExpBuffer().
*/
@ -319,7 +319,7 @@ appendPQExpBufferVA(PQExpBuffer str, const char *fmt, va_list args)
/*
* Note: some versions of vsnprintf return the number of chars
* actually stored, not the total space needed as C99 specifies. And
* at least one returns -1 on failure. Be conservative about
* at least one returns -1 on failure. Be conservative about
* believing whether the print worked.
*/
if (nprinted >= 0 && (size_t) nprinted < avail - 1)

View File

@ -37,7 +37,7 @@
* more space. We must always have maxlen > len.
*
* An exception occurs if we failed to allocate enough memory for the string
* buffer. In that case data points to a statically allocated empty string,
* buffer. In that case data points to a statically allocated empty string,
* and len = maxlen = 0.
*-------------------------
*/
@ -115,7 +115,7 @@ extern void initPQExpBuffer(PQExpBuffer str);
*
* NOTE: some routines build up a string using PQExpBuffer, and then
* release the PQExpBufferData but return the data string itself to their
* caller. At that point the data string looks like a plain malloc'd
* caller. At that point the data string looks like a plain malloc'd
* string.
*/
extern void destroyPQExpBuffer(PQExpBuffer str);
@ -134,7 +134,7 @@ extern void resetPQExpBuffer(PQExpBuffer str);
* Make sure there is enough space for 'needed' more bytes in the buffer
* ('needed' does not include the terminating null).
*
* Returns 1 if OK, 0 if failed to enlarge buffer. (In the latter case
* Returns 1 if OK, 0 if failed to enlarge buffer. (In the latter case
* the buffer is left in "broken" state.)
*/
extern int enlargePQExpBuffer(PQExpBuffer str, size_t needed);
@ -142,7 +142,7 @@ extern int enlargePQExpBuffer(PQExpBuffer str, size_t needed);
/*------------------------
* printfPQExpBuffer
* Format text data under the control of fmt (an sprintf-like format string)
* and insert it into str. More space is allocated to str if necessary.
* and insert it into str. More space is allocated to str if necessary.
* This is a convenience routine that does the same thing as
* resetPQExpBuffer() followed by appendPQExpBuffer().
*/

View File

@ -2,7 +2,7 @@
* uri-regress.c
* A test program for libpq URI format
*
* This is a helper for libpq conninfo regression testing. It takes a single
* This is a helper for libpq conninfo regression testing. It takes a single
* conninfo string as a parameter, parses it using PQconninfoParse, and then
* prints out the values from the parsed PQconninfoOption struct that differ
* from the defaults (obtained from PQconndefaults).