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

@ -2,4 +2,8 @@
* For the raison d'etre of this file, check the comment above the definition * For the raison d'etre of this file, check the comment above the definition
* of the PGAC_C_INLINE macro in config/c-compiler.m4. * of the PGAC_C_INLINE macro in config/c-compiler.m4.
*/ */
static inline int fun () { return 0; } static inline int
fun()
{
return 0;
}

View File

@ -116,7 +116,7 @@ _PG_init(void)
DefineCustomBoolVariable("auto_explain.log_triggers", DefineCustomBoolVariable("auto_explain.log_triggers",
"Include trigger statistics in plans.", "Include trigger statistics in plans.",
"This has no effect unless log_analyze is also set.", "This has no effect unless log_analyze is also set.",
&auto_explain_log_triggers, &auto_explain_log_triggers,
false, false,
PGC_SUSET, PGC_SUSET,

View File

@ -86,7 +86,7 @@ gbt_intv_dist(const void *a, const void *b)
/* /*
* INTERVALSIZE should be the actual size-on-disk of an Interval, as shown * INTERVALSIZE should be the actual size-on-disk of an Interval, as shown
* in pg_type. This might be less than sizeof(Interval) if the compiler * in pg_type. This might be less than sizeof(Interval) if the compiler
* insists on adding alignment padding at the end of the struct. * insists on adding alignment padding at the end of the struct.
*/ */
#define INTERVALSIZE 16 #define INTERVALSIZE 16

View File

@ -104,7 +104,7 @@ bool g_cube_internal_consistent(NDBOX *key, NDBOX *query, StrategyNumber strate
** Auxiliary funxtions ** Auxiliary funxtions
*/ */
static double distance_1D(double a1, double a2, double b1, double b2); static double distance_1D(double a1, double a2, double b1, double b2);
static bool cube_is_point_internal(NDBOX *cube); static bool cube_is_point_internal(NDBOX *cube);
/***************************************************************************** /*****************************************************************************
@ -538,7 +538,7 @@ g_cube_picksplit(PG_FUNCTION_ARGS)
rt_cube_size(datum_r, &size_r); rt_cube_size(datum_r, &size_r);
/* /*
* Now split up the regions between the two seeds. An important property * Now split up the regions between the two seeds. An important property
* of this split algorithm is that the split vector v has the indices of * of this split algorithm is that the split vector v has the indices of
* items to be split in order in its left and right vectors. We exploit * items to be split in order in its left and right vectors. We exploit
* this property by doing a merge in the code that actually splits the * this property by doing a merge in the code that actually splits the
@ -554,7 +554,7 @@ g_cube_picksplit(PG_FUNCTION_ARGS)
{ {
/* /*
* If we've already decided where to place this item, just put it on * If we've already decided where to place this item, just put it on
* the right list. Otherwise, we need to figure out which page needs * the right list. Otherwise, we need to figure out which page needs
* the least enlargement in order to store the item. * the least enlargement in order to store the item.
*/ */
@ -728,27 +728,27 @@ cube_union_v0(NDBOX *a, NDBOX *b)
SET_VARSIZE(result, size); SET_VARSIZE(result, size);
SET_DIM(result, dim); SET_DIM(result, dim);
/* First compute the union of the dimensions present in both args */ /* First compute the union of the dimensions present in both args */
for (i = 0; i < DIM(b); i++) for (i = 0; i < DIM(b); i++)
{ {
result->x[i] = Min( result->x[i] = Min(
Min(LL_COORD(a, i), UR_COORD(a, i)), Min(LL_COORD(a, i), UR_COORD(a, i)),
Min(LL_COORD(b, i), UR_COORD(b, i)) Min(LL_COORD(b, i), UR_COORD(b, i))
); );
result->x[i + DIM(a)] = Max( result->x[i + DIM(a)] = Max(
Max(LL_COORD(a, i), UR_COORD(a, i)), Max(LL_COORD(a, i), UR_COORD(a, i)),
Max(LL_COORD(b, i), UR_COORD(b, i)) Max(LL_COORD(b, i), UR_COORD(b, i))
); );
} }
/* continue on the higher dimensions only present in 'a' */ /* continue on the higher dimensions only present in 'a' */
for (; i < DIM(a); i++) for (; i < DIM(a); i++)
{ {
result->x[i] = Min(0, result->x[i] = Min(0,
Min(LL_COORD(a, i), UR_COORD(a, i)) Min(LL_COORD(a, i), UR_COORD(a, i))
); );
result->x[i + dim] = Max(0, result->x[i + dim] = Max(0,
Max(LL_COORD(a, i), UR_COORD(a, i)) Max(LL_COORD(a, i), UR_COORD(a, i))
); );
} }
/* /*
@ -795,6 +795,7 @@ cube_inter(PG_FUNCTION_ARGS)
if (DIM(a) < DIM(b)) if (DIM(a) < DIM(b))
{ {
NDBOX *tmp = b; NDBOX *tmp = b;
b = a; b = a;
a = tmp; a = tmp;
swapped = true; swapped = true;
@ -806,27 +807,27 @@ cube_inter(PG_FUNCTION_ARGS)
SET_VARSIZE(result, size); SET_VARSIZE(result, size);
SET_DIM(result, dim); SET_DIM(result, dim);
/* First compute intersection of the dimensions present in both args */ /* First compute intersection of the dimensions present in both args */
for (i = 0; i < DIM(b); i++) for (i = 0; i < DIM(b); i++)
{ {
result->x[i] = Max( result->x[i] = Max(
Min(LL_COORD(a, i), UR_COORD(a, i)), Min(LL_COORD(a, i), UR_COORD(a, i)),
Min(LL_COORD(b, i), UR_COORD(b, i)) Min(LL_COORD(b, i), UR_COORD(b, i))
); );
result->x[i + DIM(a)] = Min( result->x[i + DIM(a)] = Min(
Max(LL_COORD(a, i), UR_COORD(a, i)), Max(LL_COORD(a, i), UR_COORD(a, i)),
Max(LL_COORD(b, i), UR_COORD(b, i)) Max(LL_COORD(b, i), UR_COORD(b, i))
); );
} }
/* continue on the higher dimemsions only present in 'a' */ /* continue on the higher dimemsions only present in 'a' */
for (; i < DIM(a); i++) for (; i < DIM(a); i++)
{ {
result->x[i] = Max(0, result->x[i] = Max(0,
Min(LL_COORD(a, i), UR_COORD(a, i)) Min(LL_COORD(a, i), UR_COORD(a, i))
); );
result->x[i + DIM(a)] = Min(0, result->x[i + DIM(a)] = Min(0,
Max(LL_COORD(a, i), UR_COORD(a, i)) Max(LL_COORD(a, i), UR_COORD(a, i))
); );
} }
/* /*
@ -1236,14 +1237,14 @@ cube_distance(PG_FUNCTION_ARGS)
/* compute within the dimensions of (b) */ /* compute within the dimensions of (b) */
for (i = 0; i < DIM(b); i++) for (i = 0; i < DIM(b); i++)
{ {
d = distance_1D(LL_COORD(a,i), UR_COORD(a,i), LL_COORD(b,i), UR_COORD(b,i)); d = distance_1D(LL_COORD(a, i), UR_COORD(a, i), LL_COORD(b, i), UR_COORD(b, i));
distance += d * d; distance += d * d;
} }
/* compute distance to zero for those dimensions in (a) absent in (b) */ /* compute distance to zero for those dimensions in (a) absent in (b) */
for (i = DIM(b); i < DIM(a); i++) for (i = DIM(b); i < DIM(a); i++)
{ {
d = distance_1D(LL_COORD(a,i), UR_COORD(a,i), 0.0, 0.0); d = distance_1D(LL_COORD(a, i), UR_COORD(a, i), 0.0, 0.0);
distance += d * d; distance += d * d;
} }
@ -1297,11 +1298,11 @@ cube_is_point_internal(NDBOX *cube)
return true; return true;
/* /*
* Even if the point-flag is not set, all the lower-left coordinates * Even if the point-flag is not set, all the lower-left coordinates might
* might match the upper-right coordinates, so that the value is in * match the upper-right coordinates, so that the value is in fact a
* fact a point. Such values don't arise with current code - the point * point. Such values don't arise with current code - the point flag is
* flag is always set if appropriate - but they might be present on-disk * always set if appropriate - but they might be present on-disk in
* in clusters upgraded from pre-9.4 versions. * clusters upgraded from pre-9.4 versions.
*/ */
for (i = 0; i < DIM(cube); i++) for (i = 0; i < DIM(cube); i++)
{ {
@ -1317,6 +1318,7 @@ cube_dim(PG_FUNCTION_ARGS)
{ {
NDBOX *c = PG_GETARG_NDBOX(0); NDBOX *c = PG_GETARG_NDBOX(0);
int dim = DIM(c); int dim = DIM(c);
PG_FREE_IF_COPY(c, 0); PG_FREE_IF_COPY(c, 0);
PG_RETURN_INT32(dim); PG_RETURN_INT32(dim);
} }
@ -1330,7 +1332,7 @@ cube_ll_coord(PG_FUNCTION_ARGS)
double result; double result;
if (DIM(c) >= n && n > 0) if (DIM(c) >= n && n > 0)
result = Min(LL_COORD(c, n-1), UR_COORD(c, n-1)); result = Min(LL_COORD(c, n - 1), UR_COORD(c, n - 1));
else else
result = 0; result = 0;
@ -1347,7 +1349,7 @@ cube_ur_coord(PG_FUNCTION_ARGS)
double result; double result;
if (DIM(c) >= n && n > 0) if (DIM(c) >= n && n > 0)
result = Max(LL_COORD(c, n-1), UR_COORD(c, n-1)); result = Max(LL_COORD(c, n - 1), UR_COORD(c, n - 1));
else else
result = 0; result = 0;
@ -1382,15 +1384,15 @@ cube_enlarge(PG_FUNCTION_ARGS)
for (i = 0, j = dim; i < DIM(a); i++, j++) for (i = 0, j = dim; i < DIM(a); i++, j++)
{ {
if (LL_COORD(a,i) >= UR_COORD(a,i)) if (LL_COORD(a, i) >= UR_COORD(a, i))
{ {
result->x[i] = UR_COORD(a,i) - r; result->x[i] = UR_COORD(a, i) - r;
result->x[j] = LL_COORD(a,i) + r; result->x[j] = LL_COORD(a, i) + r;
} }
else else
{ {
result->x[i] = LL_COORD(a,i) - r; result->x[i] = LL_COORD(a, i) - r;
result->x[j] = UR_COORD(a,i) + r; result->x[j] = UR_COORD(a, i) + r;
} }
if (result->x[i] > result->x[j]) if (result->x[i] > result->x[j])
{ {
@ -1503,7 +1505,7 @@ cube_c_f8(PG_FUNCTION_ARGS)
result->x[DIM(result) + i] = cube->x[DIM(cube) + i]; result->x[DIM(result) + i] = cube->x[DIM(cube) + i];
} }
result->x[DIM(result) - 1] = x; result->x[DIM(result) - 1] = x;
result->x[2*DIM(result) - 1] = x; result->x[2 * DIM(result) - 1] = x;
} }
PG_FREE_IF_COPY(cube, 0); PG_FREE_IF_COPY(cube, 0);
@ -1521,7 +1523,8 @@ cube_c_f8_f8(PG_FUNCTION_ARGS)
int size; int size;
int i; int i;
if (IS_POINT(cube) && (x1 == x2)){ if (IS_POINT(cube) && (x1 == x2))
{
size = POINT_SIZE((DIM(cube) + 1)); size = POINT_SIZE((DIM(cube) + 1));
result = (NDBOX *) palloc0(size); result = (NDBOX *) palloc0(size);
SET_VARSIZE(result, size); SET_VARSIZE(result, size);

View File

@ -13,9 +13,9 @@ typedef struct NDBOX
* *
* Following information is stored: * Following information is stored:
* *
* bits 0-7 : number of cube dimensions; * bits 0-7 : number of cube dimensions;
* bits 8-30 : unused, initialize to zero; * bits 8-30 : unused, initialize to zero;
* bit 31 : point flag. If set, the upper right coordinates are not * bit 31 : point flag. If set, the upper right coordinates are not
* stored, and are implicitly the same as the lower left * stored, and are implicitly the same as the lower left
* coordinates. * coordinates.
*---------- *----------
@ -31,12 +31,12 @@ typedef struct NDBOX
} NDBOX; } NDBOX;
#define POINT_BIT 0x80000000 #define POINT_BIT 0x80000000
#define DIM_MASK 0x7fffffff #define DIM_MASK 0x7fffffff
#define IS_POINT(cube) ( ((cube)->header & POINT_BIT) != 0 ) #define IS_POINT(cube) ( ((cube)->header & POINT_BIT) != 0 )
#define SET_POINT_BIT(cube) ( (cube)->header |= POINT_BIT ) #define SET_POINT_BIT(cube) ( (cube)->header |= POINT_BIT )
#define DIM(cube) ( (cube)->header & DIM_MASK ) #define DIM(cube) ( (cube)->header & DIM_MASK )
#define SET_DIM(cube, _dim) ( (cube)->header = ((cube)->header & ~DIM_MASK) | (_dim) ) #define SET_DIM(cube, _dim) ( (cube)->header = ((cube)->header & ~DIM_MASK) | (_dim) )
#define LL_COORD(cube, i) ( (cube)->x[i] ) #define LL_COORD(cube, i) ( (cube)->x[i] )
#define UR_COORD(cube, i) ( IS_POINT(cube) ? (cube)->x[i] : (cube)->x[(i) + DIM(cube)] ) #define UR_COORD(cube, i) ( IS_POINT(cube) ? (cube)->x[i] : (cube)->x[(i) + DIM(cube)] )

View File

@ -2394,7 +2394,7 @@ get_tuple_of_interest(Relation rel, int *pkattnums, int pknumatts, char **src_pk
* Build sql statement to look up tuple of interest, ie, the one matching * Build sql statement to look up tuple of interest, ie, the one matching
* src_pkattvals. We used to use "SELECT *" here, but it's simpler to * src_pkattvals. We used to use "SELECT *" here, but it's simpler to
* generate a result tuple that matches the table's physical structure, * generate a result tuple that matches the table's physical structure,
* with NULLs for any dropped columns. Otherwise we have to deal with two * with NULLs for any dropped columns. Otherwise we have to deal with two
* different tupdescs and everything's very confusing. * different tupdescs and everything's very confusing.
*/ */
appendStringInfoString(&buf, "SELECT "); appendStringInfoString(&buf, "SELECT ");
@ -2620,7 +2620,7 @@ dblink_security_check(PGconn *conn, remoteConn *rconn)
} }
/* /*
* For non-superusers, insist that the connstr specify a password. This * For non-superusers, insist that the connstr specify a password. This
* prevents a password from being picked up from .pgpass, a service file, * prevents a password from being picked up from .pgpass, a service file,
* the environment, etc. We don't want the postgres user's passwords * the environment, etc. We don't want the postgres user's passwords
* to be accessible to non-superusers. * to be accessible to non-superusers.

View File

@ -91,7 +91,7 @@ geo_distance_internal(Point *pt1, Point *pt2)
* distance between the points in miles on earth's surface * distance between the points in miles on earth's surface
* *
* If float8 is passed-by-value, the oldstyle version-0 calling convention * If float8 is passed-by-value, the oldstyle version-0 calling convention
* is unportable, so we use version-1. However, if it's passed-by-reference, * is unportable, so we use version-1. However, if it's passed-by-reference,
* continue to use oldstyle. This is just because we'd like earthdistance * continue to use oldstyle. This is just because we'd like earthdistance
* to serve as a canary for any unintentional breakage of version-0 functions * to serve as a canary for any unintentional breakage of version-0 functions
* with float8 results. * with float8 results.

View File

@ -70,6 +70,7 @@ static const struct FileFdwOption valid_options[] = {
{"encoding", ForeignTableRelationId}, {"encoding", ForeignTableRelationId},
{"force_not_null", AttributeRelationId}, {"force_not_null", AttributeRelationId},
{"force_null", AttributeRelationId}, {"force_null", AttributeRelationId},
/* /*
* force_quote is not supported by file_fdw because it's for COPY TO. * force_quote is not supported by file_fdw because it's for COPY TO.
*/ */
@ -253,6 +254,7 @@ file_fdw_validator(PG_FUNCTION_ARGS)
errmsg("conflicting or redundant options"))); errmsg("conflicting or redundant options")));
filename = defGetString(def); filename = defGetString(def);
} }
/* /*
* force_not_null is a boolean option; after validation we can discard * force_not_null is a boolean option; after validation we can discard
* it - it will be retrieved later in get_file_fdw_attribute_options() * it - it will be retrieved later in get_file_fdw_attribute_options()
@ -397,7 +399,7 @@ get_file_fdw_attribute_options(Oid relid)
List *fnncolumns = NIL; List *fnncolumns = NIL;
List *fncolumns = NIL; List *fncolumns = NIL;
List *options = NIL; List *options = NIL;
rel = heap_open(relid, AccessShareLock); rel = heap_open(relid, AccessShareLock);
tupleDesc = RelationGetDescr(rel); tupleDesc = RelationGetDescr(rel);
@ -443,12 +445,15 @@ get_file_fdw_attribute_options(Oid relid)
heap_close(rel, AccessShareLock); heap_close(rel, AccessShareLock);
/* Return DefElem only when some column(s) have force_not_null / force_null options set */ /*
* Return DefElem only when some column(s) have force_not_null /
* force_null options set
*/
if (fnncolumns != NIL) if (fnncolumns != NIL)
options = lappend(options, makeDefElem("force_not_null", (Node *) fnncolumns)); options = lappend(options, makeDefElem("force_not_null", (Node *) fnncolumns));
if (fncolumns != NIL) if (fncolumns != NIL)
options = lappend(options,makeDefElem("force_null", (Node *) fncolumns)); options = lappend(options, makeDefElem("force_null", (Node *) fncolumns));
return options; return options;
} }
@ -508,7 +513,7 @@ fileGetForeignPaths(PlannerInfo *root,
&startup_cost, &total_cost); &startup_cost, &total_cost);
/* /*
* Create a ForeignPath node and add it as only possible path. We use the * Create a ForeignPath node and add it as only possible path. We use the
* fdw_private list of the path to carry the convert_selectively option; * fdw_private list of the path to carry the convert_selectively option;
* it will be propagated into the fdw_private list of the Plan node. * it will be propagated into the fdw_private list of the Plan node.
*/ */
@ -921,7 +926,7 @@ estimate_size(PlannerInfo *root, RelOptInfo *baserel,
* planner's idea of the relation width; which is bogus if not all * planner's idea of the relation width; which is bogus if not all
* columns are being read, not to mention that the text representation * columns are being read, not to mention that the text representation
* of a row probably isn't the same size as its internal * of a row probably isn't the same size as its internal
* representation. Possibly we could do something better, but the * representation. Possibly we could do something better, but the
* real answer to anyone who complains is "ANALYZE" ... * real answer to anyone who complains is "ANALYZE" ...
*/ */
int tuple_width; int tuple_width;
@ -986,7 +991,7 @@ estimate_costs(PlannerInfo *root, RelOptInfo *baserel,
* which must have at least targrows entries. * which must have at least targrows entries.
* The actual number of rows selected is returned as the function result. * The actual number of rows selected is returned as the function result.
* We also count the total number of rows in the file and return it into * We also count the total number of rows in the file and return it into
* *totalrows. Note that *totaldeadrows is always set to 0. * *totalrows. Note that *totaldeadrows is always set to 0.
* *
* Note that the returned list of rows is not always in order by physical * Note that the returned list of rows is not always in order by physical
* position in the file. Therefore, correlation estimates derived later * position in the file. Therefore, correlation estimates derived later

View File

@ -50,7 +50,7 @@ static int levenshtein_internal(text *s, text *t,
* array. * array.
* *
* If max_d >= 0, we only need to provide an accurate answer when that answer * If max_d >= 0, we only need to provide an accurate answer when that answer
* is less than or equal to the bound. From any cell in the matrix, there is * is less than or equal to the bound. From any cell in the matrix, there is
* theoretical "minimum residual distance" from that cell to the last column * theoretical "minimum residual distance" from that cell to the last column
* of the final row. This minimum residual distance is zero when the * of the final row. This minimum residual distance is zero when the
* untransformed portions of the strings are of equal length (because we might * untransformed portions of the strings are of equal length (because we might
@ -141,7 +141,7 @@ levenshtein_internal(text *s, text *t,
stop_column = m + 1; stop_column = m + 1;
/* /*
* If max_d >= 0, determine whether the bound is impossibly tight. If so, * If max_d >= 0, determine whether the bound is impossibly tight. If so,
* return max_d + 1 immediately. Otherwise, determine whether it's tight * return max_d + 1 immediately. Otherwise, determine whether it's tight
* enough to limit the computation we must perform. If so, figure out * enough to limit the computation we must perform. If so, figure out
* initial stop column. * initial stop column.
@ -168,7 +168,7 @@ levenshtein_internal(text *s, text *t,
* need to fill in. If the string is growing, the theoretical * need to fill in. If the string is growing, the theoretical
* minimum distance already incorporates the cost of deleting the * minimum distance already incorporates the cost of deleting the
* number of characters necessary to make the two strings equal in * number of characters necessary to make the two strings equal in
* length. Each additional deletion forces another insertion, so * length. Each additional deletion forces another insertion, so
* the best-case total cost increases by ins_c + del_c. If the * the best-case total cost increases by ins_c + del_c. If the
* string is shrinking, the minimum theoretical cost assumes no * string is shrinking, the minimum theoretical cost assumes no
* excess deletions; that is, we're starting no further right than * excess deletions; that is, we're starting no further right than
@ -246,7 +246,7 @@ levenshtein_internal(text *s, text *t,
/* /*
* The main loop fills in curr, but curr[0] needs a special case: to * The main loop fills in curr, but curr[0] needs a special case: to
* transform the first 0 characters of s into the first j characters * transform the first 0 characters of s into the first j characters
* of t, we must perform j insertions. However, if start_column > 0, * of t, we must perform j insertions. However, if start_column > 0,
* this special case does not apply. * this special case does not apply.
*/ */
if (start_column == 0) if (start_column == 0)

View File

@ -12,7 +12,7 @@
* HEntry: there is one of these for each key _and_ value in an hstore * HEntry: there is one of these for each key _and_ value in an hstore
* *
* the position offset points to the _end_ so that we can get the length * the position offset points to the _end_ so that we can get the length
* by subtraction from the previous entry. the ISFIRST flag lets us tell * by subtraction from the previous entry. the ISFIRST flag lets us tell
* whether there is a previous entry. * whether there is a previous entry.
*/ */
typedef struct typedef struct

View File

@ -13,7 +13,7 @@
/* /*
* When using a GIN index for hstore, we choose to index both keys and values. * When using a GIN index for hstore, we choose to index both keys and values.
* The storage format is "text" values, with K, V, or N prepended to the string * The storage format is "text" values, with K, V, or N prepended to the string
* to indicate key, value, or null values. (As of 9.1 it might be better to * to indicate key, value, or null values. (As of 9.1 it might be better to
* store null values as nulls, but we'll keep it this way for on-disk * store null values as nulls, but we'll keep it this way for on-disk
* compatibility.) * compatibility.)
*/ */
@ -165,7 +165,7 @@ gin_consistent_hstore(PG_FUNCTION_ARGS)
{ {
/* /*
* Index doesn't have information about correspondence of keys and * Index doesn't have information about correspondence of keys and
* values, so we need recheck. However, if not all the keys are * values, so we need recheck. However, if not all the keys are
* present, we can fail at once. * present, we can fail at once.
*/ */
*recheck = true; *recheck = true;

View File

@ -1245,7 +1245,7 @@ hstore_to_json_loose(PG_FUNCTION_ARGS)
dst; dst;
if (count == 0) if (count == 0)
PG_RETURN_TEXT_P(cstring_to_text_with_len("{}",2)); PG_RETURN_TEXT_P(cstring_to_text_with_len("{}", 2));
initStringInfo(&tmp); initStringInfo(&tmp);
initStringInfo(&dst); initStringInfo(&dst);
@ -1335,7 +1335,7 @@ hstore_to_json(PG_FUNCTION_ARGS)
dst; dst;
if (count == 0) if (count == 0)
PG_RETURN_TEXT_P(cstring_to_text_with_len("{}",2)); PG_RETURN_TEXT_P(cstring_to_text_with_len("{}", 2));
initStringInfo(&tmp); initStringInfo(&tmp);
initStringInfo(&dst); initStringInfo(&dst);
@ -1381,7 +1381,8 @@ hstore_to_jsonb(PG_FUNCTION_ARGS)
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
JsonbValue key, val; JsonbValue key,
val;
key.estSize = sizeof(JEntry); key.estSize = sizeof(JEntry);
key.type = jbvString; key.type = jbvString;
@ -1424,7 +1425,7 @@ hstore_to_jsonb_loose(PG_FUNCTION_ARGS)
JsonbParseState *state = NULL; JsonbParseState *state = NULL;
JsonbValue *res; JsonbValue *res;
StringInfoData tmp; StringInfoData tmp;
bool is_number; bool is_number;
initStringInfo(&tmp); initStringInfo(&tmp);
@ -1432,7 +1433,8 @@ hstore_to_jsonb_loose(PG_FUNCTION_ARGS)
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
JsonbValue key, val; JsonbValue key,
val;
key.estSize = sizeof(JEntry); key.estSize = sizeof(JEntry);
key.type = jbvString; key.type = jbvString;
@ -1507,7 +1509,8 @@ hstore_to_jsonb_loose(PG_FUNCTION_ARGS)
{ {
val.type = jbvNumeric; val.type = jbvNumeric;
val.val.numeric = DatumGetNumeric( val.val.numeric = DatumGetNumeric(
DirectFunctionCall3(numeric_in, CStringGetDatum(tmp.data), 0, -1)); DirectFunctionCall3(numeric_in, CStringGetDatum(tmp.data), 0, -1));
val.estSize += VARSIZE_ANY(val.val.numeric) +sizeof(JEntry); val.estSize += VARSIZE_ANY(val.val.numeric) +sizeof(JEntry);
} }
else else

View File

@ -345,7 +345,7 @@ gin_bool_consistent(QUERYTYPE *query, bool *check)
return FALSE; return FALSE;
/* /*
* Set up data for checkcondition_gin. This must agree with the query * Set up data for checkcondition_gin. This must agree with the query
* extraction code in ginint4_queryextract. * extraction code in ginint4_queryextract.
*/ */
gcv.first = items; gcv.first = items;

View File

@ -472,7 +472,7 @@ g_int_picksplit(PG_FUNCTION_ARGS)
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost); qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
/* /*
* Now split up the regions between the two seeds. An important property * Now split up the regions between the two seeds. An important property
* of this split algorithm is that the split vector v has the indices of * of this split algorithm is that the split vector v has the indices of
* items to be split in order in its left and right vectors. We exploit * items to be split in order in its left and right vectors. We exploit
* this property by doing a merge in the code that actually splits the * this property by doing a merge in the code that actually splits the
@ -490,7 +490,7 @@ g_int_picksplit(PG_FUNCTION_ARGS)
/* /*
* If we've already decided where to place this item, just put it on * If we've already decided where to place this item, just put it on
* the right list. Otherwise, we need to figure out which page needs * the right list. Otherwise, we need to figure out which page needs
* the least enlargement in order to store the item. * the least enlargement in order to store the item.
*/ */

View File

@ -184,7 +184,7 @@ rt__int_size(ArrayType *a, float *size)
*size = (float) ARRNELEMS(a); *size = (float) ARRNELEMS(a);
} }
/* Sort the given data (len >= 2). Return true if any duplicates found */ /* Sort the given data (len >= 2). Return true if any duplicates found */
bool bool
isort(int32 *a, int len) isort(int32 *a, int len)
{ {
@ -196,7 +196,7 @@ isort(int32 *a, int len)
bool r = FALSE; bool r = FALSE;
/* /*
* We use a simple insertion sort. While this is O(N^2) in the worst * We use a simple insertion sort. While this is O(N^2) in the worst
* case, it's quite fast if the input is already sorted or nearly so. * case, it's quite fast if the input is already sorted or nearly so.
* Also, for not-too-large inputs it's faster than more complex methods * Also, for not-too-large inputs it's faster than more complex methods
* anyhow. * anyhow.

View File

@ -80,7 +80,7 @@ else
$outf = ($opt{u}) ? 'distinct( message.mid )' : 'message.mid'; $outf = ($opt{u}) ? 'distinct( message.mid )' : 'message.mid';
} }
my $sql = my $sql =
"select $outf from " "select $outf from "
. join(', ', keys %table) . join(', ', keys %table)
. " where " . " where "
. join(' AND ', @where) . ';'; . join(' AND ', @where) . ';';

View File

@ -593,7 +593,7 @@ ltreeparentsel(PG_FUNCTION_ARGS)
/* /*
* If the histogram is large enough, see what fraction of it the * If the histogram is large enough, see what fraction of it the
* constant is "<@" to, and assume that's representative of the * constant is "<@" to, and assume that's representative of the
* non-MCV population. Otherwise use the default selectivity for the * non-MCV population. Otherwise use the default selectivity for the
* non-MCV population. * non-MCV population.
*/ */
selec = histogram_selectivity(&vardata, &contproc, selec = histogram_selectivity(&vardata, &contproc,

View File

@ -407,7 +407,7 @@ sql_exec(PGconn *conn, const char *todo, bool quiet)
} }
/* /*
* Dump all databases. There are no system objects to worry about. * Dump all databases. There are no system objects to worry about.
*/ */
void void
sql_exec_dumpalldbs(PGconn *conn, struct options * opts) sql_exec_dumpalldbs(PGconn *conn, struct options * opts)
@ -503,20 +503,20 @@ sql_exec_searchtables(PGconn *conn, struct options * opts)
/* now build the query */ /* now build the query */
todo = psprintf( todo = psprintf(
"SELECT pg_catalog.pg_relation_filenode(c.oid) as \"Filenode\", relname as \"Table Name\" %s\n" "SELECT pg_catalog.pg_relation_filenode(c.oid) as \"Filenode\", relname as \"Table Name\" %s\n"
"FROM pg_catalog.pg_class c \n" "FROM pg_catalog.pg_class c \n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace \n" " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace \n"
" LEFT JOIN pg_catalog.pg_database d ON d.datname = pg_catalog.current_database(),\n" " LEFT JOIN pg_catalog.pg_database d ON d.datname = pg_catalog.current_database(),\n"
" pg_catalog.pg_tablespace t \n" " pg_catalog.pg_tablespace t \n"
"WHERE relkind IN ('r', 'm', 'i', 'S', 't') AND \n" "WHERE relkind IN ('r', 'm', 'i', 'S', 't') AND \n"
" t.oid = CASE\n" " t.oid = CASE\n"
" WHEN reltablespace <> 0 THEN reltablespace\n" " WHEN reltablespace <> 0 THEN reltablespace\n"
" ELSE dattablespace\n" " ELSE dattablespace\n"
" END AND \n" " END AND \n"
" (%s) \n" " (%s) \n"
"ORDER BY relname\n", "ORDER BY relname\n",
opts->extended ? addfields : "", opts->extended ? addfields : "",
qualifiers); qualifiers);
free(qualifiers); free(qualifiers);

View File

@ -208,7 +208,8 @@ page_header(PG_FUNCTION_ARGS)
/* pageinspect >= 1.2 uses pg_lsn instead of text for the LSN field. */ /* pageinspect >= 1.2 uses pg_lsn instead of text for the LSN field. */
if (tupdesc->attrs[0]->atttypid == TEXTOID) if (tupdesc->attrs[0]->atttypid == TEXTOID)
{ {
char lsnchar[64]; char lsnchar[64];
snprintf(lsnchar, sizeof(lsnchar), "%X/%X", snprintf(lsnchar, sizeof(lsnchar), "%X/%X",
(uint32) (lsn >> 32), (uint32) lsn); (uint32) (lsn >> 32), (uint32) lsn);
values[0] = CStringGetTextDatum(lsnchar); values[0] = CStringGetTextDatum(lsnchar);

View File

@ -113,7 +113,7 @@ CleanupPriorWALFiles(void)
/* /*
* We ignore the timeline part of the XLOG segment identifiers in * We ignore the timeline part of the XLOG segment identifiers in
* deciding whether a segment is still needed. This ensures that * deciding whether a segment is still needed. This ensures that
* we won't prematurely remove a segment from a parent timeline. * we won't prematurely remove a segment from a parent timeline.
* We could probably be a little more proactive about removing * We could probably be a little more proactive about removing
* segments of non-parent timelines, but that would be a whole lot * segments of non-parent timelines, but that would be a whole lot
@ -140,7 +140,7 @@ CleanupPriorWALFiles(void)
{ {
/* /*
* Prints the name of the file to be removed and skips the * Prints the name of the file to be removed and skips the
* actual removal. The regular printout is so that the * actual removal. The regular printout is so that the
* user can pipe the output into some other program. * user can pipe the output into some other program.
*/ */
printf("%s\n", WALFilePath); printf("%s\n", WALFilePath);

View File

@ -45,7 +45,7 @@ static char blockbuffer[BLCKSZ];
* *
* The first argument is the relation to be prewarmed; the second controls * The first argument is the relation to be prewarmed; the second controls
* how prewarming is done; legal options are 'prefetch', 'read', and 'buffer'. * how prewarming is done; legal options are 'prefetch', 'read', and 'buffer'.
* The third is the name of the relation fork to be prewarmed. The fourth * The third is the name of the relation fork to be prewarmed. The fourth
* and fifth arguments specify the first and last block to be prewarmed. * and fifth arguments specify the first and last block to be prewarmed.
* If the fourth argument is NULL, it will be taken as 0; if the fifth argument * If the fourth argument is NULL, it will be taken as 0; if the fifth argument
* is NULL, it will be taken as the number of blocks in the relation. The * is NULL, it will be taken as the number of blocks in the relation. The

View File

@ -4,7 +4,7 @@
* Track statement execution times across a whole database cluster. * Track statement execution times across a whole database cluster.
* *
* Execution costs are totalled for each distinct source query, and kept in * Execution costs are totalled for each distinct source query, and kept in
* a shared hashtable. (We track only as many distinct queries as will fit * a shared hashtable. (We track only as many distinct queries as will fit
* in the designated amount of shared memory.) * in the designated amount of shared memory.)
* *
* As of Postgres 9.2, this module normalizes query entries. Normalization * As of Postgres 9.2, this module normalizes query entries. Normalization
@ -15,7 +15,7 @@
* *
* Normalization is implemented by fingerprinting queries, selectively * Normalization is implemented by fingerprinting queries, selectively
* serializing those fields of each query tree's nodes that are judged to be * serializing those fields of each query tree's nodes that are judged to be
* essential to the query. This is referred to as a query jumble. This is * essential to the query. This is referred to as a query jumble. This is
* distinct from a regular serialization in that various extraneous * distinct from a regular serialization in that various extraneous
* information is ignored as irrelevant or not essential to the query, such * information is ignored as irrelevant or not essential to the query, such
* as the collations of Vars and, most notably, the values of constants. * as the collations of Vars and, most notably, the values of constants.
@ -615,7 +615,7 @@ pgss_shmem_startup(void)
* because we remove that file on startup; it acts inversely to * because we remove that file on startup; it acts inversely to
* PGSS_DUMP_FILE, in that it is only supposed to be around when the * PGSS_DUMP_FILE, in that it is only supposed to be around when the
* server is running, whereas PGSS_DUMP_FILE is only supposed to be around * server is running, whereas PGSS_DUMP_FILE is only supposed to be around
* when the server is not running. Leaving the file creates no danger of * when the server is not running. Leaving the file creates no danger of
* a newly restored database having a spurious record of execution costs, * a newly restored database having a spurious record of execution costs,
* which is what we're really concerned about here. * which is what we're really concerned about here.
*/ */
@ -702,7 +702,7 @@ pgss_shmem_shutdown(int code, Datum arg)
/* /*
* When serializing to disk, we store query texts immediately after their * When serializing to disk, we store query texts immediately after their
* entry data. Any orphaned query texts are thereby excluded. * entry data. Any orphaned query texts are thereby excluded.
*/ */
hash_seq_init(&hash_seq, pgss_hash); hash_seq_init(&hash_seq, pgss_hash);
while ((entry = hash_seq_search(&hash_seq)) != NULL) while ((entry = hash_seq_search(&hash_seq)) != NULL)
@ -1363,9 +1363,9 @@ pg_stat_statements_internal(FunctionCallInfo fcinfo,
/* /*
* We'd like to load the query text file (if needed) while not holding any * We'd like to load the query text file (if needed) while not holding any
* lock on pgss->lock. In the worst case we'll have to do this again * lock on pgss->lock. In the worst case we'll have to do this again
* after we have the lock, but it's unlikely enough to make this a win * after we have the lock, but it's unlikely enough to make this a win
* despite occasional duplicated work. We need to reload if anybody * despite occasional duplicated work. We need to reload if anybody
* writes to the file (either a retail qtext_store(), or a garbage * writes to the file (either a retail qtext_store(), or a garbage
* collection) between this point and where we've gotten shared lock. If * collection) between this point and where we've gotten shared lock. If
* a qtext_store is actually in progress when we look, we might as well * a qtext_store is actually in progress when we look, we might as well
@ -1572,7 +1572,7 @@ pgss_memsize(void)
* would be difficult to demonstrate this even under artificial conditions.) * would be difficult to demonstrate this even under artificial conditions.)
* *
* Note: despite needing exclusive lock, it's not an error for the target * Note: despite needing exclusive lock, it's not an error for the target
* entry to already exist. This is because pgss_store releases and * entry to already exist. This is because pgss_store releases and
* reacquires lock after failing to find a match; so someone else could * reacquires lock after failing to find a match; so someone else could
* have made the entry while we waited to get exclusive lock. * have made the entry while we waited to get exclusive lock.
*/ */
@ -1692,13 +1692,13 @@ entry_dealloc(void)
* have it handy, so we require them to pass it too. * have it handy, so we require them to pass it too.
* *
* If successful, returns true, and stores the new entry's offset in the file * If successful, returns true, and stores the new entry's offset in the file
* into *query_offset. Also, if gc_count isn't NULL, *gc_count is set to the * into *query_offset. Also, if gc_count isn't NULL, *gc_count is set to the
* number of garbage collections that have occurred so far. * number of garbage collections that have occurred so far.
* *
* On failure, returns false. * On failure, returns false.
* *
* At least a shared lock on pgss->lock must be held by the caller, so as * At least a shared lock on pgss->lock must be held by the caller, so as
* to prevent a concurrent garbage collection. Share-lock-holding callers * to prevent a concurrent garbage collection. Share-lock-holding callers
* should pass a gc_count pointer to obtain the number of garbage collections, * should pass a gc_count pointer to obtain the number of garbage collections,
* so that they can recheck the count after obtaining exclusive lock to * so that they can recheck the count after obtaining exclusive lock to
* detect whether a garbage collection occurred (and removed this entry). * detect whether a garbage collection occurred (and removed this entry).
@ -1940,7 +1940,7 @@ gc_qtexts(void)
/* /*
* When called from pgss_store, some other session might have proceeded * When called from pgss_store, some other session might have proceeded
* with garbage collection in the no-lock-held interim of lock strength * with garbage collection in the no-lock-held interim of lock strength
* escalation. Check once more that this is actually necessary. * escalation. Check once more that this is actually necessary.
*/ */
if (!need_gc_qtexts()) if (!need_gc_qtexts())
return; return;
@ -2005,7 +2005,7 @@ gc_qtexts(void)
} }
/* /*
* Truncate away any now-unused space. If this fails for some odd reason, * Truncate away any now-unused space. If this fails for some odd reason,
* we log it, but there's no need to fail. * we log it, but there's no need to fail.
*/ */
if (ftruncate(fileno(qfile), extent) != 0) if (ftruncate(fileno(qfile), extent) != 0)
@ -2258,7 +2258,7 @@ JumbleRangeTable(pgssJumbleState *jstate, List *rtable)
* *
* Note: the reason we don't simply use expression_tree_walker() is that the * Note: the reason we don't simply use expression_tree_walker() is that the
* point of that function is to support tree walkers that don't care about * point of that function is to support tree walkers that don't care about
* most tree node types, but here we care about all types. We should complain * most tree node types, but here we care about all types. We should complain
* about any unrecognized node type. * about any unrecognized node type.
*/ */
static void static void
@ -2772,7 +2772,7 @@ generate_normalized_query(pgssJumbleState *jstate, const char *query,
* a problem. * a problem.
* *
* Duplicate constant pointers are possible, and will have their lengths * Duplicate constant pointers are possible, and will have their lengths
* marked as '-1', so that they are later ignored. (Actually, we assume the * marked as '-1', so that they are later ignored. (Actually, we assume the
* lengths were initialized as -1 to start with, and don't change them here.) * lengths were initialized as -1 to start with, and don't change them here.)
* *
* N.B. There is an assumption that a '-' character at a Const location begins * N.B. There is an assumption that a '-' character at a Const location begins
@ -2841,7 +2841,7 @@ fill_in_constant_lengths(pgssJumbleState *jstate, const char *query)
* adjustment of location to that of the leading '-' * adjustment of location to that of the leading '-'
* operator in the event of a negative constant. It is * operator in the event of a negative constant. It is
* also useful for our purposes to start from the minus * also useful for our purposes to start from the minus
* symbol. In this way, queries like "select * from foo * symbol. In this way, queries like "select * from foo
* where bar = 1" and "select * from foo where bar = -2" * where bar = 1" and "select * from foo where bar = -2"
* will have identical normalized query strings. * will have identical normalized query strings.
*/ */

View File

@ -369,12 +369,13 @@ test_sync(int writes_per_op)
{ {
for (writes = 0; writes < writes_per_op; writes++) for (writes = 0; writes < writes_per_op; writes++)
if (write(tmpfile, buf, XLOG_BLCKSZ) != XLOG_BLCKSZ) if (write(tmpfile, buf, XLOG_BLCKSZ) != XLOG_BLCKSZ)
/*
* This can generate write failures if the filesystem /*
* has a large block size, e.g. 4k, and there is no * This can generate write failures if the filesystem has
* support for O_DIRECT writes smaller than the * a large block size, e.g. 4k, and there is no support
* file system block size, e.g. XFS. * for O_DIRECT writes smaller than the file system block
*/ * size, e.g. XFS.
*/
die("write failed"); die("write failed");
if (lseek(tmpfile, 0, SEEK_SET) == -1) if (lseek(tmpfile, 0, SEEK_SET) == -1)
die("seek failed"); die("seek failed");

View File

@ -114,7 +114,7 @@ gin_extract_query_trgm(PG_FUNCTION_ARGS)
{ {
/* /*
* Successful regex processing: store NFA-like graph as * Successful regex processing: store NFA-like graph as
* extra_data. GIN API requires an array of nentries * extra_data. GIN API requires an array of nentries
* Pointers, but we just put the same value in each element. * Pointers, but we just put the same value in each element.
*/ */
trglen = ARRNELEM(trg); trglen = ARRNELEM(trg);

View File

@ -386,7 +386,7 @@ gtrgm_consistent(PG_FUNCTION_ARGS)
/* /*
* GETBIT() tests may give false positives, due to limited * GETBIT() tests may give false positives, due to limited
* size of the sign array. But since trigramsMatchGraph() * size of the sign array. But since trigramsMatchGraph()
* implements a monotone boolean function, false positives * implements a monotone boolean function, false positives
* in the check array can't lead to false negative answer. * in the check array can't lead to false negative answer.
* So we can apply trigramsMatchGraph despite uncertainty, * So we can apply trigramsMatchGraph despite uncertainty,

View File

@ -62,7 +62,7 @@
* In the 2nd stage, the automaton is transformed into a graph based on the * In the 2nd stage, the automaton is transformed into a graph based on the
* original NFA. Each state in the expanded graph represents a state from * original NFA. Each state in the expanded graph represents a state from
* the original NFA, plus a prefix identifying the last two characters * the original NFA, plus a prefix identifying the last two characters
* (colors, to be precise) seen before entering the state. There can be * (colors, to be precise) seen before entering the state. There can be
* multiple states in the expanded graph for each state in the original NFA, * multiple states in the expanded graph for each state in the original NFA,
* depending on what characters can precede it. A prefix position can be * depending on what characters can precede it. A prefix position can be
* "unknown" if it's uncertain what the preceding character was, or "blank" * "unknown" if it's uncertain what the preceding character was, or "blank"
@ -74,7 +74,7 @@
* "enter key". * "enter key".
* *
* Each arc of the expanded graph is labelled with a trigram that must be * Each arc of the expanded graph is labelled with a trigram that must be
* present in the string to match. We can construct this from an out-arc of * present in the string to match. We can construct this from an out-arc of
* the underlying NFA state by combining the expanded state's prefix with the * the underlying NFA state by combining the expanded state's prefix with the
* color label of the underlying out-arc, if neither prefix position is * color label of the underlying out-arc, if neither prefix position is
* "unknown". But note that some of the colors in the trigram might be * "unknown". But note that some of the colors in the trigram might be
@ -106,7 +106,7 @@
* *
* When building the graph, if the number of states or arcs exceed pre-defined * When building the graph, if the number of states or arcs exceed pre-defined
* limits, we give up and simply mark any states not yet processed as final * limits, we give up and simply mark any states not yet processed as final
* states. Roughly speaking, that means that we make use of some portion from * states. Roughly speaking, that means that we make use of some portion from
* the beginning of the regexp. Also, any colors that have too many member * the beginning of the regexp. Also, any colors that have too many member
* characters are treated as "unknown", so that we can't derive trigrams * characters are treated as "unknown", so that we can't derive trigrams
* from them. * from them.
@ -173,10 +173,10 @@
* 1) Create state 1 with enter key (UNKNOWN, UNKNOWN, 1). * 1) Create state 1 with enter key (UNKNOWN, UNKNOWN, 1).
* 2) Add key (UNKNOWN, "a", 2) to state 1. * 2) Add key (UNKNOWN, "a", 2) to state 1.
* 3) Add key ("a", "b", 3) to state 1. * 3) Add key ("a", "b", 3) to state 1.
* 4) Create new state 2 with enter key ("b", "c", 4). Add an arc * 4) Create new state 2 with enter key ("b", "c", 4). Add an arc
* from state 1 to state 2 with label trigram "abc". * from state 1 to state 2 with label trigram "abc".
* 5) Mark state 2 final because state 4 of source NFA is marked as final. * 5) Mark state 2 final because state 4 of source NFA is marked as final.
* 6) Create new state 3 with enter key ("b", "d", 5). Add an arc * 6) Create new state 3 with enter key ("b", "d", 5). Add an arc
* from state 1 to state 3 with label trigram "abd". * from state 1 to state 3 with label trigram "abd".
* 7) Mark state 3 final because state 5 of source NFA is marked as final. * 7) Mark state 3 final because state 5 of source NFA is marked as final.
* *
@ -273,10 +273,10 @@ typedef struct
* *
* We call a prefix ambiguous if at least one of its colors is unknown. It's * We call a prefix ambiguous if at least one of its colors is unknown. It's
* fully ambiguous if both are unknown, partially ambiguous if only the first * fully ambiguous if both are unknown, partially ambiguous if only the first
* is unknown. (The case of first color known, second unknown is not valid.) * is unknown. (The case of first color known, second unknown is not valid.)
* *
* Wholly- or partly-blank prefixes are mostly handled the same as regular * Wholly- or partly-blank prefixes are mostly handled the same as regular
* color prefixes. This allows us to generate appropriate partly-blank * color prefixes. This allows us to generate appropriate partly-blank
* trigrams when the NFA requires word character(s) to appear adjacent to * trigrams when the NFA requires word character(s) to appear adjacent to
* non-word character(s). * non-word character(s).
*/ */
@ -302,7 +302,7 @@ typedef struct
/* /*
* Key identifying a state of our expanded graph: color prefix, and number * Key identifying a state of our expanded graph: color prefix, and number
* of the corresponding state in the underlying regex NFA. The color prefix * of the corresponding state in the underlying regex NFA. The color prefix
* shows how we reached the regex state (to the extent that we know it). * shows how we reached the regex state (to the extent that we know it).
*/ */
typedef struct typedef struct
@ -437,7 +437,7 @@ struct TrgmPackedGraph
* colorTrigramsCount and colorTrigramsGroups contain information about * colorTrigramsCount and colorTrigramsGroups contain information about
* how trigrams are grouped into color trigrams. "colorTrigramsCount" is * how trigrams are grouped into color trigrams. "colorTrigramsCount" is
* the count of color trigrams and "colorTrigramGroups" contains number of * the count of color trigrams and "colorTrigramGroups" contains number of
* simple trigrams for each color trigram. The array of simple trigrams * simple trigrams for each color trigram. The array of simple trigrams
* (stored separately from this struct) is ordered so that the simple * (stored separately from this struct) is ordered so that the simple
* trigrams for each color trigram are consecutive, and they're in order * trigrams for each color trigram are consecutive, and they're in order
* by color trigram number. * by color trigram number.
@ -524,7 +524,7 @@ createTrgmNFA(text *text_re, Oid collation,
/* /*
* This processing generates a great deal of cruft, which we'd like to * This processing generates a great deal of cruft, which we'd like to
* clean up before returning (since this function may be called in a * clean up before returning (since this function may be called in a
* query-lifespan memory context). Make a temp context we can work in so * query-lifespan memory context). Make a temp context we can work in so
* that cleanup is easy. * that cleanup is easy.
*/ */
tmpcontext = AllocSetContextCreate(CurrentMemoryContext, tmpcontext = AllocSetContextCreate(CurrentMemoryContext,
@ -840,7 +840,7 @@ convertPgWchar(pg_wchar c, trgm_mb_char *result)
/* /*
* We can ignore the NUL character, since it can never appear in a PG text * We can ignore the NUL character, since it can never appear in a PG text
* string. This avoids the need for various special cases when * string. This avoids the need for various special cases when
* reconstructing trigrams. * reconstructing trigrams.
*/ */
if (c == 0) if (c == 0)
@ -851,7 +851,7 @@ convertPgWchar(pg_wchar c, trgm_mb_char *result)
pg_wchar2mb_with_len(&c, s, 1); pg_wchar2mb_with_len(&c, s, 1);
/* /*
* In IGNORECASE mode, we can ignore uppercase characters. We assume that * In IGNORECASE mode, we can ignore uppercase characters. We assume that
* the regex engine generated both uppercase and lowercase equivalents * the regex engine generated both uppercase and lowercase equivalents
* within each color, since we used the REG_ICASE option; so there's no * within each color, since we used the REG_ICASE option; so there's no
* need to process the uppercase version. * need to process the uppercase version.
@ -933,7 +933,7 @@ transformGraph(TrgmNFA *trgmNFA)
/* /*
* Recursively build the expanded graph by processing queue of states * Recursively build the expanded graph by processing queue of states
* (breadth-first search). getState already put initstate in the queue. * (breadth-first search). getState already put initstate in the queue.
*/ */
while (trgmNFA->queue != NIL) while (trgmNFA->queue != NIL)
{ {
@ -942,7 +942,7 @@ transformGraph(TrgmNFA *trgmNFA)
trgmNFA->queue = list_delete_first(trgmNFA->queue); trgmNFA->queue = list_delete_first(trgmNFA->queue);
/* /*
* If we overflowed then just mark state as final. Otherwise do * If we overflowed then just mark state as final. Otherwise do
* actual processing. * actual processing.
*/ */
if (trgmNFA->overflowed) if (trgmNFA->overflowed)
@ -968,7 +968,7 @@ processState(TrgmNFA *trgmNFA, TrgmState *state)
/* /*
* Add state's own key, and then process all keys added to keysQueue until * Add state's own key, and then process all keys added to keysQueue until
* queue is empty. But we can quit if the state gets marked final. * queue is empty. But we can quit if the state gets marked final.
*/ */
addKey(trgmNFA, state, &state->stateKey); addKey(trgmNFA, state, &state->stateKey);
while (trgmNFA->keysQueue != NIL && !state->fin) while (trgmNFA->keysQueue != NIL && !state->fin)
@ -1022,7 +1022,7 @@ addKey(TrgmNFA *trgmNFA, TrgmState *state, TrgmStateKey *key)
/* /*
* Compare key to each existing enter key of the state to check for * Compare key to each existing enter key of the state to check for
* redundancy. We can drop either old key(s) or the new key if we find * redundancy. We can drop either old key(s) or the new key if we find
* redundancy. * redundancy.
*/ */
prev = NULL; prev = NULL;
@ -1096,7 +1096,7 @@ addKey(TrgmNFA *trgmNFA, TrgmState *state, TrgmStateKey *key)
else if (pg_reg_colorisend(trgmNFA->regex, arc->co)) else if (pg_reg_colorisend(trgmNFA->regex, arc->co))
{ {
/* /*
* End of line/string ($). We must consider this arc as a * End of line/string ($). We must consider this arc as a
* transition that doesn't read anything. The reason for adding * transition that doesn't read anything. The reason for adding
* this enter key to the state is that if the arc leads to the * this enter key to the state is that if the arc leads to the
* NFA's final state, we must mark this expanded state as final. * NFA's final state, we must mark this expanded state as final.
@ -1141,7 +1141,7 @@ addKey(TrgmNFA *trgmNFA, TrgmState *state, TrgmStateKey *key)
* We can reach the arc destination after reading a word * We can reach the arc destination after reading a word
* character, but the prefix is not something that addArc * character, but the prefix is not something that addArc
* will accept, so no trigram arc can get made for this * will accept, so no trigram arc can get made for this
* transition. We must make an enter key to show that the * transition. We must make an enter key to show that the
* arc destination is reachable. The prefix for the enter * arc destination is reachable. The prefix for the enter
* key should reflect the info we have for this arc. * key should reflect the info we have for this arc.
*/ */
@ -1154,9 +1154,9 @@ addKey(TrgmNFA *trgmNFA, TrgmState *state, TrgmStateKey *key)
else else
{ {
/* /*
* Unexpandable color. Add enter key with ambiguous prefix, * Unexpandable color. Add enter key with ambiguous prefix,
* showing we can reach the destination from this state, but * showing we can reach the destination from this state, but
* the preceding colors will be uncertain. (We do not set the * the preceding colors will be uncertain. (We do not set the
* first prefix color to key->prefix.colors[1], because a * first prefix color to key->prefix.colors[1], because a
* prefix of known followed by unknown is invalid.) * prefix of known followed by unknown is invalid.)
*/ */
@ -1345,9 +1345,9 @@ validArcLabel(TrgmStateKey *key, TrgmColor co)
return false; return false;
/* /*
* We also reject nonblank-blank-anything. The nonblank-blank-nonblank * We also reject nonblank-blank-anything. The nonblank-blank-nonblank
* case doesn't correspond to any trigram the trigram extraction code * case doesn't correspond to any trigram the trigram extraction code
* would make. The nonblank-blank-blank case is also not possible with * would make. The nonblank-blank-blank case is also not possible with
* RPADDING = 1. (Note that in many cases we'd fail to generate such a * RPADDING = 1. (Note that in many cases we'd fail to generate such a
* trigram even if it were valid, for example processing "foo bar" will * trigram even if it were valid, for example processing "foo bar" will
* not result in considering the trigram "o ". So if you want to support * not result in considering the trigram "o ". So if you want to support
@ -1557,7 +1557,7 @@ selectColorTrigrams(TrgmNFA *trgmNFA)
/* /*
* Remove color trigrams from the graph so long as total penalty of color * Remove color trigrams from the graph so long as total penalty of color
* trigrams exceeds WISH_TRGM_PENALTY. (If we fail to get down to * trigrams exceeds WISH_TRGM_PENALTY. (If we fail to get down to
* WISH_TRGM_PENALTY, it's OK so long as total count is no more than * WISH_TRGM_PENALTY, it's OK so long as total count is no more than
* MAX_TRGM_COUNT.) We prefer to remove color trigrams with higher * MAX_TRGM_COUNT.) We prefer to remove color trigrams with higher
* penalty, since those are the most promising for reducing the total * penalty, since those are the most promising for reducing the total

View File

@ -278,7 +278,7 @@ check_cluster_versions(void)
/* Only current PG version is supported as a target */ /* Only current PG version is supported as a target */
if (GET_MAJOR_VERSION(new_cluster.major_version) != GET_MAJOR_VERSION(PG_VERSION_NUM)) if (GET_MAJOR_VERSION(new_cluster.major_version) != GET_MAJOR_VERSION(PG_VERSION_NUM))
pg_fatal("This utility can only upgrade to PostgreSQL version %s.\n", pg_fatal("This utility can only upgrade to PostgreSQL version %s.\n",
PG_MAJORVERSION); PG_MAJORVERSION);
/* /*
* We can't allow downgrading because we use the target pg_dumpall, and * We can't allow downgrading because we use the target pg_dumpall, and
@ -316,17 +316,17 @@ check_cluster_compatibility(bool live_check)
if (GET_MAJOR_VERSION(new_cluster.major_version) == 900 && if (GET_MAJOR_VERSION(new_cluster.major_version) == 900 &&
new_cluster.controldata.cat_ver < TABLE_SPACE_SUBDIRS_CAT_VER) new_cluster.controldata.cat_ver < TABLE_SPACE_SUBDIRS_CAT_VER)
pg_fatal("This utility can only upgrade to PostgreSQL version 9.0 after 2010-01-11\n" pg_fatal("This utility can only upgrade to PostgreSQL version 9.0 after 2010-01-11\n"
"because of backend API changes made during development.\n"); "because of backend API changes made during development.\n");
/* We read the real port number for PG >= 9.1 */ /* We read the real port number for PG >= 9.1 */
if (live_check && GET_MAJOR_VERSION(old_cluster.major_version) < 901 && if (live_check && GET_MAJOR_VERSION(old_cluster.major_version) < 901 &&
old_cluster.port == DEF_PGUPORT) old_cluster.port == DEF_PGUPORT)
pg_fatal("When checking a pre-PG 9.1 live old server, " pg_fatal("When checking a pre-PG 9.1 live old server, "
"you must specify the old server's port number.\n"); "you must specify the old server's port number.\n");
if (live_check && old_cluster.port == new_cluster.port) if (live_check && old_cluster.port == new_cluster.port)
pg_fatal("When checking a live server, " pg_fatal("When checking a live server, "
"the old and new port numbers must be different.\n"); "the old and new port numbers must be different.\n");
} }
@ -438,7 +438,7 @@ equivalent_locale(const char *loca, const char *locb)
return (pg_strcasecmp(loca, locb) == 0); return (pg_strcasecmp(loca, locb) == 0);
/* /*
* Compare the encoding parts. Windows tends to use code page numbers for * Compare the encoding parts. Windows tends to use code page numbers for
* the encoding part, which equivalent_encoding() won't like, so accept if * the encoding part, which equivalent_encoding() won't like, so accept if
* the strings are case-insensitive equal; otherwise use * the strings are case-insensitive equal; otherwise use
* equivalent_encoding() to compare. * equivalent_encoding() to compare.
@ -499,7 +499,7 @@ check_new_cluster_is_empty(void)
/* pg_largeobject and its index should be skipped */ /* pg_largeobject and its index should be skipped */
if (strcmp(rel_arr->rels[relnum].nspname, "pg_catalog") != 0) if (strcmp(rel_arr->rels[relnum].nspname, "pg_catalog") != 0)
pg_fatal("New cluster database \"%s\" is not empty\n", pg_fatal("New cluster database \"%s\" is not empty\n",
new_cluster.dbarr.dbs[dbnum].db_name); new_cluster.dbarr.dbs[dbnum].db_name);
} }
} }
@ -526,7 +526,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
if ((script = fopen_priv(*analyze_script_file_name, "w")) == NULL) if ((script = fopen_priv(*analyze_script_file_name, "w")) == NULL)
pg_fatal("Could not open file \"%s\": %s\n", pg_fatal("Could not open file \"%s\": %s\n",
*analyze_script_file_name, getErrorText(errno)); *analyze_script_file_name, getErrorText(errno));
#ifndef WIN32 #ifndef WIN32
/* add shebang header */ /* add shebang header */
@ -581,7 +581,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
#ifndef WIN32 #ifndef WIN32
if (chmod(*analyze_script_file_name, S_IRWXU) != 0) if (chmod(*analyze_script_file_name, S_IRWXU) != 0)
pg_fatal("Could not add execute permission to file \"%s\": %s\n", pg_fatal("Could not add execute permission to file \"%s\": %s\n",
*analyze_script_file_name, getErrorText(errno)); *analyze_script_file_name, getErrorText(errno));
#endif #endif
if (os_info.user_specified) if (os_info.user_specified)
@ -632,7 +632,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
if ((script = fopen_priv(*deletion_script_file_name, "w")) == NULL) if ((script = fopen_priv(*deletion_script_file_name, "w")) == NULL)
pg_fatal("Could not open file \"%s\": %s\n", pg_fatal("Could not open file \"%s\": %s\n",
*deletion_script_file_name, getErrorText(errno)); *deletion_script_file_name, getErrorText(errno));
#ifndef WIN32 #ifndef WIN32
/* add shebang header */ /* add shebang header */
@ -668,7 +668,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
} }
else else
{ {
char *suffix_path = pg_strdup(old_cluster.tablespace_suffix); char *suffix_path = pg_strdup(old_cluster.tablespace_suffix);
/* /*
* Simply delete the tablespace directory, which might be ".old" * Simply delete the tablespace directory, which might be ".old"
@ -686,7 +686,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
#ifndef WIN32 #ifndef WIN32
if (chmod(*deletion_script_file_name, S_IRWXU) != 0) if (chmod(*deletion_script_file_name, S_IRWXU) != 0)
pg_fatal("Could not add execute permission to file \"%s\": %s\n", pg_fatal("Could not add execute permission to file \"%s\": %s\n",
*deletion_script_file_name, getErrorText(errno)); *deletion_script_file_name, getErrorText(errno));
#endif #endif
check_ok(); check_ok();
@ -714,7 +714,7 @@ check_is_super_user(ClusterInfo *cluster)
if (PQntuples(res) != 1 || strcmp(PQgetvalue(res, 0, 0), "t") != 0) if (PQntuples(res) != 1 || strcmp(PQgetvalue(res, 0, 0), "t") != 0)
pg_fatal("database user \"%s\" is not a superuser\n", pg_fatal("database user \"%s\" is not a superuser\n",
os_info.user); os_info.user);
cluster->install_role_oid = atooid(PQgetvalue(res, 0, 1)); cluster->install_role_oid = atooid(PQgetvalue(res, 0, 1));
@ -757,7 +757,7 @@ check_for_prepared_transactions(ClusterInfo *cluster)
if (PQntuples(res) != 0) if (PQntuples(res) != 0)
pg_fatal("The %s cluster contains prepared transactions\n", pg_fatal("The %s cluster contains prepared transactions\n",
CLUSTER_NAME(cluster)); CLUSTER_NAME(cluster));
PQclear(res); PQclear(res);
@ -822,7 +822,7 @@ check_for_isn_and_int8_passing_mismatch(ClusterInfo *cluster)
found = true; found = true;
if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL) if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
pg_fatal("Could not open file \"%s\": %s\n", pg_fatal("Could not open file \"%s\": %s\n",
output_path, getErrorText(errno)); output_path, getErrorText(errno));
if (!db_used) if (!db_used)
{ {
fprintf(script, "Database: %s\n", active_db->db_name); fprintf(script, "Database: %s\n", active_db->db_name);
@ -847,10 +847,10 @@ check_for_isn_and_int8_passing_mismatch(ClusterInfo *cluster)
pg_fatal("Your installation contains \"contrib/isn\" functions which rely on the\n" pg_fatal("Your installation contains \"contrib/isn\" functions which rely on the\n"
"bigint data type. Your old and new clusters pass bigint values\n" "bigint data type. Your old and new clusters pass bigint values\n"
"differently so this cluster cannot currently be upgraded. You can\n" "differently so this cluster cannot currently be upgraded. You can\n"
"manually upgrade databases that use \"contrib/isn\" facilities and remove\n" "manually upgrade databases that use \"contrib/isn\" facilities and remove\n"
"\"contrib/isn\" from the old cluster and restart the upgrade. A list of\n" "\"contrib/isn\" from the old cluster and restart the upgrade. A list of\n"
"the problem functions is in the file:\n" "the problem functions is in the file:\n"
" %s\n\n", output_path); " %s\n\n", output_path);
} }
else else
check_ok(); check_ok();
@ -926,7 +926,7 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
found = true; found = true;
if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL) if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
pg_fatal("Could not open file \"%s\": %s\n", pg_fatal("Could not open file \"%s\": %s\n",
output_path, getErrorText(errno)); output_path, getErrorText(errno));
if (!db_used) if (!db_used)
{ {
fprintf(script, "Database: %s\n", active_db->db_name); fprintf(script, "Database: %s\n", active_db->db_name);
@ -952,9 +952,9 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
pg_fatal("Your installation contains one of the reg* data types in user tables.\n" pg_fatal("Your installation contains one of the reg* data types in user tables.\n"
"These data types reference system OIDs that are not preserved by\n" "These data types reference system OIDs that are not preserved by\n"
"pg_upgrade, so this cluster cannot currently be upgraded. You can\n" "pg_upgrade, so this cluster cannot currently be upgraded. You can\n"
"remove the problem tables and restart the upgrade. A list of the problem\n" "remove the problem tables and restart the upgrade. A list of the problem\n"
"columns is in the file:\n" "columns is in the file:\n"
" %s\n\n", output_path); " %s\n\n", output_path);
} }
else else
check_ok(); check_ok();
@ -975,7 +975,7 @@ get_bin_version(ClusterInfo *cluster)
if ((output = popen(cmd, "r")) == NULL || if ((output = popen(cmd, "r")) == NULL ||
fgets(cmd_output, sizeof(cmd_output), output) == NULL) fgets(cmd_output, sizeof(cmd_output), output) == NULL)
pg_fatal("Could not get pg_ctl version data using %s: %s\n", pg_fatal("Could not get pg_ctl version data using %s: %s\n",
cmd, getErrorText(errno)); cmd, getErrorText(errno));
pclose(output); pclose(output);

View File

@ -27,7 +27,7 @@
* pg_control data. pg_resetxlog cannot be run while the server is running * pg_control data. pg_resetxlog cannot be run while the server is running
* so we use pg_controldata; pg_controldata doesn't provide all the fields * so we use pg_controldata; pg_controldata doesn't provide all the fields
* we need to actually perform the upgrade, but it provides enough for * we need to actually perform the upgrade, but it provides enough for
* check mode. We do not implement pg_resetxlog -n because it is hard to * check mode. We do not implement pg_resetxlog -n because it is hard to
* return valid xid data for a running server. * return valid xid data for a running server.
*/ */
void void
@ -119,7 +119,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
if ((output = popen(cmd, "r")) == NULL) if ((output = popen(cmd, "r")) == NULL)
pg_fatal("Could not get control data using %s: %s\n", pg_fatal("Could not get control data using %s: %s\n",
cmd, getErrorText(errno)); cmd, getErrorText(errno));
/* Only pre-8.4 has these so if they are not set below we will check later */ /* Only pre-8.4 has these so if they are not set below we will check later */
cluster->controldata.lc_collate = NULL; cluster->controldata.lc_collate = NULL;
@ -156,8 +156,8 @@ get_control_data(ClusterInfo *cluster, bool live_check)
for (p = bufin; *p; p++) for (p = bufin; *p; p++)
if (!isascii(*p)) if (!isascii(*p))
pg_fatal("The 8.3 cluster's pg_controldata is incapable of outputting ASCII, even\n" pg_fatal("The 8.3 cluster's pg_controldata is incapable of outputting ASCII, even\n"
"with LANG=C. You must upgrade this cluster to a newer version of PostgreSQL\n" "with LANG=C. You must upgrade this cluster to a newer version of PostgreSQL\n"
"8.3 to fix this bug. PostgreSQL 8.3.7 and later are known to work properly.\n"); "8.3 to fix this bug. PostgreSQL 8.3.7 and later are known to work properly.\n");
} }
#endif #endif
@ -606,8 +606,8 @@ check_control_data(ControlData *oldctrl,
* This is a common 8.3 -> 8.4 upgrade problem, so we are more verbose * This is a common 8.3 -> 8.4 upgrade problem, so we are more verbose
*/ */
pg_fatal("You will need to rebuild the new server with configure option\n" pg_fatal("You will need to rebuild the new server with configure option\n"
"--disable-integer-datetimes or get server binaries built with those\n" "--disable-integer-datetimes or get server binaries built with those\n"
"options.\n"); "options.\n");
} }
/* /*

View File

@ -34,8 +34,8 @@ generate_old_dump(void)
/* /*
* Set umask for this function, all functions it calls, and all * Set umask for this function, all functions it calls, and all
* subprocesses/threads it creates. We can't use fopen_priv() * subprocesses/threads it creates. We can't use fopen_priv() as Windows
* as Windows uses threads and umask is process-global. * uses threads and umask is process-global.
*/ */
old_umask = umask(S_IRWXG | S_IRWXO); old_umask = umask(S_IRWXG | S_IRWXO);

View File

@ -52,7 +52,7 @@ exec_prog(const char *log_file, const char *opt_log_file,
va_list ap; va_list ap;
#ifdef WIN32 #ifdef WIN32
static DWORD mainThreadId = 0; static DWORD mainThreadId = 0;
/* We assume we are called from the primary thread first */ /* We assume we are called from the primary thread first */
if (mainThreadId == 0) if (mainThreadId == 0)
@ -73,14 +73,15 @@ static DWORD mainThreadId = 0;
pg_log(PG_VERBOSE, "%s\n", cmd); pg_log(PG_VERBOSE, "%s\n", cmd);
#ifdef WIN32 #ifdef WIN32
/* /*
* For some reason, Windows issues a file-in-use error if we write data * For some reason, Windows issues a file-in-use error if we write data to
* to the log file from a non-primary thread just before we create a * the log file from a non-primary thread just before we create a
* subprocess that also writes to the same log file. One fix is to * subprocess that also writes to the same log file. One fix is to sleep
* sleep for 100ms. A cleaner fix is to write to the log file _after_ * for 100ms. A cleaner fix is to write to the log file _after_ the
* the subprocess has completed, so we do this only when writing from * subprocess has completed, so we do this only when writing from a
* a non-primary thread. fflush(), running system() twice, and * non-primary thread. fflush(), running system() twice, and pre-creating
* pre-creating the file do not see to help. * the file do not see to help.
*/ */
if (mainThreadId != GetCurrentThreadId()) if (mainThreadId != GetCurrentThreadId())
result = system(cmd); result = system(cmd);
@ -101,7 +102,7 @@ static DWORD mainThreadId = 0;
for (iter = 0; iter < 4 && log == NULL; iter++) for (iter = 0; iter < 4 && log == NULL; iter++)
{ {
pg_usleep(1000000); /* 1 sec */ pg_usleep(1000000); /* 1 sec */
log = fopen(log_file, "a"); log = fopen(log_file, "a");
} }
} }
@ -154,11 +155,12 @@ static DWORD mainThreadId = 0;
} }
#ifndef WIN32 #ifndef WIN32
/* /*
* We can't do this on Windows because it will keep the "pg_ctl start" * We can't do this on Windows because it will keep the "pg_ctl start"
* output filename open until the server stops, so we do the \n\n above on * output filename open until the server stops, so we do the \n\n above on
* that platform. We use a unique filename for "pg_ctl start" that is * that platform. We use a unique filename for "pg_ctl start" that is
* never reused while the server is running, so it works fine. We could * never reused while the server is running, so it works fine. We could
* log these commands to a third file, but that just adds complexity. * log these commands to a third file, but that just adds complexity.
*/ */
if ((log = fopen(log_file, "a")) == NULL) if ((log = fopen(log_file, "a")) == NULL)
@ -189,7 +191,7 @@ pid_lock_file_exists(const char *datadir)
/* ENOTDIR means we will throw a more useful error later */ /* ENOTDIR means we will throw a more useful error later */
if (errno != ENOENT && errno != ENOTDIR) if (errno != ENOENT && errno != ENOTDIR)
pg_fatal("could not open file \"%s\" for reading: %s\n", pg_fatal("could not open file \"%s\" for reading: %s\n",
path, getErrorText(errno)); path, getErrorText(errno));
return false; return false;
} }
@ -238,7 +240,7 @@ win32_check_directory_write_permissions(void)
int fd; int fd;
/* /*
* We open a file we would normally create anyway. We do this even in * We open a file we would normally create anyway. We do this even in
* 'check' mode, which isn't ideal, but this is the best we can do. * 'check' mode, which isn't ideal, but this is the best we can do.
*/ */
if ((fd = open(GLOBALS_DUMP_FILE, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)) < 0) if ((fd = open(GLOBALS_DUMP_FILE, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)) < 0)
@ -255,7 +257,7 @@ win32_check_directory_write_permissions(void)
* *
* This function validates the given cluster directory - we search for a * This function validates the given cluster directory - we search for a
* small set of subdirectories that we expect to find in a valid $PGDATA * small set of subdirectories that we expect to find in a valid $PGDATA
* directory. If any of the subdirectories are missing (or secured against * directory. If any of the subdirectories are missing (or secured against
* us) we display an error message and exit() * us) we display an error message and exit()
* *
*/ */
@ -295,7 +297,7 @@ check_data_dir(const char *pg_data)
* check_bin_dir() * check_bin_dir()
* *
* This function searches for the executables that we expect to find * This function searches for the executables that we expect to find
* in the binaries directory. If we find that a required executable * in the binaries directory. If we find that a required executable
* is missing (or secured against us), we display an error message and * is missing (or secured against us), we display an error message and
* exit(). * exit().
*/ */
@ -349,10 +351,10 @@ validate_exec(const char *dir, const char *cmdName)
*/ */
if (stat(path, &buf) < 0) if (stat(path, &buf) < 0)
pg_fatal("check for \"%s\" failed: %s\n", pg_fatal("check for \"%s\" failed: %s\n",
path, getErrorText(errno)); path, getErrorText(errno));
else if (!S_ISREG(buf.st_mode)) else if (!S_ISREG(buf.st_mode))
pg_fatal("check for \"%s\" failed: not an executable file\n", pg_fatal("check for \"%s\" failed: not an executable file\n",
path); path);
/* /*
* Ensure that the file is both executable and readable (required for * Ensure that the file is both executable and readable (required for
@ -364,7 +366,7 @@ validate_exec(const char *dir, const char *cmdName)
if ((buf.st_mode & S_IRUSR) == 0) if ((buf.st_mode & S_IRUSR) == 0)
#endif #endif
pg_fatal("check for \"%s\" failed: cannot read file (permission denied)\n", pg_fatal("check for \"%s\" failed: cannot read file (permission denied)\n",
path); path);
#ifndef WIN32 #ifndef WIN32
if (access(path, X_OK) != 0) if (access(path, X_OK) != 0)
@ -372,5 +374,5 @@ validate_exec(const char *dir, const char *cmdName)
if ((buf.st_mode & S_IXUSR) == 0) if ((buf.st_mode & S_IXUSR) == 0)
#endif #endif
pg_fatal("check for \"%s\" failed: cannot execute (permission denied)\n", pg_fatal("check for \"%s\" failed: cannot execute (permission denied)\n",
path); path);
} }

View File

@ -214,8 +214,8 @@ check_hard_link(void)
if (pg_link_file(existing_file, new_link_file) == -1) if (pg_link_file(existing_file, new_link_file) == -1)
{ {
pg_fatal("Could not create hard link between old and new data directories: %s\n" pg_fatal("Could not create hard link between old and new data directories: %s\n"
"In link mode the old and new data directories must be on the same file system volume.\n", "In link mode the old and new data directories must be on the same file system volume.\n",
getErrorText(errno)); getErrorText(errno));
} }
unlink(new_link_file); unlink(new_link_file);
} }

View File

@ -296,7 +296,7 @@ check_loadable_libraries(void)
* plpython2u language was created with library name plpython2.so as a * plpython2u language was created with library name plpython2.so as a
* symbolic link to plpython.so. In Postgres 9.1, only the * symbolic link to plpython.so. In Postgres 9.1, only the
* plpython2.so library was created, and both plpythonu and plpython2u * plpython2.so library was created, and both plpythonu and plpython2u
* pointing to it. For this reason, any reference to library name * pointing to it. For this reason, any reference to library name
* "plpython" in an old PG <= 9.1 cluster must look for "plpython2" in * "plpython" in an old PG <= 9.1 cluster must look for "plpython2" in
* the new cluster. * the new cluster.
* *
@ -327,7 +327,7 @@ check_loadable_libraries(void)
if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL) if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
pg_fatal("Could not open file \"%s\": %s\n", pg_fatal("Could not open file \"%s\": %s\n",
output_path, getErrorText(errno)); output_path, getErrorText(errno));
fprintf(script, "Could not load library \"%s\"\n%s\n", fprintf(script, "Could not load library \"%s\"\n%s\n",
lib, lib,
PQerrorMessage(conn)); PQerrorMessage(conn));
@ -343,10 +343,10 @@ check_loadable_libraries(void)
fclose(script); fclose(script);
pg_log(PG_REPORT, "fatal\n"); pg_log(PG_REPORT, "fatal\n");
pg_fatal("Your installation references loadable libraries that are missing from the\n" pg_fatal("Your installation references loadable libraries that are missing from the\n"
"new installation. You can add these libraries to the new installation,\n" "new installation. You can add these libraries to the new installation,\n"
"or remove the functions using them from the old installation. A list of\n" "or remove the functions using them from the old installation. A list of\n"
"problem libraries is in the file:\n" "problem libraries is in the file:\n"
" %s\n\n", output_path); " %s\n\n", output_path);
} }
else else
check_ok(); check_ok();

View File

@ -52,7 +52,7 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
if (old_rel->reloid != new_rel->reloid) if (old_rel->reloid != new_rel->reloid)
pg_fatal("Mismatch of relation OID in database \"%s\": old OID %d, new OID %d\n", pg_fatal("Mismatch of relation OID in database \"%s\": old OID %d, new OID %d\n",
old_db->db_name, old_rel->reloid, new_rel->reloid); old_db->db_name, old_rel->reloid, new_rel->reloid);
/* /*
* TOAST table names initially match the heap pg_class oid. In * TOAST table names initially match the heap pg_class oid. In
@ -69,9 +69,9 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
strcmp(old_rel->nspname, "pg_toast") != 0) && strcmp(old_rel->nspname, "pg_toast") != 0) &&
strcmp(old_rel->relname, new_rel->relname) != 0)) strcmp(old_rel->relname, new_rel->relname) != 0))
pg_fatal("Mismatch of relation names in database \"%s\": " pg_fatal("Mismatch of relation names in database \"%s\": "
"old name \"%s.%s\", new name \"%s.%s\"\n", "old name \"%s.%s\", new name \"%s.%s\"\n",
old_db->db_name, old_rel->nspname, old_rel->relname, old_db->db_name, old_rel->nspname, old_rel->relname,
new_rel->nspname, new_rel->relname); new_rel->nspname, new_rel->relname);
create_rel_filename_map(old_pgdata, new_pgdata, old_db, new_db, create_rel_filename_map(old_pgdata, new_pgdata, old_db, new_db,
old_rel, new_rel, maps + num_maps); old_rel, new_rel, maps + num_maps);
@ -84,7 +84,7 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
*/ */
if (old_db->rel_arr.nrels != new_db->rel_arr.nrels) if (old_db->rel_arr.nrels != new_db->rel_arr.nrels)
pg_fatal("old and new databases \"%s\" have a different number of relations\n", pg_fatal("old and new databases \"%s\" have a different number of relations\n",
old_db->db_name); old_db->db_name);
*nmaps = num_maps; *nmaps = num_maps;
return maps; return maps;
@ -270,7 +270,8 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
i_relfilenode, i_relfilenode,
i_reltablespace; i_reltablespace;
char query[QUERY_ALLOC]; char query[QUERY_ALLOC];
char *last_namespace = NULL, *last_tablespace = NULL; char *last_namespace = NULL,
*last_tablespace = NULL;
/* /*
* pg_largeobject contains user data that does not appear in pg_dumpall * pg_largeobject contains user data that does not appear in pg_dumpall
@ -322,7 +323,7 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
"SELECT reltoastrelid " "SELECT reltoastrelid "
"FROM info_rels i JOIN pg_catalog.pg_class c " "FROM info_rels i JOIN pg_catalog.pg_class c "
" ON i.reloid = c.oid " " ON i.reloid = c.oid "
" AND c.reltoastrelid != %u", InvalidOid)); " AND c.reltoastrelid != %u", InvalidOid));
PQclear(executeQueryOrDie(conn, PQclear(executeQueryOrDie(conn,
"INSERT INTO info_rels " "INSERT INTO info_rels "
"SELECT indexrelid " "SELECT indexrelid "
@ -373,9 +374,9 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
curr->nsp_alloc = false; curr->nsp_alloc = false;
/* /*
* Many of the namespace and tablespace strings are identical, * Many of the namespace and tablespace strings are identical, so we
* so we try to reuse the allocated string pointers where possible * try to reuse the allocated string pointers where possible to reduce
* to reduce memory consumption. * memory consumption.
*/ */
/* Can we reuse the previous string allocation? */ /* Can we reuse the previous string allocation? */
if (last_namespace && strcmp(nspname, last_namespace) == 0) if (last_namespace && strcmp(nspname, last_namespace) == 0)

View File

@ -188,7 +188,7 @@ parseCommandLine(int argc, char *argv[])
default: default:
pg_fatal("Try \"%s --help\" for more information.\n", pg_fatal("Try \"%s --help\" for more information.\n",
os_info.progname); os_info.progname);
break; break;
} }
} }
@ -211,8 +211,9 @@ parseCommandLine(int argc, char *argv[])
/* Turn off read-only mode; add prefix to PGOPTIONS? */ /* Turn off read-only mode; add prefix to PGOPTIONS? */
if (getenv("PGOPTIONS")) if (getenv("PGOPTIONS"))
{ {
char *pgoptions = psprintf("%s %s", FIX_DEFAULT_READ_ONLY, char *pgoptions = psprintf("%s %s", FIX_DEFAULT_READ_ONLY,
getenv("PGOPTIONS")); getenv("PGOPTIONS"));
pg_putenv("PGOPTIONS", pgoptions); pg_putenv("PGOPTIONS", pgoptions);
pfree(pgoptions); pfree(pgoptions);
} }
@ -319,8 +320,8 @@ check_required_directory(char **dirpath, char **configpath,
} }
else else
pg_fatal("You must identify the directory where the %s.\n" pg_fatal("You must identify the directory where the %s.\n"
"Please use the %s command-line option or the %s environment variable.\n", "Please use the %s command-line option or the %s environment variable.\n",
description, cmdLineOption, envVarName); description, cmdLineOption, envVarName);
} }
/* /*
@ -373,7 +374,7 @@ adjust_data_dir(ClusterInfo *cluster)
/* /*
* We don't have a data directory yet, so we can't check the PG version, * We don't have a data directory yet, so we can't check the PG version,
* so this might fail --- only works for PG 9.2+. If this fails, * so this might fail --- only works for PG 9.2+. If this fails,
* pg_upgrade will fail anyway because the data files will not be found. * pg_upgrade will fail anyway because the data files will not be found.
*/ */
snprintf(cmd, sizeof(cmd), "\"%s/postmaster\" -D \"%s\" -C data_directory", snprintf(cmd, sizeof(cmd), "\"%s/postmaster\" -D \"%s\" -C data_directory",
@ -382,7 +383,7 @@ adjust_data_dir(ClusterInfo *cluster)
if ((output = popen(cmd, "r")) == NULL || if ((output = popen(cmd, "r")) == NULL ||
fgets(cmd_output, sizeof(cmd_output), output) == NULL) fgets(cmd_output, sizeof(cmd_output), output) == NULL)
pg_fatal("Could not get data directory using %s: %s\n", pg_fatal("Could not get data directory using %s: %s\n",
cmd, getErrorText(errno)); cmd, getErrorText(errno));
pclose(output); pclose(output);

View File

@ -30,7 +30,7 @@ static pageCnvCtx *loadConverterPlugin(
* the PageLayoutVersion of the new cluster. If the versions differ, this * the PageLayoutVersion of the new cluster. If the versions differ, this
* function loads a converter plugin and returns a pointer to a pageCnvCtx * function loads a converter plugin and returns a pointer to a pageCnvCtx
* object (in *result) that knows how to convert pages from the old format * object (in *result) that knows how to convert pages from the old format
* to the new format. If the versions are identical, this function just * to the new format. If the versions are identical, this function just
* returns a NULL pageCnvCtx pointer to indicate that page-by-page conversion * returns a NULL pageCnvCtx pointer to indicate that page-by-page conversion
* is not required. * is not required.
*/ */
@ -110,7 +110,7 @@ getPageVersion(uint16 *version, const char *pathName)
* This function loads a page-converter plugin library and grabs a * This function loads a page-converter plugin library and grabs a
* pointer to each of the (interesting) functions provided by that * pointer to each of the (interesting) functions provided by that
* plugin. The name of the plugin library is derived from the given * plugin. The name of the plugin library is derived from the given
* newPageVersion and oldPageVersion. If a plugin is found, this * newPageVersion and oldPageVersion. If a plugin is found, this
* function returns a pointer to a pageCnvCtx object (which will contain * function returns a pointer to a pageCnvCtx object (which will contain
* a collection of plugin function pointers). If the required plugin * a collection of plugin function pointers). If the required plugin
* is not found, this function returns NULL. * is not found, this function returns NULL.

View File

@ -339,10 +339,10 @@ reap_child(bool wait_for_child)
thread_handles[thread_num] = thread_handles[parallel_jobs - 1]; thread_handles[thread_num] = thread_handles[parallel_jobs - 1];
/* /*
* Move last active thead arg struct into the now-dead slot, * Move last active thead arg struct into the now-dead slot, and the
* and the now-dead slot to the end for reuse by the next thread. * now-dead slot to the end for reuse by the next thread. Though the
* Though the thread struct is in use by another thread, we can * thread struct is in use by another thread, we can safely swap the
* safely swap the struct pointers within the array. * struct pointers within the array.
*/ */
tmp_args = cur_thread_args[thread_num]; tmp_args = cur_thread_args[thread_num];
cur_thread_args[thread_num] = cur_thread_args[parallel_jobs - 1]; cur_thread_args[thread_num] = cur_thread_args[parallel_jobs - 1];

View File

@ -125,7 +125,7 @@ main(int argc, char **argv)
/* /*
* Most failures happen in create_new_objects(), which has completed at * Most failures happen in create_new_objects(), which has completed at
* this point. We do this here because it is just before linking, which * this point. We do this here because it is just before linking, which
* will link the old and new cluster data files, preventing the old * will link the old and new cluster data files, preventing the old
* cluster from being safely started once the new cluster is started. * cluster from being safely started once the new cluster is started.
*/ */
@ -193,7 +193,7 @@ setup(char *argv0, bool *live_check)
{ {
/* /*
* If we have a postmaster.pid file, try to start the server. If it * If we have a postmaster.pid file, try to start the server. If it
* starts, the pid file was stale, so stop the server. If it doesn't * starts, the pid file was stale, so stop the server. If it doesn't
* start, assume the server is running. If the pid file is left over * start, assume the server is running. If the pid file is left over
* from a server crash, this also allows any committed transactions * from a server crash, this also allows any committed transactions
* stored in the WAL to be replayed so they are not lost, because WAL * stored in the WAL to be replayed so they are not lost, because WAL
@ -205,7 +205,7 @@ setup(char *argv0, bool *live_check)
{ {
if (!user_opts.check) if (!user_opts.check)
pg_fatal("There seems to be a postmaster servicing the old cluster.\n" pg_fatal("There seems to be a postmaster servicing the old cluster.\n"
"Please shutdown that postmaster and try again.\n"); "Please shutdown that postmaster and try again.\n");
else else
*live_check = true; *live_check = true;
} }
@ -218,7 +218,7 @@ setup(char *argv0, bool *live_check)
stop_postmaster(false); stop_postmaster(false);
else else
pg_fatal("There seems to be a postmaster servicing the new cluster.\n" pg_fatal("There seems to be a postmaster servicing the new cluster.\n"
"Please shutdown that postmaster and try again.\n"); "Please shutdown that postmaster and try again.\n");
} }
/* get path to pg_upgrade executable */ /* get path to pg_upgrade executable */
@ -279,8 +279,8 @@ prepare_new_databases(void)
/* /*
* Install support functions in the global-object restore database to * Install support functions in the global-object restore database to
* preserve pg_authid.oid. pg_dumpall uses 'template0' as its template * preserve pg_authid.oid. pg_dumpall uses 'template0' as its template
* database so objects we add into 'template1' are not propogated. They * database so objects we add into 'template1' are not propogated. They
* are removed on pg_upgrade exit. * are removed on pg_upgrade exit.
*/ */
install_support_functions_in_new_db("template1"); install_support_functions_in_new_db("template1");

View File

@ -142,10 +142,10 @@ typedef struct
*/ */
typedef struct typedef struct
{ {
const char *old_tablespace; const char *old_tablespace;
const char *new_tablespace; const char *new_tablespace;
const char *old_tablespace_suffix; const char *old_tablespace_suffix;
const char *new_tablespace_suffix; const char *new_tablespace_suffix;
Oid old_db_oid; Oid old_db_oid;
Oid new_db_oid; Oid new_db_oid;
@ -167,7 +167,8 @@ typedef struct
{ {
Oid db_oid; /* oid of the database */ Oid db_oid; /* oid of the database */
char *db_name; /* database name */ char *db_name; /* database name */
char db_tablespace[MAXPGPATH]; /* database default tablespace path */ char db_tablespace[MAXPGPATH]; /* database default tablespace
* path */
RelInfoArr rel_arr; /* array of all user relinfos */ RelInfoArr rel_arr; /* array of all user relinfos */
} DbInfo; } DbInfo;
@ -454,7 +455,7 @@ pg_log(eLogType type, const char *fmt,...)
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3))); __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
void void
pg_fatal(const char *fmt,...) pg_fatal(const char *fmt,...)
__attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2),noreturn)); __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2), noreturn));
void end_progress_output(void); void end_progress_output(void);
void void
prep_status(const char *fmt,...) prep_status(const char *fmt,...)

View File

@ -37,7 +37,7 @@ transfer_all_new_tablespaces(DbInfoArr *old_db_arr, DbInfoArr *new_db_arr,
/* /*
* Transfering files by tablespace is tricky because a single database can * Transfering files by tablespace is tricky because a single database can
* use multiple tablespaces. For non-parallel mode, we just pass a NULL * use multiple tablespaces. For non-parallel mode, we just pass a NULL
* tablespace path, which matches all tablespaces. In parallel mode, we * tablespace path, which matches all tablespaces. In parallel mode, we
* pass the default tablespace and all user-created tablespaces and let * pass the default tablespace and all user-created tablespaces and let
* those operations happen in parallel. * those operations happen in parallel.
*/ */
@ -108,7 +108,7 @@ transfer_all_new_dbs(DbInfoArr *old_db_arr, DbInfoArr *new_db_arr,
if (new_dbnum >= new_db_arr->ndbs) if (new_dbnum >= new_db_arr->ndbs)
pg_fatal("old database \"%s\" not found in the new cluster\n", pg_fatal("old database \"%s\" not found in the new cluster\n",
old_db->db_name); old_db->db_name);
n_maps = 0; n_maps = 0;
mappings = gen_db_file_maps(old_db, new_db, &n_maps, old_pgdata, mappings = gen_db_file_maps(old_db, new_db, &n_maps, old_pgdata,
@ -135,7 +135,7 @@ transfer_all_new_dbs(DbInfoArr *old_db_arr, DbInfoArr *new_db_arr,
/* /*
* get_pg_database_relfilenode() * get_pg_database_relfilenode()
* *
* Retrieves the relfilenode for a few system-catalog tables. We need these * Retrieves the relfilenode for a few system-catalog tables. We need these
* relfilenodes later in the upgrade process. * relfilenodes later in the upgrade process.
*/ */
void void
@ -259,8 +259,8 @@ transfer_relfile(pageCnvCtx *pageConverter, FileNameMap *map,
return; return;
else else
pg_fatal("error while checking for file existence \"%s.%s\" (\"%s\" to \"%s\"): %s\n", pg_fatal("error while checking for file existence \"%s.%s\" (\"%s\" to \"%s\"): %s\n",
map->nspname, map->relname, old_file, new_file, map->nspname, map->relname, old_file, new_file,
getErrorText(errno)); getErrorText(errno));
} }
close(fd); close(fd);
} }
@ -272,7 +272,7 @@ transfer_relfile(pageCnvCtx *pageConverter, FileNameMap *map,
if ((user_opts.transfer_mode == TRANSFER_MODE_LINK) && (pageConverter != NULL)) if ((user_opts.transfer_mode == TRANSFER_MODE_LINK) && (pageConverter != NULL))
pg_fatal("This upgrade requires page-by-page conversion, " pg_fatal("This upgrade requires page-by-page conversion, "
"you must use copy mode instead of link mode.\n"); "you must use copy mode instead of link mode.\n");
if (user_opts.transfer_mode == TRANSFER_MODE_COPY) if (user_opts.transfer_mode == TRANSFER_MODE_COPY)
{ {
@ -280,7 +280,7 @@ transfer_relfile(pageCnvCtx *pageConverter, FileNameMap *map,
if ((msg = copyAndUpdateFile(pageConverter, old_file, new_file, true)) != NULL) if ((msg = copyAndUpdateFile(pageConverter, old_file, new_file, true)) != NULL)
pg_fatal("error while copying relation \"%s.%s\" (\"%s\" to \"%s\"): %s\n", pg_fatal("error while copying relation \"%s.%s\" (\"%s\" to \"%s\"): %s\n",
map->nspname, map->relname, old_file, new_file, msg); map->nspname, map->relname, old_file, new_file, msg);
} }
else else
{ {
@ -288,7 +288,7 @@ transfer_relfile(pageCnvCtx *pageConverter, FileNameMap *map,
if ((msg = linkAndUpdateFile(pageConverter, old_file, new_file)) != NULL) if ((msg = linkAndUpdateFile(pageConverter, old_file, new_file)) != NULL)
pg_fatal("error while creating link for relation \"%s.%s\" (\"%s\" to \"%s\"): %s\n", pg_fatal("error while creating link for relation \"%s.%s\" (\"%s\" to \"%s\"): %s\n",
map->nspname, map->relname, old_file, new_file, msg); map->nspname, map->relname, old_file, new_file, msg);
} }
} }

View File

@ -240,28 +240,26 @@ start_postmaster(ClusterInfo *cluster, bool throw_error)
return false; return false;
/* /*
* We set this here to make sure atexit() shuts down the server, * We set this here to make sure atexit() shuts down the server, but only
* but only if we started the server successfully. We do it * if we started the server successfully. We do it before checking for
* before checking for connectivity in case the server started but * connectivity in case the server started but there is a connectivity
* there is a connectivity failure. If pg_ctl did not return success, * failure. If pg_ctl did not return success, we will exit below.
* we will exit below.
* *
* Pre-9.1 servers do not have PQping(), so we could be leaving the server * Pre-9.1 servers do not have PQping(), so we could be leaving the server
* running if authentication was misconfigured, so someday we might went to * running if authentication was misconfigured, so someday we might went
* be more aggressive about doing server shutdowns even if pg_ctl fails, * to be more aggressive about doing server shutdowns even if pg_ctl
* but now (2013-08-14) it seems prudent to be cautious. We don't want to * fails, but now (2013-08-14) it seems prudent to be cautious. We don't
* shutdown a server that might have been accidentally started during the * want to shutdown a server that might have been accidentally started
* upgrade. * during the upgrade.
*/ */
if (pg_ctl_return) if (pg_ctl_return)
os_info.running_cluster = cluster; os_info.running_cluster = cluster;
/* /*
* pg_ctl -w might have failed because the server couldn't be started, * pg_ctl -w might have failed because the server couldn't be started, or
* or there might have been a connection problem in _checking_ if the * there might have been a connection problem in _checking_ if the server
* server has started. Therefore, even if pg_ctl failed, we continue * has started. Therefore, even if pg_ctl failed, we continue and test
* and test for connectivity in case we get a connection reason for the * for connectivity in case we get a connection reason for the failure.
* failure.
*/ */
if ((conn = get_db_conn(cluster, "template1")) == NULL || if ((conn = get_db_conn(cluster, "template1")) == NULL ||
PQstatus(conn) != CONNECTION_OK) PQstatus(conn) != CONNECTION_OK)
@ -271,18 +269,19 @@ start_postmaster(ClusterInfo *cluster, bool throw_error)
if (conn) if (conn)
PQfinish(conn); PQfinish(conn);
pg_fatal("could not connect to %s postmaster started with the command:\n" pg_fatal("could not connect to %s postmaster started with the command:\n"
"%s\n", "%s\n",
CLUSTER_NAME(cluster), cmd); CLUSTER_NAME(cluster), cmd);
} }
PQfinish(conn); PQfinish(conn);
/* /*
* If pg_ctl failed, and the connection didn't fail, and throw_error is * If pg_ctl failed, and the connection didn't fail, and throw_error is
* enabled, fail now. This could happen if the server was already running. * enabled, fail now. This could happen if the server was already
* running.
*/ */
if (!pg_ctl_return) if (!pg_ctl_return)
pg_fatal("pg_ctl failed to start the %s server, or connection failed\n", pg_fatal("pg_ctl failed to start the %s server, or connection failed\n",
CLUSTER_NAME(cluster)); CLUSTER_NAME(cluster));
return true; return true;
} }
@ -340,7 +339,7 @@ check_pghost_envvar(void)
(strcmp(value, "localhost") != 0 && strcmp(value, "127.0.0.1") != 0 && (strcmp(value, "localhost") != 0 && strcmp(value, "127.0.0.1") != 0 &&
strcmp(value, "::1") != 0 && value[0] != '/')) strcmp(value, "::1") != 0 && value[0] != '/'))
pg_fatal("libpq environment variable %s has a non-local server value: %s\n", pg_fatal("libpq environment variable %s has a non-local server value: %s\n",
option->envvar, value); option->envvar, value);
} }
} }

View File

@ -28,7 +28,7 @@ init_tablespaces(void)
if (os_info.num_old_tablespaces > 0 && if (os_info.num_old_tablespaces > 0 &&
strcmp(old_cluster.tablespace_suffix, new_cluster.tablespace_suffix) == 0) strcmp(old_cluster.tablespace_suffix, new_cluster.tablespace_suffix) == 0)
pg_fatal("Cannot upgrade to/from the same system catalog version when\n" pg_fatal("Cannot upgrade to/from the same system catalog version when\n"
"using tablespaces.\n"); "using tablespaces.\n");
} }
@ -78,10 +78,9 @@ get_tablespace_paths(void)
* Effectively, this is checking only for tables/indexes in * Effectively, this is checking only for tables/indexes in
* non-existent tablespace directories. Databases located in * non-existent tablespace directories. Databases located in
* non-existent tablespaces already throw a backend error. * non-existent tablespaces already throw a backend error.
* Non-existent tablespace directories can occur when a data * Non-existent tablespace directories can occur when a data directory
* directory that contains user tablespaces is moved as part * that contains user tablespaces is moved as part of pg_upgrade
* of pg_upgrade preparation and the symbolic links are not * preparation and the symbolic links are not updated.
* updated.
*/ */
if (stat(os_info.old_tablespaces[tblnum], &statBuf) != 0) if (stat(os_info.old_tablespaces[tblnum], &statBuf) != 0)
{ {
@ -91,13 +90,13 @@ get_tablespace_paths(void)
os_info.old_tablespaces[tblnum]); os_info.old_tablespaces[tblnum]);
else else
report_status(PG_FATAL, report_status(PG_FATAL,
"cannot stat() tablespace directory \"%s\": %s\n", "cannot stat() tablespace directory \"%s\": %s\n",
os_info.old_tablespaces[tblnum], getErrorText(errno)); os_info.old_tablespaces[tblnum], getErrorText(errno));
} }
if (!S_ISDIR(statBuf.st_mode)) if (!S_ISDIR(statBuf.st_mode))
report_status(PG_FATAL, report_status(PG_FATAL,
"tablespace path \"%s\" is not a directory\n", "tablespace path \"%s\" is not a directory\n",
os_info.old_tablespaces[tblnum]); os_info.old_tablespaces[tblnum]);
} }
PQclear(res); PQclear(res);

View File

@ -82,7 +82,7 @@ prep_status(const char *fmt,...)
static static
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 0))) __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 0)))
void void
pg_log_v(eLogType type, const char *fmt, va_list ap) pg_log_v(eLogType type, const char *fmt, va_list ap)
{ {
@ -280,7 +280,7 @@ pg_putenv(const char *var, const char *val)
/* /*
* Do not free envstr because it becomes part of the environment on * Do not free envstr because it becomes part of the environment on
* some operating systems. See port/unsetenv.c::unsetenv. * some operating systems. See port/unsetenv.c::unsetenv.
*/ */
#else #else
SetEnvironmentVariableA(var, val); SetEnvironmentVariableA(var, val);

View File

@ -98,10 +98,10 @@ old_8_3_check_for_name_data_type_usage(ClusterInfo *cluster)
pg_log(PG_REPORT, "fatal\n"); pg_log(PG_REPORT, "fatal\n");
pg_fatal("Your installation contains the \"name\" data type in user tables. This\n" pg_fatal("Your installation contains the \"name\" data type in user tables. This\n"
"data type changed its internal alignment between your old and new\n" "data type changed its internal alignment between your old and new\n"
"clusters so this cluster cannot currently be upgraded. You can remove\n" "clusters so this cluster cannot currently be upgraded. You can remove\n"
"the problem tables and restart the upgrade. A list of the problem\n" "the problem tables and restart the upgrade. A list of the problem\n"
"columns is in the file:\n" "columns is in the file:\n"
" %s\n\n", output_path); " %s\n\n", output_path);
} }
else else
check_ok(); check_ok();
@ -187,11 +187,11 @@ old_8_3_check_for_tsquery_usage(ClusterInfo *cluster)
{ {
pg_log(PG_REPORT, "fatal\n"); pg_log(PG_REPORT, "fatal\n");
pg_fatal("Your installation contains the \"tsquery\" data type. This data type\n" pg_fatal("Your installation contains the \"tsquery\" data type. This data type\n"
"added a new internal field between your old and new clusters so this\n" "added a new internal field between your old and new clusters so this\n"
"cluster cannot currently be upgraded. You can remove the problem\n" "cluster cannot currently be upgraded. You can remove the problem\n"
"columns and restart the upgrade. A list of the problem columns is in the\n" "columns and restart the upgrade. A list of the problem columns is in the\n"
"file:\n" "file:\n"
" %s\n\n", output_path); " %s\n\n", output_path);
} }
else else
check_ok(); check_ok();
@ -242,7 +242,7 @@ old_8_3_check_ltree_usage(ClusterInfo *cluster)
found = true; found = true;
if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL) if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
pg_fatal("Could not open file \"%s\": %s\n", pg_fatal("Could not open file \"%s\": %s\n",
output_path, getErrorText(errno)); output_path, getErrorText(errno));
if (!db_used) if (!db_used)
{ {
fprintf(script, "Database: %s\n", active_db->db_name); fprintf(script, "Database: %s\n", active_db->db_name);
@ -265,12 +265,12 @@ old_8_3_check_ltree_usage(ClusterInfo *cluster)
{ {
pg_log(PG_REPORT, "fatal\n"); pg_log(PG_REPORT, "fatal\n");
pg_fatal("Your installation contains the \"ltree\" data type. This data type\n" pg_fatal("Your installation contains the \"ltree\" data type. This data type\n"
"changed its internal storage format between your old and new clusters so this\n" "changed its internal storage format between your old and new clusters so this\n"
"cluster cannot currently be upgraded. You can manually upgrade databases\n" "cluster cannot currently be upgraded. You can manually upgrade databases\n"
"that use \"contrib/ltree\" facilities and remove \"contrib/ltree\" from the old\n" "that use \"contrib/ltree\" facilities and remove \"contrib/ltree\" from the old\n"
"cluster and restart the upgrade. A list of the problem functions is in the\n" "cluster and restart the upgrade. A list of the problem functions is in the\n"
"file:\n" "file:\n"
" %s\n\n", output_path); " %s\n\n", output_path);
} }
else else
check_ok(); check_ok();

View File

@ -41,7 +41,7 @@ timestamptz_to_time_t(TimestampTz t)
/* /*
* Stopgap implementation of timestamptz_to_str that doesn't depend on backend * Stopgap implementation of timestamptz_to_str that doesn't depend on backend
* infrastructure. This will work for timestamps that are within the range * infrastructure. This will work for timestamps that are within the range
* of the platform time_t type. (pg_time_t is compatible except for possibly * of the platform time_t type. (pg_time_t is compatible except for possibly
* being wider.) * being wider.)
* *

View File

@ -704,7 +704,7 @@ main(int argc, char **argv)
break; break;
else else
{ {
pg_usleep(1000000L); /* 1 second */ pg_usleep(1000000L); /* 1 second */
continue; continue;
} }
} }

View File

@ -162,9 +162,11 @@ bool use_log; /* log transaction latencies to a file */
bool use_quiet; /* quiet logging onto stderr */ bool use_quiet; /* quiet logging onto stderr */
int agg_interval; /* log aggregates instead of individual int agg_interval; /* log aggregates instead of individual
* transactions */ * transactions */
int progress = 0; /* thread progress report every this seconds */ int progress = 0; /* thread progress report every this seconds */
int progress_nclients = 0; /* number of clients for progress report */ int progress_nclients = 0; /* number of clients for progress
int progress_nthreads = 0; /* number of threads for progress report */ * report */
int progress_nthreads = 0; /* number of threads for progress
* report */
bool is_connect; /* establish connection for each transaction */ bool is_connect; /* establish connection for each transaction */
bool is_latencies; /* report per-command latencies */ bool is_latencies; /* report per-command latencies */
int main_pid; /* main process id used in log filename */ int main_pid; /* main process id used in log filename */
@ -201,7 +203,7 @@ typedef struct
int listen; /* 0 indicates that an async query has been int listen; /* 0 indicates that an async query has been
* sent */ * sent */
int sleeping; /* 1 indicates that the client is napping */ int sleeping; /* 1 indicates that the client is napping */
bool throttling; /* whether nap is for throttling */ bool throttling; /* whether nap is for throttling */
int64 until; /* napping until (usec) */ int64 until; /* napping until (usec) */
Variable *variables; /* array of variable definitions */ Variable *variables; /* array of variable definitions */
int nvariables; int nvariables;
@ -227,9 +229,9 @@ typedef struct
instr_time *exec_elapsed; /* time spent executing cmds (per Command) */ instr_time *exec_elapsed; /* time spent executing cmds (per Command) */
int *exec_count; /* number of cmd executions (per Command) */ int *exec_count; /* number of cmd executions (per Command) */
unsigned short random_state[3]; /* separate randomness for each thread */ unsigned short random_state[3]; /* separate randomness for each thread */
int64 throttle_trigger; /* previous/next throttling (us) */ int64 throttle_trigger; /* previous/next throttling (us) */
int64 throttle_lag; /* total transaction lag behind throttling */ int64 throttle_lag; /* total transaction lag behind throttling */
int64 throttle_lag_max; /* max transaction lag */ int64 throttle_lag_max; /* max transaction lag */
} TState; } TState;
#define INVALID_THREAD ((pthread_t) 0) #define INVALID_THREAD ((pthread_t) 0)
@ -240,8 +242,8 @@ typedef struct
int xacts; int xacts;
int64 latencies; int64 latencies;
int64 sqlats; int64 sqlats;
int64 throttle_lag; int64 throttle_lag;
int64 throttle_lag_max; int64 throttle_lag_max;
} TResult; } TResult;
/* /*
@ -343,20 +345,20 @@ usage(void)
"\nInitialization options:\n" "\nInitialization options:\n"
" -i, --initialize invokes initialization mode\n" " -i, --initialize invokes initialization mode\n"
" -F, --fillfactor=NUM set fill factor\n" " -F, --fillfactor=NUM set fill factor\n"
" -n, --no-vacuum do not run VACUUM after initialization\n" " -n, --no-vacuum do not run VACUUM after initialization\n"
" -q, --quiet quiet logging (one message each 5 seconds)\n" " -q, --quiet quiet logging (one message each 5 seconds)\n"
" -s, --scale=NUM scaling factor\n" " -s, --scale=NUM scaling factor\n"
" --foreign-keys create foreign key constraints between tables\n" " --foreign-keys create foreign key constraints between tables\n"
" --index-tablespace=TABLESPACE\n" " --index-tablespace=TABLESPACE\n"
" create indexes in the specified tablespace\n" " create indexes in the specified tablespace\n"
" --tablespace=TABLESPACE create tables in the specified tablespace\n" " --tablespace=TABLESPACE create tables in the specified tablespace\n"
" --unlogged-tables create tables as unlogged tables\n" " --unlogged-tables create tables as unlogged tables\n"
"\nBenchmarking options:\n" "\nBenchmarking options:\n"
" -c, --client=NUM number of concurrent database clients (default: 1)\n" " -c, --client=NUM number of concurrent database clients (default: 1)\n"
" -C, --connect establish new connection for each transaction\n" " -C, --connect establish new connection for each transaction\n"
" -D, --define=VARNAME=VALUE\n" " -D, --define=VARNAME=VALUE\n"
" define variable for use by custom script\n" " define variable for use by custom script\n"
" -f, --file=FILENAME read transaction script from FILENAME\n" " -f, --file=FILENAME read transaction script from FILENAME\n"
" -j, --jobs=NUM number of threads (default: 1)\n" " -j, --jobs=NUM number of threads (default: 1)\n"
" -l, --log write transaction times to log file\n" " -l, --log write transaction times to log file\n"
" -M, --protocol=simple|extended|prepared\n" " -M, --protocol=simple|extended|prepared\n"
@ -365,20 +367,20 @@ usage(void)
" -N, --skip-some-updates skip updates of pgbench_tellers and pgbench_branches\n" " -N, --skip-some-updates skip updates of pgbench_tellers and pgbench_branches\n"
" -P, --progress=NUM show thread progress report every NUM seconds\n" " -P, --progress=NUM show thread progress report every NUM seconds\n"
" -r, --report-latencies report average latency per command\n" " -r, --report-latencies report average latency per command\n"
" -R, --rate=NUM target rate in transactions per second\n" " -R, --rate=NUM target rate in transactions per second\n"
" -s, --scale=NUM report this scale factor in output\n" " -s, --scale=NUM report this scale factor in output\n"
" -S, --select-only perform SELECT-only transactions\n" " -S, --select-only perform SELECT-only transactions\n"
" -t, --transactions=NUM number of transactions each client runs (default: 10)\n" " -t, --transactions=NUM number of transactions each client runs (default: 10)\n"
" -T, --time=NUM duration of benchmark test in seconds\n" " -T, --time=NUM duration of benchmark test in seconds\n"
" -v, --vacuum-all vacuum all four standard tables before tests\n" " -v, --vacuum-all vacuum all four standard tables before tests\n"
" --aggregate-interval=NUM aggregate data over NUM seconds\n" " --aggregate-interval=NUM aggregate data over NUM seconds\n"
" --sampling-rate=NUM fraction of transactions to log (e.g. 0.01 for 1%%)\n" " --sampling-rate=NUM fraction of transactions to log (e.g. 0.01 for 1%%)\n"
"\nCommon options:\n" "\nCommon options:\n"
" -d, --debug print debugging output\n" " -d, --debug print debugging output\n"
" -h, --host=HOSTNAME database server host or socket directory\n" " -h, --host=HOSTNAME database server host or socket directory\n"
" -p, --port=PORT database server port number\n" " -p, --port=PORT database server port number\n"
" -U, --username=USERNAME connect as specified database user\n" " -U, --username=USERNAME connect as specified database user\n"
" -V, --version output version information, then exit\n" " -V, --version output version information, then exit\n"
" -?, --help show this help, then exit\n" " -?, --help show this help, then exit\n"
"\n" "\n"
"Report bugs to <pgsql-bugs@postgresql.org>.\n", "Report bugs to <pgsql-bugs@postgresql.org>.\n",
@ -413,7 +415,7 @@ strtoint64(const char *str)
ptr++; ptr++;
/* /*
* Do an explicit check for INT64_MIN. Ugly though this is, it's * Do an explicit check for INT64_MIN. Ugly though this is, it's
* cleaner than trying to get the loop below to handle it portably. * cleaner than trying to get the loop below to handle it portably.
*/ */
if (strncmp(ptr, "9223372036854775808", 19) == 0) if (strncmp(ptr, "9223372036854775808", 19) == 0)
@ -907,34 +909,34 @@ doCustom(TState *thread, CState *st, instr_time *conn_time, FILE *logfile, AggVa
{ {
PGresult *res; PGresult *res;
Command **commands; Command **commands;
bool trans_needs_throttle = false; bool trans_needs_throttle = false;
top: top:
commands = sql_files[st->use_file]; commands = sql_files[st->use_file];
/* /*
* Handle throttling once per transaction by sleeping. It is simpler * Handle throttling once per transaction by sleeping. It is simpler to
* to do this here rather than at the end, because so much complicated * do this here rather than at the end, because so much complicated logic
* logic happens below when statements finish. * happens below when statements finish.
*/ */
if (throttle_delay && ! st->is_throttled) if (throttle_delay && !st->is_throttled)
{ {
/* /*
* Use inverse transform sampling to randomly generate a delay, such * Use inverse transform sampling to randomly generate a delay, such
* that the series of delays will approximate a Poisson distribution * that the series of delays will approximate a Poisson distribution
* centered on the throttle_delay time. * centered on the throttle_delay time.
* *
* 10000 implies a 9.2 (-log(1/10000)) to 0.0 (log 1) delay multiplier, * 10000 implies a 9.2 (-log(1/10000)) to 0.0 (log 1) delay
* and results in a 0.055 % target underestimation bias: * multiplier, and results in a 0.055 % target underestimation bias:
* *
* SELECT 1.0/AVG(-LN(i/10000.0)) FROM generate_series(1,10000) AS i; * SELECT 1.0/AVG(-LN(i/10000.0)) FROM generate_series(1,10000) AS i;
* = 1.000552717032611116335474 * = 1.000552717032611116335474
* *
* If transactions are too slow or a given wait is shorter than * If transactions are too slow or a given wait is shorter than a
* a transaction, the next transaction will start right away. * transaction, the next transaction will start right away.
*/ */
int64 wait = (int64) (throttle_delay * int64 wait = (int64) (throttle_delay *
1.00055271703 * -log(getrand(thread, 1, 10000)/10000.0)); 1.00055271703 * -log(getrand(thread, 1, 10000) / 10000.0));
thread->throttle_trigger += wait; thread->throttle_trigger += wait;
@ -943,14 +945,14 @@ top:
st->throttling = true; st->throttling = true;
st->is_throttled = true; st->is_throttled = true;
if (debug) if (debug)
fprintf(stderr, "client %d throttling "INT64_FORMAT" us\n", fprintf(stderr, "client %d throttling " INT64_FORMAT " us\n",
st->id, wait); st->id, wait);
} }
if (st->sleeping) if (st->sleeping)
{ /* are we sleeping? */ { /* are we sleeping? */
instr_time now; instr_time now;
int64 now_us; int64 now_us;
INSTR_TIME_SET_CURRENT(now); INSTR_TIME_SET_CURRENT(now);
now_us = INSTR_TIME_GET_MICROSEC(now); now_us = INSTR_TIME_GET_MICROSEC(now);
@ -960,7 +962,8 @@ top:
if (st->throttling) if (st->throttling)
{ {
/* Measure lag of throttled transaction relative to target */ /* Measure lag of throttled transaction relative to target */
int64 lag = now_us - st->until; int64 lag = now_us - st->until;
thread->throttle_lag += lag; thread->throttle_lag += lag;
if (lag > thread->throttle_lag_max) if (lag > thread->throttle_lag_max)
thread->throttle_lag_max = lag; thread->throttle_lag_max = lag;
@ -1011,6 +1014,7 @@ top:
INSTR_TIME_SUBTRACT(diff, st->txn_begin); INSTR_TIME_SUBTRACT(diff, st->txn_begin);
latency = INSTR_TIME_GET_MICROSEC(diff); latency = INSTR_TIME_GET_MICROSEC(diff);
st->txn_latencies += latency; st->txn_latencies += latency;
/* /*
* XXX In a long benchmark run of high-latency transactions, this * XXX In a long benchmark run of high-latency transactions, this
* int64 addition eventually overflows. For example, 100 threads * int64 addition eventually overflows. For example, 100 threads
@ -1174,14 +1178,16 @@ top:
st->use_file = (int) getrand(thread, 0, num_files - 1); st->use_file = (int) getrand(thread, 0, num_files - 1);
commands = sql_files[st->use_file]; commands = sql_files[st->use_file];
st->is_throttled = false; st->is_throttled = false;
/* /*
* No transaction is underway anymore, which means there is nothing * No transaction is underway anymore, which means there is
* to listen to right now. When throttling rate limits are active, * nothing to listen to right now. When throttling rate limits
* a sleep will happen next, as the next transaction starts. And * are active, a sleep will happen next, as the next transaction
* then in any case the next SQL command will set listen back to 1. * starts. And then in any case the next SQL command will set
* listen back to 1.
*/ */
st->listen = 0; st->listen = 0;
trans_needs_throttle = (throttle_delay>0); trans_needs_throttle = (throttle_delay > 0);
} }
} }
@ -1201,11 +1207,12 @@ top:
} }
/* /*
* This ensures that a throttling delay is inserted before proceeding * This ensures that a throttling delay is inserted before proceeding with
* with sql commands, after the first transaction. The first transaction * sql commands, after the first transaction. The first transaction
* throttling is performed when first entering doCustom. * throttling is performed when first entering doCustom.
*/ */
if (trans_needs_throttle) { if (trans_needs_throttle)
{
trans_needs_throttle = false; trans_needs_throttle = false;
goto top; goto top;
} }
@ -1553,12 +1560,12 @@ init(bool is_no_vacuum)
* Note: TPC-B requires at least 100 bytes per row, and the "filler" * Note: TPC-B requires at least 100 bytes per row, and the "filler"
* fields in these table declarations were intended to comply with that. * fields in these table declarations were intended to comply with that.
* The pgbench_accounts table complies with that because the "filler" * The pgbench_accounts table complies with that because the "filler"
* column is set to blank-padded empty string. But for all other tables the * column is set to blank-padded empty string. But for all other tables
* column defaults to NULL and so don't actually take any space. We could * the column defaults to NULL and so don't actually take any space. We
* fix that by giving them non-null default values. However, that would * could fix that by giving them non-null default values. However, that
* completely break comparability of pgbench results with prior versions. * would completely break comparability of pgbench results with prior
* Since pgbench has never pretended to be fully TPC-B compliant anyway, we * versions. Since pgbench has never pretended to be fully TPC-B compliant
* stick with the historical behavior. * anyway, we stick with the historical behavior.
*/ */
struct ddlinfo struct ddlinfo
{ {
@ -2209,8 +2216,9 @@ printResults(int ttype, int normal_xacts, int nclients,
if (throttle_delay || progress) if (throttle_delay || progress)
{ {
/* compute and show latency average and standard deviation */ /* compute and show latency average and standard deviation */
double latency = 0.001 * total_latencies / normal_xacts; double latency = 0.001 * total_latencies / normal_xacts;
double sqlat = (double) total_sqlats / normal_xacts; double sqlat = (double) total_sqlats / normal_xacts;
printf("latency average: %.3f ms\n" printf("latency average: %.3f ms\n"
"latency stddev: %.3f ms\n", "latency stddev: %.3f ms\n",
latency, 0.001 * sqrt(sqlat - 1000000.0 * latency * latency)); latency, 0.001 * sqrt(sqlat - 1000000.0 * latency * latency));
@ -2288,7 +2296,7 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
static struct option long_options[] = { static struct option long_options[] = {
/* systematic long/short named options*/ /* systematic long/short named options */
{"client", required_argument, NULL, 'c'}, {"client", required_argument, NULL, 'c'},
{"connect", no_argument, NULL, 'C'}, {"connect", no_argument, NULL, 'C'},
{"debug", no_argument, NULL, 'd'}, {"debug", no_argument, NULL, 'd'},
@ -2344,8 +2352,8 @@ main(int argc, char **argv)
int total_xacts = 0; int total_xacts = 0;
int64 total_latencies = 0; int64 total_latencies = 0;
int64 total_sqlats = 0; int64 total_sqlats = 0;
int64 throttle_lag = 0; int64 throttle_lag = 0;
int64 throttle_lag_max = 0; int64 throttle_lag_max = 0;
int i; int i;
@ -2550,23 +2558,24 @@ main(int argc, char **argv)
if (progress <= 0) if (progress <= 0)
{ {
fprintf(stderr, fprintf(stderr,
"thread progress delay (-P) must be positive (%s)\n", "thread progress delay (-P) must be positive (%s)\n",
optarg); optarg);
exit(1); exit(1);
} }
break; break;
case 'R': case 'R':
{
/* get a double from the beginning of option value */
double throttle_value = atof(optarg);
if (throttle_value <= 0.0)
{ {
fprintf(stderr, "invalid rate limit: %s\n", optarg); /* get a double from the beginning of option value */
exit(1); double throttle_value = atof(optarg);
if (throttle_value <= 0.0)
{
fprintf(stderr, "invalid rate limit: %s\n", optarg);
exit(1);
}
/* Invert rate limit into a time offset */
throttle_delay = (int64) (1000000.0 / throttle_value);
} }
/* Invert rate limit into a time offset */
throttle_delay = (int64) (1000000.0 / throttle_value);
}
break; break;
case 0: case 0:
/* This covers long options which take no argument. */ /* This covers long options which take no argument. */
@ -2963,11 +2972,15 @@ threadRun(void *arg)
int nstate = thread->nstate; int nstate = thread->nstate;
int remains = nstate; /* number of remaining clients */ int remains = nstate; /* number of remaining clients */
int i; int i;
/* for reporting progress: */ /* for reporting progress: */
int64 thread_start = INSTR_TIME_GET_MICROSEC(thread->start_time); int64 thread_start = INSTR_TIME_GET_MICROSEC(thread->start_time);
int64 last_report = thread_start; int64 last_report = thread_start;
int64 next_report = last_report + (int64) progress * 1000000; int64 next_report = last_report + (int64) progress * 1000000;
int64 last_count = 0, last_lats = 0, last_sqlats = 0, last_lags = 0; int64 last_count = 0,
last_lats = 0,
last_sqlats = 0,
last_lags = 0;
AggVals aggs; AggVals aggs;
@ -3073,7 +3086,7 @@ threadRun(void *arg)
st->con = NULL; st->con = NULL;
continue; continue;
} }
else /* just a nap from the script */ else /* just a nap from the script */
{ {
int this_usec; int this_usec;
@ -3160,19 +3173,27 @@ threadRun(void *arg)
/* each process reports its own progression */ /* each process reports its own progression */
if (progress) if (progress)
{ {
instr_time now_time; instr_time now_time;
int64 now; int64 now;
INSTR_TIME_SET_CURRENT(now_time); INSTR_TIME_SET_CURRENT(now_time);
now = INSTR_TIME_GET_MICROSEC(now_time); now = INSTR_TIME_GET_MICROSEC(now_time);
if (now >= next_report) if (now >= next_report)
{ {
/* generate and show report */ /* generate and show report */
int64 count = 0, lats = 0, sqlats = 0; int64 count = 0,
int64 lags = thread->throttle_lag; lats = 0,
int64 run = now - last_report; sqlats = 0;
double tps, total_run, latency, sqlat, stdev, lag; int64 lags = thread->throttle_lag;
int64 run = now - last_report;
double tps,
total_run,
latency,
sqlat,
stdev,
lag;
for (i = 0 ; i < nstate ; i++) for (i = 0; i < nstate; i++)
{ {
count += state[i].cnt; count += state[i].cnt;
lats += state[i].txn_latencies; lats += state[i].txn_latencies;
@ -3202,32 +3223,41 @@ threadRun(void *arg)
last_sqlats = sqlats; last_sqlats = sqlats;
last_lags = lags; last_lags = lags;
last_report = now; last_report = now;
next_report += (int64) progress * 1000000; next_report += (int64) progress *1000000;
} }
} }
#else #else
/* progress report by thread 0 for all threads */ /* progress report by thread 0 for all threads */
if (progress && thread->tid == 0) if (progress && thread->tid == 0)
{ {
instr_time now_time; instr_time now_time;
int64 now; int64 now;
INSTR_TIME_SET_CURRENT(now_time); INSTR_TIME_SET_CURRENT(now_time);
now = INSTR_TIME_GET_MICROSEC(now_time); now = INSTR_TIME_GET_MICROSEC(now_time);
if (now >= next_report) if (now >= next_report)
{ {
/* generate and show report */ /* generate and show report */
int64 count = 0, lats = 0, sqlats = 0, lags = 0; int64 count = 0,
int64 run = now - last_report; lats = 0,
double tps, total_run, latency, sqlat, lag, stdev; sqlats = 0,
lags = 0;
int64 run = now - last_report;
double tps,
total_run,
latency,
sqlat,
lag,
stdev;
for (i = 0 ; i < progress_nclients ; i++) for (i = 0; i < progress_nclients; i++)
{ {
count += state[i].cnt; count += state[i].cnt;
lats += state[i].txn_latencies; lats += state[i].txn_latencies;
sqlats += state[i].txn_sqlats; sqlats += state[i].txn_sqlats;
} }
for (i = 0 ; i < progress_nthreads ; i++) for (i = 0; i < progress_nthreads; i++)
lags += thread[i].throttle_lag; lags += thread[i].throttle_lag;
total_run = (now - thread_start) / 1000000.0; total_run = (now - thread_start) / 1000000.0;
@ -3253,10 +3283,10 @@ threadRun(void *arg)
last_sqlats = sqlats; last_sqlats = sqlats;
last_lags = lags; last_lags = lags;
last_report = now; last_report = now;
next_report += (int64) progress * 1000000; next_report += (int64) progress *1000000;
} }
} }
#endif /* PTHREAD_FORK_EMULATION */ #endif /* PTHREAD_FORK_EMULATION */
} }
done: done:

View File

@ -29,7 +29,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -9,7 +9,7 @@
* entirely in crypt_blowfish.c. * entirely in crypt_blowfish.c.
* *
* Put bcrypt generator also here as crypt-blowfish.c * Put bcrypt generator also here as crypt-blowfish.c
* may not be compiled always. -- marko * may not be compiled always. -- marko
*/ */
#include "postgres.h" #include "postgres.h"

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@ -53,7 +53,7 @@
/* /*
* There is some confusion about whether and how to carry forward * There is some confusion about whether and how to carry forward
* the state of the pools. Seems like original Fortuna does not * the state of the pools. Seems like original Fortuna does not
* do it, resetting hash after each request. I guess expecting * do it, resetting hash after each request. I guess expecting
* feeding to happen more often that requesting. This is absolutely * feeding to happen more often that requesting. This is absolutely
* unsuitable for pgcrypto, as nothing asynchronous happens here. * unsuitable for pgcrypto, as nothing asynchronous happens here.
@ -77,7 +77,7 @@
* How many pools. * How many pools.
* *
* Original Fortuna uses 32 pools, that means 32'th pool is * Original Fortuna uses 32 pools, that means 32'th pool is
* used not earlier than in 13th year. This is a waste in * used not earlier than in 13th year. This is a waste in
* pgcrypto, as we have very low-frequancy seeding. Here * pgcrypto, as we have very low-frequancy seeding. Here
* is preferable to have all entropy usable in reasonable time. * is preferable to have all entropy usable in reasonable time.
* *
@ -296,7 +296,7 @@ reseed(FState *st)
} }
/* /*
* Pick a random pool. This uses key bytes as random source. * Pick a random pool. This uses key bytes as random source.
*/ */
static unsigned static unsigned
get_rand_pool(FState *st) get_rand_pool(FState *st)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -21,7 +21,7 @@
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
@ -211,7 +211,7 @@ static int s_vcmp(mp_int a, int v);
static mp_digit s_uadd(mp_digit *da, mp_digit *db, mp_digit *dc, static mp_digit s_uadd(mp_digit *da, mp_digit *db, mp_digit *dc,
mp_size size_a, mp_size size_b); mp_size size_a, mp_size size_b);
/* Unsigned magnitude subtraction. Assumes dc is big enough. */ /* Unsigned magnitude subtraction. Assumes dc is big enough. */
static void s_usub(mp_digit *da, mp_digit *db, mp_digit *dc, static void s_usub(mp_digit *da, mp_digit *db, mp_digit *dc,
mp_size size_a, mp_size size_b); mp_size size_a, mp_size size_b);
@ -2275,7 +2275,7 @@ mp_error_string(mp_result res)
/* }}} */ /* }}} */
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* Private functions for internal use. These make assumptions. */ /* Private functions for internal use. These make assumptions. */
/* {{{ s_alloc(num) */ /* {{{ s_alloc(num) */

View File

@ -20,7 +20,7 @@
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -19,7 +19,7 @@
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -20,7 +20,7 @@
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@ -429,8 +429,8 @@ bf_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv)
/* /*
* Test if key len is supported. BF_set_key silently cut large keys and it * Test if key len is supported. BF_set_key silently cut large keys and it
* could be a problem when user transfer crypted data from one server * could be a problem when user transfer crypted data from one server to
* to another. * another.
*/ */
if (bf_is_strong == -1) if (bf_is_strong == -1)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@ -89,7 +89,7 @@ pgp_cfb_free(PGP_CFB *ctx)
} }
/* /*
* Data processing for normal CFB. (PGP_PKT_SYMENCRYPTED_DATA_MDC) * Data processing for normal CFB. (PGP_PKT_SYMENCRYPTED_DATA_MDC)
*/ */
static int static int
mix_encrypt_normal(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst) mix_encrypt_normal(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@ -146,7 +146,7 @@ bn_to_mpi(mpz_t *bn)
* *
* Until I research it further, I just mimic gpg behaviour. * Until I research it further, I just mimic gpg behaviour.
* It has a special mapping table, for values <= 5120, * It has a special mapping table, for values <= 5120,
* above that it uses 'arbitrary high number'. Following * above that it uses 'arbitrary high number'. Following
* algorihm hovers 10-70 bits above gpg values. And for * algorihm hovers 10-70 bits above gpg values. And for
* larger p, it uses gpg's algorihm. * larger p, it uses gpg's algorihm.
* *

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@ -81,7 +81,7 @@ bn_to_mpi(BIGNUM *bn)
* *
* Until I research it further, I just mimic gpg behaviour. * Until I research it further, I just mimic gpg behaviour.
* It has a special mapping table, for values <= 5120, * It has a special mapping table, for values <= 5120,
* above that it uses 'arbitrary high number'. Following * above that it uses 'arbitrary high number'. Following
* algorihm hovers 10-70 bits above gpg values. And for * algorihm hovers 10-70 bits above gpg values. And for
* larger p, it uses gpg's algorihm. * larger p, it uses gpg's algorihm.
* *

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@ -74,7 +74,7 @@ add_block_entropy(PX_MD *md, text *data)
} }
/* /*
* Mix user data into RNG. It is for user own interests to have * Mix user data into RNG. It is for user own interests to have
* RNG state shuffled. * RNG state shuffled.
*/ */
static void static void
@ -291,7 +291,7 @@ set_arg(PGP_Context *ctx, char *key, char *val,
} }
/* /*
* Find next word. Handle ',' and '=' as words. Skip whitespace. * Find next word. Handle ',' and '=' as words. Skip whitespace.
* Put word info into res_p, res_len. * Put word info into res_p, res_len.
* Returns ptr to next word. * Returns ptr to next word.
*/ */

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -17,7 +17,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -7,12 +7,12 @@
/* RIJNDAEL by Joan Daemen and Vincent Rijmen */ /* RIJNDAEL by Joan Daemen and Vincent Rijmen */
/* */ /* */
/* which is a candidate algorithm in the Advanced Encryption Standard */ /* which is a candidate algorithm in the Advanced Encryption Standard */
/* programme of the US National Institute of Standards and Technology. */ /* programme of the US National Institute of Standards and Technology. */
/* */ /* */
/* Copyright in this implementation is held by Dr B R Gladman but I */ /* Copyright in this implementation is held by Dr B R Gladman but I */
/* hereby give permission for its free direct or derivative use subject */ /* hereby give permission for its free direct or derivative use subject */
/* to acknowledgment of its origin and compliance with any conditions */ /* to acknowledgment of its origin and compliance with any conditions */
/* that the originators of the algorithm place on its exploitation. */ /* that the originators of the algorithm place on its exploitation. */
/* */ /* */
/* Dr Brian Gladman (gladman@seven77.demon.co.uk) 14th January 1999 */ /* Dr Brian Gladman (gladman@seven77.demon.co.uk) 14th January 1999 */
@ -188,7 +188,7 @@ gen_tabs(void)
/* rijndael specification is in big endian format with */ /* rijndael specification is in big endian format with */
/* bit 0 as the most significant bit. In the remainder */ /* bit 0 as the most significant bit. In the remainder */
/* of the specification the bits are numbered from the */ /* of the specification the bits are numbered from the */
/* least significant end of a byte. */ /* least significant end of a byte. */
for (i = 0; i < 256; ++i) for (i = 0; i < 256; ++i)
{ {

View File

@ -8,12 +8,12 @@
/* RIJNDAEL by Joan Daemen and Vincent Rijmen */ /* RIJNDAEL by Joan Daemen and Vincent Rijmen */
/* */ /* */
/* which is a candidate algorithm in the Advanced Encryption Standard */ /* which is a candidate algorithm in the Advanced Encryption Standard */
/* programme of the US National Institute of Standards and Technology. */ /* programme of the US National Institute of Standards and Technology. */
/* */ /* */
/* Copyright in this implementation is held by Dr B R Gladman but I */ /* Copyright in this implementation is held by Dr B R Gladman but I */
/* hereby give permission for its free direct or derivative use subject */ /* hereby give permission for its free direct or derivative use subject */
/* to acknowledgment of its origin and compliance with any conditions */ /* to acknowledgment of its origin and compliance with any conditions */
/* that the originators of the algorithm place on its exploitation. */ /* that the originators of the algorithm place on its exploitation. */
/* */ /* */
/* Dr Brian Gladman (gladman@seven77.demon.co.uk) 14th January 1999 */ /* Dr Brian Gladman (gladman@seven77.demon.co.uk) 14th January 1999 */

View File

@ -19,7 +19,7 @@
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -20,7 +20,7 @@
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -22,7 +22,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -23,7 +23,7 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

View File

@ -268,11 +268,11 @@ pgstatindex_impl(Relation rel, FunctionCallInfo fcinfo)
values[j++] = psprintf("%d", indexStat.version); values[j++] = psprintf("%d", indexStat.version);
values[j++] = psprintf("%d", indexStat.level); values[j++] = psprintf("%d", indexStat.level);
values[j++] = psprintf(INT64_FORMAT, values[j++] = psprintf(INT64_FORMAT,
(indexStat.root_pages + (indexStat.root_pages +
indexStat.leaf_pages + indexStat.leaf_pages +
indexStat.internal_pages + indexStat.internal_pages +
indexStat.deleted_pages + indexStat.deleted_pages +
indexStat.empty_pages) * BLCKSZ); indexStat.empty_pages) * BLCKSZ);
values[j++] = psprintf("%u", indexStat.root_blkno); values[j++] = psprintf("%u", indexStat.root_blkno);
values[j++] = psprintf(INT64_FORMAT, indexStat.internal_pages); values[j++] = psprintf(INT64_FORMAT, indexStat.internal_pages);
values[j++] = psprintf(INT64_FORMAT, indexStat.leaf_pages); values[j++] = psprintf(INT64_FORMAT, indexStat.leaf_pages);
@ -280,12 +280,12 @@ pgstatindex_impl(Relation rel, FunctionCallInfo fcinfo)
values[j++] = psprintf(INT64_FORMAT, indexStat.deleted_pages); values[j++] = psprintf(INT64_FORMAT, indexStat.deleted_pages);
if (indexStat.max_avail > 0) if (indexStat.max_avail > 0)
values[j++] = psprintf("%.2f", values[j++] = psprintf("%.2f",
100.0 - (double) indexStat.free_space / (double) indexStat.max_avail * 100.0); 100.0 - (double) indexStat.free_space / (double) indexStat.max_avail * 100.0);
else else
values[j++] = pstrdup("NaN"); values[j++] = pstrdup("NaN");
if (indexStat.leaf_pages > 0) if (indexStat.leaf_pages > 0)
values[j++] = psprintf("%.2f", values[j++] = psprintf("%.2f",
(double) indexStat.fragments / (double) indexStat.leaf_pages * 100.0); (double) indexStat.fragments / (double) indexStat.leaf_pages * 100.0);
else else
values[j++] = pstrdup("NaN"); values[j++] = pstrdup("NaN");

View File

@ -310,7 +310,7 @@ pgstat_heap(Relation rel, FunctionCallInfo fcinfo)
/* /*
* To avoid physically reading the table twice, try to do the * To avoid physically reading the table twice, try to do the
* free-space scan in parallel with the heap scan. However, * free-space scan in parallel with the heap scan. However,
* heap_getnext may find no tuples on a given page, so we cannot * heap_getnext may find no tuples on a given page, so we cannot
* simply examine the pages returned by the heap scan. * simply examine the pages returned by the heap scan.
*/ */

View File

@ -83,7 +83,7 @@ static void pgfdw_subxact_callback(SubXactEvent event,
* the right subtransaction nesting depth if we didn't do that already. * the right subtransaction nesting depth if we didn't do that already.
* *
* will_prep_stmt must be true if caller intends to create any prepared * will_prep_stmt must be true if caller intends to create any prepared
* statements. Since those don't go away automatically at transaction end * statements. Since those don't go away automatically at transaction end
* (not even on error), we need this flag to cue manual cleanup. * (not even on error), we need this flag to cue manual cleanup.
* *
* XXX Note that caching connections theoretically requires a mechanism to * XXX Note that caching connections theoretically requires a mechanism to
@ -152,7 +152,7 @@ GetConnection(ForeignServer *server, UserMapping *user,
/* /*
* If cache entry doesn't have a connection, we have to establish a new * If cache entry doesn't have a connection, we have to establish a new
* connection. (If connect_pg_server throws an error, the cache entry * connection. (If connect_pg_server throws an error, the cache entry
* will be left in a valid empty state.) * will be left in a valid empty state.)
*/ */
if (entry->conn == NULL) if (entry->conn == NULL)
@ -273,10 +273,10 @@ connect_pg_server(ForeignServer *server, UserMapping *user)
} }
/* /*
* For non-superusers, insist that the connstr specify a password. This * For non-superusers, insist that the connstr specify a password. This
* prevents a password from being picked up from .pgpass, a service file, * prevents a password from being picked up from .pgpass, a service file,
* the environment, etc. We don't want the postgres user's passwords * the environment, etc. We don't want the postgres user's passwords
* to be accessible to non-superusers. (See also dblink_connstr_check in * to be accessible to non-superusers. (See also dblink_connstr_check in
* contrib/dblink.) * contrib/dblink.)
*/ */
static void static void
@ -323,10 +323,10 @@ configure_remote_session(PGconn *conn)
/* /*
* Set remote timezone; this is basically just cosmetic, since all * Set remote timezone; this is basically just cosmetic, since all
* transmitted and returned timestamptzs should specify a zone explicitly * transmitted and returned timestamptzs should specify a zone explicitly
* anyway. However it makes the regression test outputs more predictable. * anyway. However it makes the regression test outputs more predictable.
* *
* We don't risk setting remote zone equal to ours, since the remote * We don't risk setting remote zone equal to ours, since the remote
* server might use a different timezone database. Instead, use UTC * server might use a different timezone database. Instead, use UTC
* (quoted, because very old servers are picky about case). * (quoted, because very old servers are picky about case).
*/ */
do_sql_command(conn, "SET timezone = 'UTC'"); do_sql_command(conn, "SET timezone = 'UTC'");

View File

@ -215,7 +215,7 @@ is_foreign_expr(PlannerInfo *root,
* We must check that the expression contains only node types we can deparse, * We must check that the expression contains only node types we can deparse,
* that all types/functions/operators are safe to send (which we approximate * that all types/functions/operators are safe to send (which we approximate
* as being built-in), and that all collations used in the expression derive * as being built-in), and that all collations used in the expression derive
* from Vars of the foreign table. Because of the latter, the logic is * from Vars of the foreign table. Because of the latter, the logic is
* pretty close to assign_collations_walker() in parse_collate.c, though we * pretty close to assign_collations_walker() in parse_collate.c, though we
* can assume here that the given expression is valid. * can assume here that the given expression is valid.
*/ */
@ -245,7 +245,7 @@ foreign_expr_walker(Node *node,
/* /*
* If the Var is from the foreign table, we consider its * If the Var is from the foreign table, we consider its
* collation (if any) safe to use. If it is from another * collation (if any) safe to use. If it is from another
* table, we treat its collation the same way as we would a * table, we treat its collation the same way as we would a
* Param's collation, ie it's not safe for it to have a * Param's collation, ie it's not safe for it to have a
* non-default collation. * non-default collation.
@ -371,7 +371,7 @@ foreign_expr_walker(Node *node,
/* /*
* Detect whether node is introducing a collation not derived * Detect whether node is introducing a collation not derived
* from a foreign Var. (If so, we just mark it unsafe for now * from a foreign Var. (If so, we just mark it unsafe for now
* rather than immediately returning false, since the parent * rather than immediately returning false, since the parent
* node might not care.) * node might not care.)
*/ */
@ -658,7 +658,7 @@ is_builtin(Oid oid)
/* /*
* Construct a simple SELECT statement that retrieves desired columns * Construct a simple SELECT statement that retrieves desired columns
* of the specified foreign table, and append it to "buf". The output * of the specified foreign table, and append it to "buf". The output
* contains just "SELECT ... FROM tablename". * contains just "SELECT ... FROM tablename".
* *
* We also create an integer List of the columns being retrieved, which is * We also create an integer List of the columns being retrieved, which is
@ -746,7 +746,7 @@ deparseTargetList(StringInfo buf,
} }
/* /*
* Add ctid if needed. We currently don't support retrieving any other * Add ctid if needed. We currently don't support retrieving any other
* system columns. * system columns.
*/ */
if (bms_is_member(SelfItemPointerAttributeNumber - FirstLowInvalidHeapAttributeNumber, if (bms_is_member(SelfItemPointerAttributeNumber - FirstLowInvalidHeapAttributeNumber,
@ -1447,7 +1447,7 @@ deparseArrayRef(ArrayRef *node, deparse_expr_cxt *context)
/* /*
* Deparse referenced array expression first. If that expression includes * Deparse referenced array expression first. If that expression includes
* a cast, we have to parenthesize to prevent the array subscript from * a cast, we have to parenthesize to prevent the array subscript from
* being taken as typename decoration. We can avoid that in the typical * being taken as typename decoration. We can avoid that in the typical
* case of subscripting a Var, but otherwise do it. * case of subscripting a Var, but otherwise do it.
*/ */
if (IsA(node->refexpr, Var)) if (IsA(node->refexpr, Var))
@ -1559,7 +1559,7 @@ deparseFuncExpr(FuncExpr *node, deparse_expr_cxt *context)
} }
/* /*
* Deparse given operator expression. To avoid problems around * Deparse given operator expression. To avoid problems around
* priority of operations, we always parenthesize the arguments. * priority of operations, we always parenthesize the arguments.
*/ */
static void static void
@ -1656,7 +1656,7 @@ deparseDistinctExpr(DistinctExpr *node, deparse_expr_cxt *context)
} }
/* /*
* Deparse given ScalarArrayOpExpr expression. To avoid problems * Deparse given ScalarArrayOpExpr expression. To avoid problems
* around priority of operations, we always parenthesize the arguments. * around priority of operations, we always parenthesize the arguments.
*/ */
static void static void
@ -1822,7 +1822,7 @@ printRemoteParam(int paramindex, Oid paramtype, int32 paramtypmod,
* This is used when we're just trying to EXPLAIN the remote query. * This is used when we're just trying to EXPLAIN the remote query.
* We don't have the actual value of the runtime parameter yet, and we don't * We don't have the actual value of the runtime parameter yet, and we don't
* want the remote planner to generate a plan that depends on such a value * want the remote planner to generate a plan that depends on such a value
* anyway. Thus, we can't do something simple like "$1::paramtype". * anyway. Thus, we can't do something simple like "$1::paramtype".
* Instead, we emit "((SELECT null::paramtype)::paramtype)". * Instead, we emit "((SELECT null::paramtype)::paramtype)".
* In all extant versions of Postgres, the planner will see that as an unknown * In all extant versions of Postgres, the planner will see that as an unknown
* constant value, which is what we want. This might need adjustment if we * constant value, which is what we want. This might need adjustment if we

View File

@ -266,7 +266,7 @@ is_libpq_option(const char *keyword)
/* /*
* Generate key-value arrays which include only libpq options from the * Generate key-value arrays which include only libpq options from the
* given list (which can contain any kind of options). Caller must have * given list (which can contain any kind of options). Caller must have
* allocated large-enough arrays. Returns number of options found. * allocated large-enough arrays. Returns number of options found.
*/ */
int int

View File

@ -90,7 +90,7 @@ typedef struct PgFdwRelationInfo
* 2) Integer list of attribute numbers retrieved by the SELECT * 2) Integer list of attribute numbers retrieved by the SELECT
* *
* These items are indexed with the enum FdwScanPrivateIndex, so an item * These items are indexed with the enum FdwScanPrivateIndex, so an item
* can be fetched with list_nth(). For example, to get the SELECT statement: * can be fetched with list_nth(). For example, to get the SELECT statement:
* sql = strVal(list_nth(fdw_private, FdwScanPrivateSelectSql)); * sql = strVal(list_nth(fdw_private, FdwScanPrivateSelectSql));
*/ */
enum FdwScanPrivateIndex enum FdwScanPrivateIndex
@ -424,8 +424,8 @@ postgresGetForeignRelSize(PlannerInfo *root,
/* /*
* If the table or the server is configured to use remote estimates, * If the table or the server is configured to use remote estimates,
* identify which user to do remote access as during planning. This * identify which user to do remote access as during planning. This
* should match what ExecCheckRTEPerms() does. If we fail due to lack of * should match what ExecCheckRTEPerms() does. If we fail due to lack of
* permissions, the query would have failed at runtime anyway. * permissions, the query would have failed at runtime anyway.
*/ */
if (fpinfo->use_remote_estimate) if (fpinfo->use_remote_estimate)
@ -447,7 +447,7 @@ postgresGetForeignRelSize(PlannerInfo *root,
/* /*
* Identify which attributes will need to be retrieved from the remote * Identify which attributes will need to be retrieved from the remote
* server. These include all attrs needed for joins or final output, plus * server. These include all attrs needed for joins or final output, plus
* all attrs used in the local_conds. (Note: if we end up using a * all attrs used in the local_conds. (Note: if we end up using a
* parameterized scan, it's possible that some of the join clauses will be * parameterized scan, it's possible that some of the join clauses will be
* sent to the remote and thus we wouldn't really need to retrieve the * sent to the remote and thus we wouldn't really need to retrieve the
@ -487,7 +487,7 @@ postgresGetForeignRelSize(PlannerInfo *root,
if (fpinfo->use_remote_estimate) if (fpinfo->use_remote_estimate)
{ {
/* /*
* Get cost/size estimates with help of remote server. Save the * Get cost/size estimates with help of remote server. Save the
* values in fpinfo so we don't need to do it again to generate the * values in fpinfo so we don't need to do it again to generate the
* basic foreign path. * basic foreign path.
*/ */
@ -757,7 +757,7 @@ postgresGetForeignPlan(PlannerInfo *root,
* remote-safety. * remote-safety.
* *
* Note: the join clauses we see here should be the exact same ones * Note: the join clauses we see here should be the exact same ones
* previously examined by postgresGetForeignPaths. Possibly it'd be worth * previously examined by postgresGetForeignPaths. Possibly it'd be worth
* passing forward the classification work done then, rather than * passing forward the classification work done then, rather than
* repeating it here. * repeating it here.
* *
@ -898,7 +898,7 @@ postgresBeginForeignScan(ForeignScanState *node, int eflags)
node->fdw_state = (void *) fsstate; node->fdw_state = (void *) fsstate;
/* /*
* Identify which user to do the remote access as. This should match what * Identify which user to do the remote access as. This should match what
* ExecCheckRTEPerms() does. * ExecCheckRTEPerms() does.
*/ */
rte = rt_fetch(fsplan->scan.scanrelid, estate->es_range_table); rte = rt_fetch(fsplan->scan.scanrelid, estate->es_range_table);
@ -962,7 +962,7 @@ postgresBeginForeignScan(ForeignScanState *node, int eflags)
* Prepare remote-parameter expressions for evaluation. (Note: in * Prepare remote-parameter expressions for evaluation. (Note: in
* practice, we expect that all these expressions will be just Params, so * practice, we expect that all these expressions will be just Params, so
* we could possibly do something more efficient than using the full * we could possibly do something more efficient than using the full
* expression-eval machinery for this. But probably there would be little * expression-eval machinery for this. But probably there would be little
* benefit, and it'd require postgres_fdw to know more than is desirable * benefit, and it'd require postgres_fdw to know more than is desirable
* about Param evaluation.) * about Param evaluation.)
*/ */
@ -1038,8 +1038,8 @@ postgresReScanForeignScan(ForeignScanState *node)
/* /*
* If any internal parameters affecting this node have changed, we'd * If any internal parameters affecting this node have changed, we'd
* better destroy and recreate the cursor. Otherwise, rewinding it should * better destroy and recreate the cursor. Otherwise, rewinding it should
* be good enough. If we've only fetched zero or one batch, we needn't * be good enough. If we've only fetched zero or one batch, we needn't
* even rewind the cursor, just rescan what we have. * even rewind the cursor, just rescan what we have.
*/ */
if (node->ss.ps.chgParam != NULL) if (node->ss.ps.chgParam != NULL)
@ -1145,9 +1145,9 @@ postgresAddForeignUpdateTargets(Query *parsetree,
* Note: currently, the plan tree generated for UPDATE/DELETE will always * Note: currently, the plan tree generated for UPDATE/DELETE will always
* include a ForeignScan that retrieves ctids (using SELECT FOR UPDATE) * include a ForeignScan that retrieves ctids (using SELECT FOR UPDATE)
* and then the ModifyTable node will have to execute individual remote * and then the ModifyTable node will have to execute individual remote
* UPDATE/DELETE commands. If there are no local conditions or joins * UPDATE/DELETE commands. If there are no local conditions or joins
* needed, it'd be better to let the scan node do UPDATE/DELETE RETURNING * needed, it'd be better to let the scan node do UPDATE/DELETE RETURNING
* and then do nothing at ModifyTable. Room for future optimization ... * and then do nothing at ModifyTable. Room for future optimization ...
*/ */
static List * static List *
postgresPlanForeignModify(PlannerInfo *root, postgresPlanForeignModify(PlannerInfo *root,
@ -1285,7 +1285,7 @@ postgresBeginForeignModify(ModifyTableState *mtstate,
fmstate->rel = rel; fmstate->rel = rel;
/* /*
* Identify which user to do the remote access as. This should match what * Identify which user to do the remote access as. This should match what
* ExecCheckRTEPerms() does. * ExecCheckRTEPerms() does.
*/ */
rte = rt_fetch(resultRelInfo->ri_RangeTableIndex, estate->es_range_table); rte = rt_fetch(resultRelInfo->ri_RangeTableIndex, estate->es_range_table);
@ -1850,7 +1850,7 @@ get_remote_estimate(const char *sql, PGconn *conn,
pgfdw_report_error(ERROR, res, conn, false, sql); pgfdw_report_error(ERROR, res, conn, false, sql);
/* /*
* Extract cost numbers for topmost plan node. Note we search for a * Extract cost numbers for topmost plan node. Note we search for a
* left paren from the end of the line to avoid being confused by * left paren from the end of the line to avoid being confused by
* other uses of parentheses. * other uses of parentheses.
*/ */
@ -1972,7 +1972,7 @@ create_cursor(ForeignScanState *node)
* Notice that we pass NULL for paramTypes, thus forcing the remote server * Notice that we pass NULL for paramTypes, thus forcing the remote server
* to infer types for all parameters. Since we explicitly cast every * to infer types for all parameters. Since we explicitly cast every
* parameter (see deparse.c), the "inference" is trivial and will produce * parameter (see deparse.c), the "inference" is trivial and will produce
* the desired result. This allows us to avoid assuming that the remote * the desired result. This allows us to avoid assuming that the remote
* server has the same OIDs we do for the parameters' types. * server has the same OIDs we do for the parameters' types.
* *
* We don't use a PG_TRY block here, so be careful not to throw error * We don't use a PG_TRY block here, so be careful not to throw error
@ -2081,7 +2081,7 @@ fetch_more_data(ForeignScanState *node)
* user-visible computations. * user-visible computations.
* *
* We use the equivalent of a function SET option to allow the settings to * We use the equivalent of a function SET option to allow the settings to
* persist only until the caller calls reset_transmission_modes(). If an * persist only until the caller calls reset_transmission_modes(). If an
* error is thrown in between, guc.c will take care of undoing the settings. * error is thrown in between, guc.c will take care of undoing the settings.
* *
* The return value is the nestlevel that must be passed to * The return value is the nestlevel that must be passed to
@ -2093,7 +2093,7 @@ set_transmission_modes(void)
int nestlevel = NewGUCNestLevel(); int nestlevel = NewGUCNestLevel();
/* /*
* The values set here should match what pg_dump does. See also * The values set here should match what pg_dump does. See also
* configure_remote_session in connection.c. * configure_remote_session in connection.c.
*/ */
if (DateStyle != USE_ISO_DATES) if (DateStyle != USE_ISO_DATES)
@ -2299,7 +2299,7 @@ postgresAnalyzeForeignTable(Relation relation,
*func = postgresAcquireSampleRowsFunc; *func = postgresAcquireSampleRowsFunc;
/* /*
* Now we have to get the number of pages. It's annoying that the ANALYZE * Now we have to get the number of pages. It's annoying that the ANALYZE
* API requires us to return that now, because it forces some duplication * API requires us to return that now, because it forces some duplication
* of effort between this routine and postgresAcquireSampleRowsFunc. But * of effort between this routine and postgresAcquireSampleRowsFunc. But
* it's probably not worth redefining that API at this point. * it's probably not worth redefining that API at this point.
@ -2356,7 +2356,7 @@ postgresAnalyzeForeignTable(Relation relation,
* which must have at least targrows entries. * which must have at least targrows entries.
* The actual number of rows selected is returned as the function result. * The actual number of rows selected is returned as the function result.
* We also count the total number of rows in the table and return it into * We also count the total number of rows in the table and return it into
* *totalrows. Note that *totaldeadrows is always set to 0. * *totalrows. Note that *totaldeadrows is always set to 0.
* *
* Note that the returned list of rows is not always in order by physical * Note that the returned list of rows is not always in order by physical
* position in the table. Therefore, correlation estimates derived later * position in the table. Therefore, correlation estimates derived later
@ -2687,7 +2687,7 @@ make_tuple_from_result_row(PGresult *res,
/* /*
* Callback function which is called when error occurs during column value * Callback function which is called when error occurs during column value
* conversion. Print names of column and relation. * conversion. Print names of column and relation.
*/ */
static void static void
conversion_error_callback(void *arg) conversion_error_callback(void *arg)

View File

@ -106,7 +106,7 @@ sepgsql_get_client_label(void)
* sepgsql_set_client_label * sepgsql_set_client_label
* *
* This routine tries to switch the current security label of the client, and * This routine tries to switch the current security label of the client, and
* checks related permissions. The supplied new label shall be added to the * checks related permissions. The supplied new label shall be added to the
* client_label_pending list, then saved at transaction-commit time to ensure * client_label_pending list, then saved at transaction-commit time to ensure
* transaction-awareness. * transaction-awareness.
*/ */
@ -161,7 +161,7 @@ sepgsql_set_client_label(const char *new_label)
/* /*
* sepgsql_xact_callback * sepgsql_xact_callback
* *
* A callback routine of transaction commit/abort/prepare. Commmit or abort * A callback routine of transaction commit/abort/prepare. Commmit or abort
* changes in the client_label_pending list. * changes in the client_label_pending list.
*/ */
static void static void

View File

@ -142,7 +142,7 @@ sepgsql_avc_reclaim(void)
* Access control decisions must be atomic, but multiple system calls may * Access control decisions must be atomic, but multiple system calls may
* be required to make a decision; thus, when referencing the access vector * be required to make a decision; thus, when referencing the access vector
* cache, we must loop until we complete without an intervening cache flush * cache, we must loop until we complete without an intervening cache flush
* event. In practice, looping even once should be very rare. Callers should * event. In practice, looping even once should be very rare. Callers should
* do something like this: * do something like this:
* *
* sepgsql_avc_check_valid(); * sepgsql_avc_check_valid();

View File

@ -45,17 +45,17 @@ static EPlan *find_plan(char *ident, EPlan **eplan, int *nplans);
/* /*
* timetravel () -- * timetravel () --
* 1. IF an update affects tuple with stop_date eq INFINITY * 1. IF an update affects tuple with stop_date eq INFINITY
* then form (and return) new tuple with start_date eq current date * then form (and return) new tuple with start_date eq current date
* and stop_date eq INFINITY [ and update_user eq current user ] * and stop_date eq INFINITY [ and update_user eq current user ]
* and all other column values as in new tuple, and insert tuple * and all other column values as in new tuple, and insert tuple
* with old data and stop_date eq current date * with old data and stop_date eq current date
* ELSE - skip updation of tuple. * ELSE - skip updation of tuple.
* 2. IF an delete affects tuple with stop_date eq INFINITY * 2. IF an delete affects tuple with stop_date eq INFINITY
* then insert the same tuple with stop_date eq current date * then insert the same tuple with stop_date eq current date
* [ and delete_user eq current user ] * [ and delete_user eq current user ]
* ELSE - skip deletion of tuple. * ELSE - skip deletion of tuple.
* 3. On INSERT, if start_date is NULL then current date will be * 3. On INSERT, if start_date is NULL then current date will be
* inserted, if stop_date is NULL then INFINITY will be inserted. * inserted, if stop_date is NULL then INFINITY will be inserted.
* [ and insert_user eq current user, update_user and delete_user * [ and insert_user eq current user, update_user and delete_user
* eq NULL ] * eq NULL ]

View File

@ -123,7 +123,7 @@ ssl_client_serial(PG_FUNCTION_ARGS)
* current database encoding if possible. Any invalid characters are * current database encoding if possible. Any invalid characters are
* replaced by question marks. * replaced by question marks.
* *
* Parameter: str - OpenSSL ASN1_STRING structure. Memory management * Parameter: str - OpenSSL ASN1_STRING structure. Memory management
* of this structure is responsibility of caller. * of this structure is responsibility of caller.
* *
* Returns Datum, which can be directly returned from a C language SQL * Returns Datum, which can be directly returned from a C language SQL

View File

@ -49,7 +49,7 @@ strcpy_quoted(StringInfo r, const char *s, const char q)
* triggered_change_notification * triggered_change_notification
* *
* This trigger function will send a notification of data modification with * This trigger function will send a notification of data modification with
* primary key values. The channel will be "tcn" unless the trigger is * primary key values. The channel will be "tcn" unless the trigger is
* created with a parameter, in which case that parameter will be used. * created with a parameter, in which case that parameter will be used.
*/ */
PG_FUNCTION_INFO_V1(triggered_change_notification); PG_FUNCTION_INFO_V1(triggered_change_notification);

Some files were not shown because too many files have changed in this diff Show More