mirror of
https://github.com/postgres/postgres.git
synced 2025-04-20 00:42:27 +03:00
Initial pgindent run with pg_bsd_indent version 2.0.
The new indent version includes numerous fixes thanks to Piotr Stefaniak. The main changes visible in this commit are: * Nicer formatting of function-pointer declarations. * No longer unexpectedly removes spaces in expressions using casts, sizeof, or offsetof. * No longer wants to add a space in "struct structname *varname", as well as some similar cases for const- or volatile-qualified pointers. * Declarations using PG_USED_FOR_ASSERTS_ONLY are formatted more nicely. * Fixes bug where comments following declarations were sometimes placed with no space separating them from the code. * Fixes some odd decisions for comments following case labels. * Fixes some cases where comments following code were indented to less than the expected column 33. On the less good side, it now tends to put more whitespace around typedef names that are not listed in typedefs.list. This might encourage us to put more effort into typedef name collection; it's not really a bug in indent itself. There are more changes coming after this round, having to do with comment indentation and alignment of lines appearing within parentheses. I wanted to limit the size of the diffs to something that could be reviewed without one's eyes completely glazing over, so it seemed better to split up the changes as much as practical. Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
This commit is contained in:
parent
8ff6d4ec78
commit
e3860ffa4d
@ -75,7 +75,7 @@ _PG_init(void)
|
|||||||
bl_relopt_tab[i + 1].optname = MemoryContextStrdup(TopMemoryContext,
|
bl_relopt_tab[i + 1].optname = MemoryContextStrdup(TopMemoryContext,
|
||||||
buf);
|
buf);
|
||||||
bl_relopt_tab[i + 1].opttype = RELOPT_TYPE_INT;
|
bl_relopt_tab[i + 1].opttype = RELOPT_TYPE_INT;
|
||||||
bl_relopt_tab[i + 1].offset = offsetof(BloomOptions, bitSize[0]) +sizeof(int) * i;
|
bl_relopt_tab[i + 1].offset = offsetof(BloomOptions, bitSize[0]) + sizeof(int) * i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ gbt_var_key_readable(const GBT_VARKEY *k)
|
|||||||
* Create a leaf-entry to store in the index, from a single Datum.
|
* Create a leaf-entry to store in the index, from a single Datum.
|
||||||
*/
|
*/
|
||||||
static GBT_VARKEY *
|
static GBT_VARKEY *
|
||||||
gbt_var_key_from_datum(const struct varlena * u)
|
gbt_var_key_from_datum(const struct varlena *u)
|
||||||
{
|
{
|
||||||
int32 lowersize = VARSIZE(u);
|
int32 lowersize = VARSIZE(u);
|
||||||
GBT_VARKEY *r;
|
GBT_VARKEY *r;
|
||||||
|
@ -179,7 +179,7 @@ dblink_conn_not_avail(const char *conname)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
dblink_get_conn(char *conname_or_str,
|
dblink_get_conn(char *conname_or_str,
|
||||||
PGconn *volatile * conn_p, char **conname_p, volatile bool *freeconn_p)
|
PGconn *volatile *conn_p, char **conname_p, volatile bool *freeconn_p)
|
||||||
{
|
{
|
||||||
remoteConn *rconn = getConnectionByName(conname_or_str);
|
remoteConn *rconn = getConnectionByName(conname_or_str);
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
|
@ -389,7 +389,7 @@ _metaphone(char *word, /* IN */
|
|||||||
/*-- Allocate memory for our phoned_phrase --*/
|
/*-- Allocate memory for our phoned_phrase --*/
|
||||||
if (max_phonemes == 0)
|
if (max_phonemes == 0)
|
||||||
{ /* Assume largest possible */
|
{ /* Assume largest possible */
|
||||||
*phoned_word = palloc(sizeof(char) * strlen(word) +1);
|
*phoned_word = palloc(sizeof(char) * strlen(word) + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ void sql_exec_dumpalltbspc(PGconn *, struct options *);
|
|||||||
|
|
||||||
/* function to parse command line options and check for some usage errors. */
|
/* function to parse command line options and check for some usage errors. */
|
||||||
void
|
void
|
||||||
get_opts(int argc, char **argv, struct options * my_opts)
|
get_opts(int argc, char **argv, struct options *my_opts)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
const char *progname;
|
const char *progname;
|
||||||
@ -260,7 +260,7 @@ get_comma_elts(eary *eary)
|
|||||||
|
|
||||||
/* establish connection with database. */
|
/* establish connection with database. */
|
||||||
PGconn *
|
PGconn *
|
||||||
sql_conn(struct options * my_opts)
|
sql_conn(struct options *my_opts)
|
||||||
{
|
{
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
bool have_password = false;
|
bool have_password = false;
|
||||||
@ -411,7 +411,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)
|
||||||
{
|
{
|
||||||
char todo[1024];
|
char todo[1024];
|
||||||
|
|
||||||
@ -428,7 +428,7 @@ sql_exec_dumpalldbs(PGconn *conn, struct options * opts)
|
|||||||
* Dump all tables, indexes and sequences in the current database.
|
* Dump all tables, indexes and sequences in the current database.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
sql_exec_dumpalltables(PGconn *conn, struct options * opts)
|
sql_exec_dumpalltables(PGconn *conn, struct options *opts)
|
||||||
{
|
{
|
||||||
char todo[1024];
|
char todo[1024];
|
||||||
char *addfields = ",c.oid AS \"Oid\", nspname AS \"Schema\", spcname as \"Tablespace\" ";
|
char *addfields = ",c.oid AS \"Oid\", nspname AS \"Schema\", spcname as \"Tablespace\" ";
|
||||||
@ -460,7 +460,7 @@ sql_exec_dumpalltables(PGconn *conn, struct options * opts)
|
|||||||
* given objects in the current database.
|
* given objects in the current database.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
sql_exec_searchtables(PGconn *conn, struct options * opts)
|
sql_exec_searchtables(PGconn *conn, struct options *opts)
|
||||||
{
|
{
|
||||||
char *todo;
|
char *todo;
|
||||||
char *qualifiers,
|
char *qualifiers,
|
||||||
@ -530,7 +530,7 @@ sql_exec_searchtables(PGconn *conn, struct options * opts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sql_exec_dumpalltbspc(PGconn *conn, struct options * opts)
|
sql_exec_dumpalltbspc(PGconn *conn, struct options *opts)
|
||||||
{
|
{
|
||||||
char todo[1024];
|
char todo[1024];
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ generate_trgm(char *str, int slen)
|
|||||||
|
|
||||||
protect_out_of_mem(slen);
|
protect_out_of_mem(slen);
|
||||||
|
|
||||||
trg = (TRGM *) palloc(TRGMHDRSIZE + sizeof(trgm) * (slen / 2 + 1) *3);
|
trg = (TRGM *) palloc(TRGMHDRSIZE + sizeof(trgm) * (slen / 2 + 1) * 3);
|
||||||
trg->flag = ARRKEY;
|
trg->flag = ARRKEY;
|
||||||
|
|
||||||
len = generate_trgm_only(GETARR(trg), str, slen);
|
len = generate_trgm_only(GETARR(trg), str, slen);
|
||||||
@ -572,8 +572,8 @@ calc_word_similarity(char *str1, int slen1, char *str2, int slen2,
|
|||||||
protect_out_of_mem(slen1 + slen2);
|
protect_out_of_mem(slen1 + slen2);
|
||||||
|
|
||||||
/* Make positional trigrams */
|
/* Make positional trigrams */
|
||||||
trg1 = (trgm *) palloc(sizeof(trgm) * (slen1 / 2 + 1) *3);
|
trg1 = (trgm *) palloc(sizeof(trgm) * (slen1 / 2 + 1) * 3);
|
||||||
trg2 = (trgm *) palloc(sizeof(trgm) * (slen2 / 2 + 1) *3);
|
trg2 = (trgm *) palloc(sizeof(trgm) * (slen2 / 2 + 1) * 3);
|
||||||
|
|
||||||
len1 = generate_trgm_only(trg1, str1, slen1);
|
len1 = generate_trgm_only(trg1, str1, slen1);
|
||||||
len2 = generate_trgm_only(trg2, str2, slen2);
|
len2 = generate_trgm_only(trg2, str2, slen2);
|
||||||
@ -806,7 +806,7 @@ generate_wildcard_trgm(const char *str, int slen)
|
|||||||
|
|
||||||
protect_out_of_mem(slen);
|
protect_out_of_mem(slen);
|
||||||
|
|
||||||
trg = (TRGM *) palloc(TRGMHDRSIZE + sizeof(trgm) * (slen / 2 + 1) *3);
|
trg = (TRGM *) palloc(TRGMHDRSIZE + sizeof(trgm) * (slen / 2 + 1) * 3);
|
||||||
trg->flag = ARRKEY;
|
trg->flag = ARRKEY;
|
||||||
SET_VARSIZE(trg, TRGMHDRSIZE);
|
SET_VARSIZE(trg, TRGMHDRSIZE);
|
||||||
|
|
||||||
|
@ -481,7 +481,7 @@ collect_visibility_data(Oid relid, bool include_pd)
|
|||||||
check_relation_relkind(rel);
|
check_relation_relkind(rel);
|
||||||
|
|
||||||
nblocks = RelationGetNumberOfBlocks(rel);
|
nblocks = RelationGetNumberOfBlocks(rel);
|
||||||
info = palloc0(offsetof(vbits, bits) +nblocks);
|
info = palloc0(offsetof(vbits, bits) + nblocks);
|
||||||
info->next = 0;
|
info->next = 0;
|
||||||
info->count = nblocks;
|
info->count = nblocks;
|
||||||
|
|
||||||
|
@ -908,7 +908,7 @@ mp_int_sqr(mp_int a, mp_int c)
|
|||||||
CHECK(a != NULL && c != NULL);
|
CHECK(a != NULL && c != NULL);
|
||||||
|
|
||||||
/* Get a temporary buffer big enough to hold the result */
|
/* Get a temporary buffer big enough to hold the result */
|
||||||
osize = (mp_size) 4 *((MP_USED(a) + 1) / 2);
|
osize = (mp_size) 4 * ((MP_USED(a) + 1) / 2);
|
||||||
|
|
||||||
if (a == c)
|
if (a == c)
|
||||||
{
|
{
|
||||||
@ -3512,7 +3512,7 @@ s_outlen(mp_int z, mp_size r)
|
|||||||
double raw;
|
double raw;
|
||||||
|
|
||||||
bits = mp_int_count_bits(z);
|
bits = mp_int_count_bits(z);
|
||||||
raw = (double) bits *s_log2[r];
|
raw = (double) bits * s_log2[r];
|
||||||
|
|
||||||
return (int) (raw + 0.999999);
|
return (int) (raw + 0.999999);
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,7 @@ typedef struct mpz
|
|||||||
mp_size used;
|
mp_size used;
|
||||||
mp_sign sign;
|
mp_sign sign;
|
||||||
} mpz_t ,
|
} mpz_t ,
|
||||||
|
|
||||||
*mp_int;
|
*mp_int;
|
||||||
|
|
||||||
#define MP_DIGITS(Z) ((Z)->digits)
|
#define MP_DIGITS(Z) ((Z)->digits)
|
||||||
|
@ -318,7 +318,7 @@ rj_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
rj_real_init(struct int_ctx * cx, int dir)
|
rj_real_init(struct int_ctx *cx, int dir)
|
||||||
{
|
{
|
||||||
aes_set_key(&cx->ctx.rj, cx->keybuf, cx->keylen * 8, dir);
|
aes_set_key(&cx->ctx.rj, cx->keybuf, cx->keylen * 8, dir);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -460,7 +460,7 @@ mdcbuf_init(void **priv_p, void *arg, PullFilter *src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mdcbuf_finish(struct MDCBufData * st)
|
mdcbuf_finish(struct MDCBufData *st)
|
||||||
{
|
{
|
||||||
uint8 hash[20];
|
uint8 hash[20];
|
||||||
int res;
|
int res;
|
||||||
@ -485,7 +485,7 @@ mdcbuf_finish(struct MDCBufData * st)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mdcbuf_load_data(struct MDCBufData * st, uint8 *src, int len)
|
mdcbuf_load_data(struct MDCBufData *st, uint8 *src, int len)
|
||||||
{
|
{
|
||||||
uint8 *dst = st->pos + st->avail;
|
uint8 *dst = st->pos + st->avail;
|
||||||
|
|
||||||
@ -495,14 +495,14 @@ mdcbuf_load_data(struct MDCBufData * st, uint8 *src, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mdcbuf_load_mdc(struct MDCBufData * st, uint8 *src, int len)
|
mdcbuf_load_mdc(struct MDCBufData *st, uint8 *src, int len)
|
||||||
{
|
{
|
||||||
memmove(st->mdc_buf + st->mdc_avail, src, len);
|
memmove(st->mdc_buf + st->mdc_avail, src, len);
|
||||||
st->mdc_avail += len;
|
st->mdc_avail += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mdcbuf_refill(struct MDCBufData * st, PullFilter *src)
|
mdcbuf_refill(struct MDCBufData *st, PullFilter *src)
|
||||||
{
|
{
|
||||||
uint8 *data;
|
uint8 *data;
|
||||||
int res;
|
int res;
|
||||||
|
@ -132,7 +132,7 @@ struct debug_expect
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fill_expect(struct debug_expect * ex, int text_mode)
|
fill_expect(struct debug_expect *ex, int text_mode)
|
||||||
{
|
{
|
||||||
ex->debug = 0;
|
ex->debug = 0;
|
||||||
ex->expect = 0;
|
ex->expect = 0;
|
||||||
@ -157,7 +157,7 @@ fill_expect(struct debug_expect * ex, int text_mode)
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_expect(PGP_Context *ctx, struct debug_expect * ex)
|
check_expect(PGP_Context *ctx, struct debug_expect *ex)
|
||||||
{
|
{
|
||||||
EX_CHECK(cipher_algo);
|
EX_CHECK(cipher_algo);
|
||||||
EX_CHECK(s2k_mode);
|
EX_CHECK(s2k_mode);
|
||||||
@ -179,7 +179,7 @@ show_debug(const char *msg)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
set_arg(PGP_Context *ctx, char *key, char *val,
|
set_arg(PGP_Context *ctx, char *key, char *val,
|
||||||
struct debug_expect * ex)
|
struct debug_expect *ex)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
@ -317,7 +317,7 @@ downcase_convert(const uint8 *s, int len)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
parse_args(PGP_Context *ctx, uint8 *args, int arg_len,
|
parse_args(PGP_Context *ctx, uint8 *args, int arg_len,
|
||||||
struct debug_expect * ex)
|
struct debug_expect *ex)
|
||||||
{
|
{
|
||||||
char *str = downcase_convert(args, arg_len);
|
char *str = downcase_convert(args, arg_len);
|
||||||
char *key,
|
char *key,
|
||||||
@ -362,7 +362,7 @@ create_mbuf_from_vardata(text *data)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
init_work(PGP_Context **ctx_p, int is_text,
|
init_work(PGP_Context **ctx_p, int is_text,
|
||||||
text *args, struct debug_expect * ex)
|
text *args, struct debug_expect *ex)
|
||||||
{
|
{
|
||||||
int err = pgp_init(ctx_p);
|
int err = pgp_init(ctx_p);
|
||||||
|
|
||||||
|
@ -44,8 +44,7 @@ typedef struct _rijndael_ctx
|
|||||||
/* These are all based on 32 bit unsigned values and will therefore */
|
/* These are all based on 32 bit unsigned values and will therefore */
|
||||||
/* require endian conversions for big-endian architectures */
|
/* require endian conversions for big-endian architectures */
|
||||||
|
|
||||||
rijndael_ctx *
|
rijndael_ctx *rijndael_set_key(rijndael_ctx *, const u4byte *, const u4byte, int);
|
||||||
rijndael_set_key(rijndael_ctx *, const u4byte *, const u4byte, int);
|
|
||||||
void rijndael_encrypt(rijndael_ctx *, const u4byte *, u4byte *);
|
void rijndael_encrypt(rijndael_ctx *, const u4byte *, u4byte *);
|
||||||
void rijndael_decrypt(rijndael_ctx *, const u4byte *, u4byte *);
|
void rijndael_decrypt(rijndael_ctx *, const u4byte *, u4byte *);
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ do { \
|
|||||||
static void sha1_step(struct sha1_ctxt *);
|
static void sha1_step(struct sha1_ctxt *);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sha1_step(struct sha1_ctxt * ctxt)
|
sha1_step(struct sha1_ctxt *ctxt)
|
||||||
{
|
{
|
||||||
uint32 a,
|
uint32 a,
|
||||||
b,
|
b,
|
||||||
@ -226,7 +226,7 @@ sha1_step(struct sha1_ctxt * ctxt)
|
|||||||
/*------------------------------------------------------------*/
|
/*------------------------------------------------------------*/
|
||||||
|
|
||||||
void
|
void
|
||||||
sha1_init(struct sha1_ctxt * ctxt)
|
sha1_init(struct sha1_ctxt *ctxt)
|
||||||
{
|
{
|
||||||
memset(ctxt, 0, sizeof(struct sha1_ctxt));
|
memset(ctxt, 0, sizeof(struct sha1_ctxt));
|
||||||
H(0) = 0x67452301;
|
H(0) = 0x67452301;
|
||||||
@ -237,7 +237,7 @@ sha1_init(struct sha1_ctxt * ctxt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sha1_pad(struct sha1_ctxt * ctxt)
|
sha1_pad(struct sha1_ctxt *ctxt)
|
||||||
{
|
{
|
||||||
size_t padlen; /* pad length in bytes */
|
size_t padlen; /* pad length in bytes */
|
||||||
size_t padstart;
|
size_t padstart;
|
||||||
@ -280,7 +280,7 @@ sha1_pad(struct sha1_ctxt * ctxt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sha1_loop(struct sha1_ctxt * ctxt, const uint8 *input0, size_t len)
|
sha1_loop(struct sha1_ctxt *ctxt, const uint8 *input0, size_t len)
|
||||||
{
|
{
|
||||||
const uint8 *input;
|
const uint8 *input;
|
||||||
size_t gaplen;
|
size_t gaplen;
|
||||||
@ -308,7 +308,7 @@ sha1_loop(struct sha1_ctxt * ctxt, const uint8 *input0, size_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sha1_result(struct sha1_ctxt * ctxt, uint8 *digest0)
|
sha1_result(struct sha1_ctxt *ctxt, uint8 *digest0)
|
||||||
{
|
{
|
||||||
uint8 *digest;
|
uint8 *digest;
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ statapprox_heap(Relation rel, output_type *stat)
|
|||||||
UnlockReleaseBuffer(buf);
|
UnlockReleaseBuffer(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
stat->table_len = (uint64) nblocks *BLCKSZ;
|
stat->table_len = (uint64) nblocks * BLCKSZ;
|
||||||
|
|
||||||
stat->tuple_count = vac_estimate_reltuples(rel, false, nblocks, scanned,
|
stat->tuple_count = vac_estimate_reltuples(rel, false, nblocks, scanned,
|
||||||
stat->tuple_count + misc_count);
|
stat->tuple_count + misc_count);
|
||||||
|
@ -386,7 +386,7 @@ pgstat_heap(Relation rel, FunctionCallInfo fcinfo)
|
|||||||
heap_endscan(scan);
|
heap_endscan(scan);
|
||||||
relation_close(rel, AccessShareLock);
|
relation_close(rel, AccessShareLock);
|
||||||
|
|
||||||
stat.table_len = (uint64) nblocks *BLCKSZ;
|
stat.table_len = (uint64) nblocks * BLCKSZ;
|
||||||
|
|
||||||
return build_pgstattuple_type(&stat, fcinfo);
|
return build_pgstattuple_type(&stat, fcinfo);
|
||||||
}
|
}
|
||||||
@ -531,7 +531,7 @@ pgstat_index(Relation rel, BlockNumber start, pgstat_page pagefn,
|
|||||||
/* Quit if we've scanned the whole relation */
|
/* Quit if we've scanned the whole relation */
|
||||||
if (blkno >= nblocks)
|
if (blkno >= nblocks)
|
||||||
{
|
{
|
||||||
stat.table_len = (uint64) nblocks *BLCKSZ;
|
stat.table_len = (uint64) nblocks * BLCKSZ;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -721,7 +721,7 @@ quote_object_name(const char *src1, const char *src2,
|
|||||||
* catalog OID.
|
* catalog OID.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
exec_object_restorecon(struct selabel_handle * sehnd, Oid catalogId)
|
exec_object_restorecon(struct selabel_handle *sehnd, Oid catalogId)
|
||||||
{
|
{
|
||||||
Relation rel;
|
Relation rel;
|
||||||
SysScanDesc sscan;
|
SysScanDesc sscan;
|
||||||
|
@ -732,7 +732,7 @@ void
|
|||||||
sepgsql_compute_avd(const char *scontext,
|
sepgsql_compute_avd(const char *scontext,
|
||||||
const char *tcontext,
|
const char *tcontext,
|
||||||
uint16 tclass,
|
uint16 tclass,
|
||||||
struct av_decision * avd)
|
struct av_decision *avd)
|
||||||
{
|
{
|
||||||
const char *tclass_name;
|
const char *tclass_name;
|
||||||
security_class_t tclass_ex;
|
security_class_t tclass_ex;
|
||||||
|
@ -235,7 +235,7 @@ extern void sepgsql_audit_log(bool denied,
|
|||||||
extern void sepgsql_compute_avd(const char *scontext,
|
extern void sepgsql_compute_avd(const char *scontext,
|
||||||
const char *tcontext,
|
const char *tcontext,
|
||||||
uint16 tclass,
|
uint16 tclass,
|
||||||
struct av_decision * avd);
|
struct av_decision *avd);
|
||||||
|
|
||||||
extern char *sepgsql_compute_create(const char *scontext,
|
extern char *sepgsql_compute_create(const char *scontext,
|
||||||
const char *tcontext,
|
const char *tcontext,
|
||||||
|
@ -461,7 +461,7 @@ set_timetravel(PG_FUNCTION_ARGS)
|
|||||||
s = rname = DatumGetCString(DirectFunctionCall1(nameout, NameGetDatum(relname)));
|
s = rname = DatumGetCString(DirectFunctionCall1(nameout, NameGetDatum(relname)));
|
||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
pp = malloc(offsetof(TTOffList, name) +strlen(rname) + 1);
|
pp = malloc(offsetof(TTOffList, name) + strlen(rname) + 1);
|
||||||
if (pp)
|
if (pp)
|
||||||
{
|
{
|
||||||
pp->next = NULL;
|
pp->next = NULL;
|
||||||
|
@ -47,7 +47,7 @@ struct _param
|
|||||||
long transaction_limit;
|
long transaction_limit;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int vacuumlo(const char *database, const struct _param * param);
|
static int vacuumlo(const char *database, const struct _param *param);
|
||||||
static void usage(const char *progname);
|
static void usage(const char *progname);
|
||||||
|
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ static void usage(const char *progname);
|
|||||||
* This vacuums LOs of one database. It returns 0 on success, -1 on failure.
|
* This vacuums LOs of one database. It returns 0 on success, -1 on failure.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
vacuumlo(const char *database, const struct _param * param)
|
vacuumlo(const char *database, const struct _param *param)
|
||||||
{
|
{
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
PGresult *res,
|
PGresult *res,
|
||||||
|
@ -1321,33 +1321,33 @@ default_reloptions(Datum reloptions, bool validate, relopt_kind kind)
|
|||||||
static const relopt_parse_elt tab[] = {
|
static const relopt_parse_elt tab[] = {
|
||||||
{"fillfactor", RELOPT_TYPE_INT, offsetof(StdRdOptions, fillfactor)},
|
{"fillfactor", RELOPT_TYPE_INT, offsetof(StdRdOptions, fillfactor)},
|
||||||
{"autovacuum_enabled", RELOPT_TYPE_BOOL,
|
{"autovacuum_enabled", RELOPT_TYPE_BOOL,
|
||||||
offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, enabled)},
|
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, enabled)},
|
||||||
{"autovacuum_vacuum_threshold", RELOPT_TYPE_INT,
|
{"autovacuum_vacuum_threshold", RELOPT_TYPE_INT,
|
||||||
offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, vacuum_threshold)},
|
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_threshold)},
|
||||||
{"autovacuum_analyze_threshold", RELOPT_TYPE_INT,
|
{"autovacuum_analyze_threshold", RELOPT_TYPE_INT,
|
||||||
offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, analyze_threshold)},
|
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, analyze_threshold)},
|
||||||
{"autovacuum_vacuum_cost_delay", RELOPT_TYPE_INT,
|
{"autovacuum_vacuum_cost_delay", RELOPT_TYPE_INT,
|
||||||
offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, vacuum_cost_delay)},
|
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_cost_delay)},
|
||||||
{"autovacuum_vacuum_cost_limit", RELOPT_TYPE_INT,
|
{"autovacuum_vacuum_cost_limit", RELOPT_TYPE_INT,
|
||||||
offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, vacuum_cost_limit)},
|
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_cost_limit)},
|
||||||
{"autovacuum_freeze_min_age", RELOPT_TYPE_INT,
|
{"autovacuum_freeze_min_age", RELOPT_TYPE_INT,
|
||||||
offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, freeze_min_age)},
|
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, freeze_min_age)},
|
||||||
{"autovacuum_freeze_max_age", RELOPT_TYPE_INT,
|
{"autovacuum_freeze_max_age", RELOPT_TYPE_INT,
|
||||||
offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, freeze_max_age)},
|
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, freeze_max_age)},
|
||||||
{"autovacuum_freeze_table_age", RELOPT_TYPE_INT,
|
{"autovacuum_freeze_table_age", RELOPT_TYPE_INT,
|
||||||
offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, freeze_table_age)},
|
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, freeze_table_age)},
|
||||||
{"autovacuum_multixact_freeze_min_age", RELOPT_TYPE_INT,
|
{"autovacuum_multixact_freeze_min_age", RELOPT_TYPE_INT,
|
||||||
offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, multixact_freeze_min_age)},
|
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, multixact_freeze_min_age)},
|
||||||
{"autovacuum_multixact_freeze_max_age", RELOPT_TYPE_INT,
|
{"autovacuum_multixact_freeze_max_age", RELOPT_TYPE_INT,
|
||||||
offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, multixact_freeze_max_age)},
|
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, multixact_freeze_max_age)},
|
||||||
{"autovacuum_multixact_freeze_table_age", RELOPT_TYPE_INT,
|
{"autovacuum_multixact_freeze_table_age", RELOPT_TYPE_INT,
|
||||||
offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, multixact_freeze_table_age)},
|
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, multixact_freeze_table_age)},
|
||||||
{"log_autovacuum_min_duration", RELOPT_TYPE_INT,
|
{"log_autovacuum_min_duration", RELOPT_TYPE_INT,
|
||||||
offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, log_min_duration)},
|
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, log_min_duration)},
|
||||||
{"autovacuum_vacuum_scale_factor", RELOPT_TYPE_REAL,
|
{"autovacuum_vacuum_scale_factor", RELOPT_TYPE_REAL,
|
||||||
offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, vacuum_scale_factor)},
|
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_scale_factor)},
|
||||||
{"autovacuum_analyze_scale_factor", RELOPT_TYPE_REAL,
|
{"autovacuum_analyze_scale_factor", RELOPT_TYPE_REAL,
|
||||||
offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, analyze_scale_factor)},
|
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, analyze_scale_factor)},
|
||||||
{"user_catalog_table", RELOPT_TYPE_BOOL,
|
{"user_catalog_table", RELOPT_TYPE_BOOL,
|
||||||
offsetof(StdRdOptions, user_catalog_table)},
|
offsetof(StdRdOptions, user_catalog_table)},
|
||||||
{"parallel_workers", RELOPT_TYPE_INT,
|
{"parallel_workers", RELOPT_TYPE_INT,
|
||||||
|
@ -391,7 +391,7 @@ GinDataPageAddPostingItem(Page page, PostingItem *data, OffsetNumber offset)
|
|||||||
if (offset != maxoff + 1)
|
if (offset != maxoff + 1)
|
||||||
memmove(ptr + sizeof(PostingItem),
|
memmove(ptr + sizeof(PostingItem),
|
||||||
ptr,
|
ptr,
|
||||||
(maxoff - offset + 1) *sizeof(PostingItem));
|
(maxoff - offset + 1) * sizeof(PostingItem));
|
||||||
}
|
}
|
||||||
memcpy(ptr, data, sizeof(PostingItem));
|
memcpy(ptr, data, sizeof(PostingItem));
|
||||||
|
|
||||||
|
@ -149,11 +149,11 @@ typedef struct RewriteStateData
|
|||||||
bool rs_logical_rewrite; /* do we need to do logical rewriting */
|
bool rs_logical_rewrite; /* do we need to do logical rewriting */
|
||||||
TransactionId rs_oldest_xmin; /* oldest xmin used by caller to
|
TransactionId rs_oldest_xmin; /* oldest xmin used by caller to
|
||||||
* determine tuple visibility */
|
* determine tuple visibility */
|
||||||
TransactionId rs_freeze_xid;/* Xid that will be used as freeze cutoff
|
TransactionId rs_freeze_xid; /* Xid that will be used as freeze cutoff
|
||||||
* point */
|
* point */
|
||||||
TransactionId rs_logical_xmin; /* Xid that will be used as cutoff
|
TransactionId rs_logical_xmin; /* Xid that will be used as cutoff
|
||||||
* point for logical rewrites */
|
* point for logical rewrites */
|
||||||
MultiXactId rs_cutoff_multi;/* MultiXactId that will be used as cutoff
|
MultiXactId rs_cutoff_multi; /* MultiXactId that will be used as cutoff
|
||||||
* point for multixacts */
|
* point for multixacts */
|
||||||
MemoryContext rs_cxt; /* for hash tables and entries and tuples in
|
MemoryContext rs_cxt; /* for hash tables and entries and tuples in
|
||||||
* them */
|
* them */
|
||||||
|
@ -69,13 +69,13 @@ typedef struct toast_compress_header
|
|||||||
|
|
||||||
static void toast_delete_datum(Relation rel, Datum value, bool is_speculative);
|
static void toast_delete_datum(Relation rel, Datum value, bool is_speculative);
|
||||||
static Datum toast_save_datum(Relation rel, Datum value,
|
static Datum toast_save_datum(Relation rel, Datum value,
|
||||||
struct varlena * oldexternal, int options);
|
struct varlena *oldexternal, int options);
|
||||||
static bool toastrel_valueid_exists(Relation toastrel, Oid valueid);
|
static bool toastrel_valueid_exists(Relation toastrel, Oid valueid);
|
||||||
static bool toastid_valueid_exists(Oid toastrelid, Oid valueid);
|
static bool toastid_valueid_exists(Oid toastrelid, Oid valueid);
|
||||||
static struct varlena *toast_fetch_datum(struct varlena * attr);
|
static struct varlena *toast_fetch_datum(struct varlena *attr);
|
||||||
static struct varlena *toast_fetch_datum_slice(struct varlena * attr,
|
static struct varlena *toast_fetch_datum_slice(struct varlena *attr,
|
||||||
int32 sliceoffset, int32 length);
|
int32 sliceoffset, int32 length);
|
||||||
static struct varlena *toast_decompress_datum(struct varlena * attr);
|
static struct varlena *toast_decompress_datum(struct varlena *attr);
|
||||||
static int toast_open_indexes(Relation toastrel,
|
static int toast_open_indexes(Relation toastrel,
|
||||||
LOCKMODE lock,
|
LOCKMODE lock,
|
||||||
Relation **toastidxs,
|
Relation **toastidxs,
|
||||||
@ -98,7 +98,7 @@ static void init_toast_snapshot(Snapshot toast_snapshot);
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
struct varlena *
|
struct varlena *
|
||||||
heap_tuple_fetch_attr(struct varlena * attr)
|
heap_tuple_fetch_attr(struct varlena *attr)
|
||||||
{
|
{
|
||||||
struct varlena *result;
|
struct varlena *result;
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ heap_tuple_fetch_attr(struct varlena * attr)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
struct varlena *
|
struct varlena *
|
||||||
heap_tuple_untoast_attr(struct varlena * attr)
|
heap_tuple_untoast_attr(struct varlena *attr)
|
||||||
{
|
{
|
||||||
if (VARATT_IS_EXTERNAL_ONDISK(attr))
|
if (VARATT_IS_EXTERNAL_ONDISK(attr))
|
||||||
{
|
{
|
||||||
@ -255,7 +255,7 @@ heap_tuple_untoast_attr(struct varlena * attr)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
struct varlena *
|
struct varlena *
|
||||||
heap_tuple_untoast_attr_slice(struct varlena * attr,
|
heap_tuple_untoast_attr_slice(struct varlena *attr,
|
||||||
int32 sliceoffset, int32 slicelength)
|
int32 sliceoffset, int32 slicelength)
|
||||||
{
|
{
|
||||||
struct varlena *preslice;
|
struct varlena *preslice;
|
||||||
@ -1468,7 +1468,7 @@ toast_get_valid_index(Oid toastoid, LOCKMODE lock)
|
|||||||
*/
|
*/
|
||||||
static Datum
|
static Datum
|
||||||
toast_save_datum(Relation rel, Datum value,
|
toast_save_datum(Relation rel, Datum value,
|
||||||
struct varlena * oldexternal, int options)
|
struct varlena *oldexternal, int options)
|
||||||
{
|
{
|
||||||
Relation toastrel;
|
Relation toastrel;
|
||||||
Relation *toastidxs;
|
Relation *toastidxs;
|
||||||
@ -1873,7 +1873,7 @@ toastid_valueid_exists(Oid toastrelid, Oid valueid)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static struct varlena *
|
static struct varlena *
|
||||||
toast_fetch_datum(struct varlena * attr)
|
toast_fetch_datum(struct varlena *attr)
|
||||||
{
|
{
|
||||||
Relation toastrel;
|
Relation toastrel;
|
||||||
Relation *toastidxs;
|
Relation *toastidxs;
|
||||||
@ -2044,7 +2044,7 @@ toast_fetch_datum(struct varlena * attr)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static struct varlena *
|
static struct varlena *
|
||||||
toast_fetch_datum_slice(struct varlena * attr, int32 sliceoffset, int32 length)
|
toast_fetch_datum_slice(struct varlena *attr, int32 sliceoffset, int32 length)
|
||||||
{
|
{
|
||||||
Relation toastrel;
|
Relation toastrel;
|
||||||
Relation *toastidxs;
|
Relation *toastidxs;
|
||||||
@ -2276,7 +2276,7 @@ toast_fetch_datum_slice(struct varlena * attr, int32 sliceoffset, int32 length)
|
|||||||
* Decompress a compressed version of a varlena datum
|
* Decompress a compressed version of a varlena datum
|
||||||
*/
|
*/
|
||||||
static struct varlena *
|
static struct varlena *
|
||||||
toast_decompress_datum(struct varlena * attr)
|
toast_decompress_datum(struct varlena *attr)
|
||||||
{
|
{
|
||||||
struct varlena *result;
|
struct varlena *result;
|
||||||
|
|
||||||
|
@ -92,9 +92,9 @@ typedef enum
|
|||||||
typedef struct BTParallelScanDescData
|
typedef struct BTParallelScanDescData
|
||||||
{
|
{
|
||||||
BlockNumber btps_scanPage; /* latest or next page to be scanned */
|
BlockNumber btps_scanPage; /* latest or next page to be scanned */
|
||||||
BTPS_State btps_pageStatus;/* indicates whether next page is available
|
BTPS_State btps_pageStatus; /* indicates whether next page is
|
||||||
* for scan. see above for possible states of
|
* available for scan. see above for
|
||||||
* parallel scan. */
|
* possible states of parallel scan. */
|
||||||
int btps_arrayKeyCount; /* count indicating number of array
|
int btps_arrayKeyCount; /* count indicating number of array
|
||||||
* scan keys processed by parallel
|
* scan keys processed by parallel
|
||||||
* scan */
|
* scan */
|
||||||
|
@ -4893,7 +4893,7 @@ XLOGShmemInit(void)
|
|||||||
|
|
||||||
/* WAL insertion locks. Ensure they're aligned to the full padded size */
|
/* WAL insertion locks. Ensure they're aligned to the full padded size */
|
||||||
allocptr += sizeof(WALInsertLockPadded) -
|
allocptr += sizeof(WALInsertLockPadded) -
|
||||||
((uintptr_t) allocptr) %sizeof(WALInsertLockPadded);
|
((uintptr_t) allocptr) % sizeof(WALInsertLockPadded);
|
||||||
WALInsertLocks = XLogCtl->Insert.WALInsertLocks =
|
WALInsertLocks = XLogCtl->Insert.WALInsertLocks =
|
||||||
(WALInsertLockPadded *) allocptr;
|
(WALInsertLockPadded *) allocptr;
|
||||||
allocptr += sizeof(WALInsertLockPadded) * NUM_XLOGINSERT_LOCKS;
|
allocptr += sizeof(WALInsertLockPadded) * NUM_XLOGINSERT_LOCKS;
|
||||||
@ -8426,14 +8426,14 @@ LogCheckpointEnd(bool restartpoint)
|
|||||||
*/
|
*/
|
||||||
longest_secs = (long) (CheckpointStats.ckpt_longest_sync / 1000000);
|
longest_secs = (long) (CheckpointStats.ckpt_longest_sync / 1000000);
|
||||||
longest_usecs = CheckpointStats.ckpt_longest_sync -
|
longest_usecs = CheckpointStats.ckpt_longest_sync -
|
||||||
(uint64) longest_secs *1000000;
|
(uint64) longest_secs * 1000000;
|
||||||
|
|
||||||
average_sync_time = 0;
|
average_sync_time = 0;
|
||||||
if (CheckpointStats.ckpt_sync_rels > 0)
|
if (CheckpointStats.ckpt_sync_rels > 0)
|
||||||
average_sync_time = CheckpointStats.ckpt_agg_sync_time /
|
average_sync_time = CheckpointStats.ckpt_agg_sync_time /
|
||||||
CheckpointStats.ckpt_sync_rels;
|
CheckpointStats.ckpt_sync_rels;
|
||||||
average_secs = (long) (average_sync_time / 1000000);
|
average_secs = (long) (average_sync_time / 1000000);
|
||||||
average_usecs = average_sync_time - (uint64) average_secs *1000000;
|
average_usecs = average_sync_time - (uint64) average_secs * 1000000;
|
||||||
|
|
||||||
elog(LOG, "%s complete: wrote %d buffers (%.1f%%); "
|
elog(LOG, "%s complete: wrote %d buffers (%.1f%%); "
|
||||||
"%d WAL file(s) added, %d removed, %d recycled; "
|
"%d WAL file(s) added, %d removed, %d recycled; "
|
||||||
|
@ -80,9 +80,9 @@ typedef struct PartitionBoundInfoData
|
|||||||
int ndatums; /* Length of the datums following array */
|
int ndatums; /* Length of the datums following array */
|
||||||
Datum **datums; /* Array of datum-tuples with key->partnatts
|
Datum **datums; /* Array of datum-tuples with key->partnatts
|
||||||
* datums each */
|
* datums each */
|
||||||
RangeDatumContent **content;/* what's contained in each range bound datum?
|
RangeDatumContent **content; /* what's contained in each range bound
|
||||||
* (see the above enum); NULL for list
|
* datum? (see the above enum); NULL for
|
||||||
* partitioned tables */
|
* list partitioned tables */
|
||||||
int *indexes; /* Partition indexes; one entry per member of
|
int *indexes; /* Partition indexes; one entry per member of
|
||||||
* the datums array (plus one if range
|
* the datums array (plus one if range
|
||||||
* partitioned table) */
|
* partitioned table) */
|
||||||
|
@ -75,7 +75,8 @@ typedef struct ExtensionControlFile
|
|||||||
char *name; /* name of the extension */
|
char *name; /* name of the extension */
|
||||||
char *directory; /* directory for script files */
|
char *directory; /* directory for script files */
|
||||||
char *default_version; /* default install target version, if any */
|
char *default_version; /* default install target version, if any */
|
||||||
char *module_pathname; /* string to substitute for MODULE_PATHNAME */
|
char *module_pathname; /* string to substitute for
|
||||||
|
* MODULE_PATHNAME */
|
||||||
char *comment; /* comment, if any */
|
char *comment; /* comment, if any */
|
||||||
char *schema; /* target schema (allowed if !relocatable) */
|
char *schema; /* target schema (allowed if !relocatable) */
|
||||||
bool relocatable; /* is ALTER EXTENSION SET SCHEMA supported? */
|
bool relocatable; /* is ALTER EXTENSION SET SCHEMA supported? */
|
||||||
|
@ -3187,7 +3187,7 @@ AlterTableGetLockLevel(List *cmds)
|
|||||||
* might miss data added to the new toast table by concurrent
|
* might miss data added to the new toast table by concurrent
|
||||||
* insert transactions.
|
* insert transactions.
|
||||||
*/
|
*/
|
||||||
case AT_SetStorage:/* may add toast tables, see
|
case AT_SetStorage: /* may add toast tables, see
|
||||||
* ATRewriteCatalogs() */
|
* ATRewriteCatalogs() */
|
||||||
cmd_lockmode = AccessExclusiveLock;
|
cmd_lockmode = AccessExclusiveLock;
|
||||||
break;
|
break;
|
||||||
@ -3358,8 +3358,7 @@ AlterTableGetLockLevel(List *cmds)
|
|||||||
cmd_lockmode = AccessExclusiveLock;
|
cmd_lockmode = AccessExclusiveLock;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AT_ValidateConstraint: /* Uses MVCC in
|
case AT_ValidateConstraint: /* Uses MVCC in getConstraints() */
|
||||||
* getConstraints() */
|
|
||||||
cmd_lockmode = ShareUpdateExclusiveLock;
|
cmd_lockmode = ShareUpdateExclusiveLock;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3469,8 +3468,7 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
|
|||||||
/* Recursion occurs during execution phase */
|
/* Recursion occurs during execution phase */
|
||||||
pass = AT_PASS_ADD_COL;
|
pass = AT_PASS_ADD_COL;
|
||||||
break;
|
break;
|
||||||
case AT_AddColumnToView: /* add column via CREATE OR REPLACE
|
case AT_AddColumnToView: /* add column via CREATE OR REPLACE VIEW */
|
||||||
* VIEW */
|
|
||||||
ATSimplePermissions(rel, ATT_VIEW);
|
ATSimplePermissions(rel, ATT_VIEW);
|
||||||
ATPrepAddColumn(wqueue, rel, recurse, recursing, true, cmd,
|
ATPrepAddColumn(wqueue, rel, recurse, recursing, true, cmd,
|
||||||
lockmode);
|
lockmode);
|
||||||
@ -3813,8 +3811,7 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel,
|
|||||||
switch (cmd->subtype)
|
switch (cmd->subtype)
|
||||||
{
|
{
|
||||||
case AT_AddColumn: /* ADD COLUMN */
|
case AT_AddColumn: /* ADD COLUMN */
|
||||||
case AT_AddColumnToView: /* add column via CREATE OR REPLACE
|
case AT_AddColumnToView: /* add column via CREATE OR REPLACE VIEW */
|
||||||
* VIEW */
|
|
||||||
address = ATExecAddColumn(wqueue, tab, rel, (ColumnDef *) cmd->def,
|
address = ATExecAddColumn(wqueue, tab, rel, (ColumnDef *) cmd->def,
|
||||||
false, false, false,
|
false, false, false,
|
||||||
false, lockmode);
|
false, lockmode);
|
||||||
@ -3882,8 +3879,7 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel,
|
|||||||
ATExecAddConstraint(wqueue, tab, rel, (Constraint *) cmd->def,
|
ATExecAddConstraint(wqueue, tab, rel, (Constraint *) cmd->def,
|
||||||
true, false, lockmode);
|
true, false, lockmode);
|
||||||
break;
|
break;
|
||||||
case AT_ReAddConstraint: /* Re-add pre-existing check
|
case AT_ReAddConstraint: /* Re-add pre-existing check constraint */
|
||||||
* constraint */
|
|
||||||
address =
|
address =
|
||||||
ATExecAddConstraint(wqueue, tab, rel, (Constraint *) cmd->def,
|
ATExecAddConstraint(wqueue, tab, rel, (Constraint *) cmd->def,
|
||||||
true, true, lockmode);
|
true, true, lockmode);
|
||||||
|
@ -363,9 +363,9 @@ lazy_vacuum_rel(Relation onerel, int options, VacuumParams *params,
|
|||||||
write_rate = 0;
|
write_rate = 0;
|
||||||
if ((secs > 0) || (usecs > 0))
|
if ((secs > 0) || (usecs > 0))
|
||||||
{
|
{
|
||||||
read_rate = (double) BLCKSZ *VacuumPageMiss / (1024 * 1024) /
|
read_rate = (double) BLCKSZ * VacuumPageMiss / (1024 * 1024) /
|
||||||
(secs + usecs / 1000000.0);
|
(secs + usecs / 1000000.0);
|
||||||
write_rate = (double) BLCKSZ *VacuumPageDirty / (1024 * 1024) /
|
write_rate = (double) BLCKSZ * VacuumPageDirty / (1024 * 1024) /
|
||||||
(secs + usecs / 1000000.0);
|
(secs + usecs / 1000000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ binaryheap_allocate(int capacity, binaryheap_comparator compare, void *arg)
|
|||||||
int sz;
|
int sz;
|
||||||
binaryheap *heap;
|
binaryheap *heap;
|
||||||
|
|
||||||
sz = offsetof(binaryheap, bh_nodes) +sizeof(Datum) * capacity;
|
sz = offsetof(binaryheap, bh_nodes) + sizeof(Datum) * capacity;
|
||||||
heap = (binaryheap *) palloc(sz);
|
heap = (binaryheap *) palloc(sz);
|
||||||
heap->bh_space = capacity;
|
heap->bh_space = capacity;
|
||||||
heap->bh_compare = compare;
|
heap->bh_compare = compare;
|
||||||
|
@ -429,7 +429,7 @@ rb_insert(RBTree *rb, const RBNode *data, bool *isNew)
|
|||||||
*/
|
*/
|
||||||
*isNew = true;
|
*isNew = true;
|
||||||
|
|
||||||
x = rb->allocfunc (rb->arg);
|
x = rb->allocfunc(rb->arg);
|
||||||
|
|
||||||
x->color = RBRED;
|
x->color = RBRED;
|
||||||
|
|
||||||
@ -624,7 +624,7 @@ rb_delete_node(RBTree *rb, RBNode *z)
|
|||||||
|
|
||||||
/* Now we can recycle the y node */
|
/* Now we can recycle the y node */
|
||||||
if (rb->freefunc)
|
if (rb->freefunc)
|
||||||
rb->freefunc (y, rb->arg);
|
rb->freefunc(y, rb->arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -92,8 +92,8 @@ static int auth_peer(hbaPort *port);
|
|||||||
#define PGSQL_PAM_SERVICE "postgresql" /* Service name passed to PAM */
|
#define PGSQL_PAM_SERVICE "postgresql" /* Service name passed to PAM */
|
||||||
|
|
||||||
static int CheckPAMAuth(Port *port, char *user, char *password);
|
static int CheckPAMAuth(Port *port, char *user, char *password);
|
||||||
static int pam_passwd_conv_proc(int num_msg, const struct pam_message ** msg,
|
static int pam_passwd_conv_proc(int num_msg, const struct pam_message **msg,
|
||||||
struct pam_response ** resp, void *appdata_ptr);
|
struct pam_response **resp, void *appdata_ptr);
|
||||||
|
|
||||||
static struct pam_conv pam_passw_conv = {
|
static struct pam_conv pam_passw_conv = {
|
||||||
&pam_passwd_conv_proc,
|
&pam_passwd_conv_proc,
|
||||||
@ -1337,6 +1337,7 @@ pg_SSPI_recvauth(Port *port)
|
|||||||
DWORD domainnamesize = sizeof(domainname);
|
DWORD domainnamesize = sizeof(domainname);
|
||||||
SID_NAME_USE accountnameuse;
|
SID_NAME_USE accountnameuse;
|
||||||
HMODULE secur32;
|
HMODULE secur32;
|
||||||
|
|
||||||
QUERY_SECURITY_CONTEXT_TOKEN_FN _QuerySecurityContextToken;
|
QUERY_SECURITY_CONTEXT_TOKEN_FN _QuerySecurityContextToken;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2023,8 +2024,8 @@ auth_peer(hbaPort *port)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pam_passwd_conv_proc(int num_msg, const struct pam_message ** msg,
|
pam_passwd_conv_proc(int num_msg, const struct pam_message **msg,
|
||||||
struct pam_response ** resp, void *appdata_ptr)
|
struct pam_response **resp, void *appdata_ptr)
|
||||||
{
|
{
|
||||||
char *passwd;
|
char *passwd;
|
||||||
struct pam_response *reply;
|
struct pam_response *reply;
|
||||||
@ -2919,7 +2920,7 @@ PerformRadiusTransaction(char *server, char *secret, char *portstr, char *identi
|
|||||||
addrsize = sizeof(struct sockaddr_in);
|
addrsize = sizeof(struct sockaddr_in);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (bind(sock, (struct sockaddr *) & localaddr, addrsize))
|
if (bind(sock, (struct sockaddr *) &localaddr, addrsize))
|
||||||
{
|
{
|
||||||
ereport(LOG,
|
ereport(LOG,
|
||||||
(errmsg("could not bind local RADIUS socket: %m")));
|
(errmsg("could not bind local RADIUS socket: %m")));
|
||||||
@ -3010,7 +3011,7 @@ PerformRadiusTransaction(char *server, char *secret, char *portstr, char *identi
|
|||||||
|
|
||||||
addrsize = sizeof(remoteaddr);
|
addrsize = sizeof(remoteaddr);
|
||||||
packetlength = recvfrom(sock, receive_buffer, RADIUS_BUFFER_SIZE, 0,
|
packetlength = recvfrom(sock, receive_buffer, RADIUS_BUFFER_SIZE, 0,
|
||||||
(struct sockaddr *) & remoteaddr, &addrsize);
|
(struct sockaddr *) &remoteaddr, &addrsize);
|
||||||
if (packetlength < 0)
|
if (packetlength < 0)
|
||||||
{
|
{
|
||||||
ereport(LOG,
|
ereport(LOG,
|
||||||
|
@ -646,7 +646,7 @@ check_db(const char *dbname, const char *role, Oid roleid, List *tokens)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
ipv4eq(struct sockaddr_in * a, struct sockaddr_in * b)
|
ipv4eq(struct sockaddr_in *a, struct sockaddr_in *b)
|
||||||
{
|
{
|
||||||
return (a->sin_addr.s_addr == b->sin_addr.s_addr);
|
return (a->sin_addr.s_addr == b->sin_addr.s_addr);
|
||||||
}
|
}
|
||||||
@ -654,7 +654,7 @@ ipv4eq(struct sockaddr_in * a, struct sockaddr_in * b)
|
|||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
ipv6eq(struct sockaddr_in6 * a, struct sockaddr_in6 * b)
|
ipv6eq(struct sockaddr_in6 *a, struct sockaddr_in6 *b)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -747,7 +747,7 @@ check_hostname(hbaPort *port, const char *hostname)
|
|||||||
if (gai->ai_addr->sa_family == AF_INET)
|
if (gai->ai_addr->sa_family == AF_INET)
|
||||||
{
|
{
|
||||||
if (ipv4eq((struct sockaddr_in *) gai->ai_addr,
|
if (ipv4eq((struct sockaddr_in *) gai->ai_addr,
|
||||||
(struct sockaddr_in *) & port->raddr.addr))
|
(struct sockaddr_in *) &port->raddr.addr))
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
@ -757,7 +757,7 @@ check_hostname(hbaPort *port, const char *hostname)
|
|||||||
else if (gai->ai_addr->sa_family == AF_INET6)
|
else if (gai->ai_addr->sa_family == AF_INET6)
|
||||||
{
|
{
|
||||||
if (ipv6eq((struct sockaddr_in6 *) gai->ai_addr,
|
if (ipv6eq((struct sockaddr_in6 *) gai->ai_addr,
|
||||||
(struct sockaddr_in6 *) & port->raddr.addr))
|
(struct sockaddr_in6 *) &port->raddr.addr))
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
@ -783,7 +783,7 @@ check_hostname(hbaPort *port, const char *hostname)
|
|||||||
* Check to see if a connecting IP matches the given address and netmask.
|
* Check to see if a connecting IP matches the given address and netmask.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
check_ip(SockAddr *raddr, struct sockaddr * addr, struct sockaddr * mask)
|
check_ip(SockAddr *raddr, struct sockaddr *addr, struct sockaddr *mask)
|
||||||
{
|
{
|
||||||
if (raddr->addr.ss_family == addr->sa_family &&
|
if (raddr->addr.ss_family == addr->sa_family &&
|
||||||
pg_range_sockaddr(&raddr->addr,
|
pg_range_sockaddr(&raddr->addr,
|
||||||
@ -797,7 +797,7 @@ check_ip(SockAddr *raddr, struct sockaddr * addr, struct sockaddr * mask)
|
|||||||
* pg_foreach_ifaddr callback: does client addr match this machine interface?
|
* pg_foreach_ifaddr callback: does client addr match this machine interface?
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
check_network_callback(struct sockaddr * addr, struct sockaddr * netmask,
|
check_network_callback(struct sockaddr *addr, struct sockaddr *netmask,
|
||||||
void *cb_data)
|
void *cb_data)
|
||||||
{
|
{
|
||||||
check_network_data *cn = (check_network_data *) cb_data;
|
check_network_data *cn = (check_network_data *) cb_data;
|
||||||
@ -811,7 +811,7 @@ check_network_callback(struct sockaddr * addr, struct sockaddr * netmask,
|
|||||||
{
|
{
|
||||||
/* Make an all-ones netmask of appropriate length for family */
|
/* Make an all-ones netmask of appropriate length for family */
|
||||||
pg_sockaddr_cidr_mask(&mask, NULL, addr->sa_family);
|
pg_sockaddr_cidr_mask(&mask, NULL, addr->sa_family);
|
||||||
cn->result = check_ip(cn->raddr, addr, (struct sockaddr *) & mask);
|
cn->result = check_ip(cn->raddr, addr, (struct sockaddr *) &mask);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2041,8 +2041,8 @@ check_hba(hbaPort *port)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!check_ip(&port->raddr,
|
if (!check_ip(&port->raddr,
|
||||||
(struct sockaddr *) & hba->addr,
|
(struct sockaddr *) &hba->addr,
|
||||||
(struct sockaddr *) & hba->mask))
|
(struct sockaddr *) &hba->mask))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -32,14 +32,14 @@
|
|||||||
|
|
||||||
#include "libpq/ifaddr.h"
|
#include "libpq/ifaddr.h"
|
||||||
|
|
||||||
static int range_sockaddr_AF_INET(const struct sockaddr_in * addr,
|
static int range_sockaddr_AF_INET(const struct sockaddr_in *addr,
|
||||||
const struct sockaddr_in * netaddr,
|
const struct sockaddr_in *netaddr,
|
||||||
const struct sockaddr_in * netmask);
|
const struct sockaddr_in *netmask);
|
||||||
|
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
static int range_sockaddr_AF_INET6(const struct sockaddr_in6 * addr,
|
static int range_sockaddr_AF_INET6(const struct sockaddr_in6 *addr,
|
||||||
const struct sockaddr_in6 * netaddr,
|
const struct sockaddr_in6 *netaddr,
|
||||||
const struct sockaddr_in6 * netmask);
|
const struct sockaddr_in6 *netmask);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -50,9 +50,9 @@ static int range_sockaddr_AF_INET6(const struct sockaddr_in6 * addr,
|
|||||||
* in the same address family; and AF_UNIX addresses are not supported.
|
* in the same address family; and AF_UNIX addresses are not supported.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pg_range_sockaddr(const struct sockaddr_storage * addr,
|
pg_range_sockaddr(const struct sockaddr_storage *addr,
|
||||||
const struct sockaddr_storage * netaddr,
|
const struct sockaddr_storage *netaddr,
|
||||||
const struct sockaddr_storage * netmask)
|
const struct sockaddr_storage *netmask)
|
||||||
{
|
{
|
||||||
if (addr->ss_family == AF_INET)
|
if (addr->ss_family == AF_INET)
|
||||||
return range_sockaddr_AF_INET((const struct sockaddr_in *) addr,
|
return range_sockaddr_AF_INET((const struct sockaddr_in *) addr,
|
||||||
@ -69,9 +69,9 @@ pg_range_sockaddr(const struct sockaddr_storage * addr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
range_sockaddr_AF_INET(const struct sockaddr_in * addr,
|
range_sockaddr_AF_INET(const struct sockaddr_in *addr,
|
||||||
const struct sockaddr_in * netaddr,
|
const struct sockaddr_in *netaddr,
|
||||||
const struct sockaddr_in * netmask)
|
const struct sockaddr_in *netmask)
|
||||||
{
|
{
|
||||||
if (((addr->sin_addr.s_addr ^ netaddr->sin_addr.s_addr) &
|
if (((addr->sin_addr.s_addr ^ netaddr->sin_addr.s_addr) &
|
||||||
netmask->sin_addr.s_addr) == 0)
|
netmask->sin_addr.s_addr) == 0)
|
||||||
@ -84,9 +84,9 @@ range_sockaddr_AF_INET(const struct sockaddr_in * addr,
|
|||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
|
|
||||||
static int
|
static int
|
||||||
range_sockaddr_AF_INET6(const struct sockaddr_in6 * addr,
|
range_sockaddr_AF_INET6(const struct sockaddr_in6 *addr,
|
||||||
const struct sockaddr_in6 * netaddr,
|
const struct sockaddr_in6 *netaddr,
|
||||||
const struct sockaddr_in6 * netmask)
|
const struct sockaddr_in6 *netmask)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ range_sockaddr_AF_INET6(const struct sockaddr_in6 * addr,
|
|||||||
* Return value is 0 if okay, -1 if not.
|
* Return value is 0 if okay, -1 if not.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pg_sockaddr_cidr_mask(struct sockaddr_storage * mask, char *numbits, int family)
|
pg_sockaddr_cidr_mask(struct sockaddr_storage *mask, char *numbits, int family)
|
||||||
{
|
{
|
||||||
long bits;
|
long bits;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
@ -190,7 +190,7 @@ pg_sockaddr_cidr_mask(struct sockaddr_storage * mask, char *numbits, int family)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
run_ifaddr_callback(PgIfAddrCallback callback, void *cb_data,
|
run_ifaddr_callback(PgIfAddrCallback callback, void *cb_data,
|
||||||
struct sockaddr * addr, struct sockaddr * mask)
|
struct sockaddr *addr, struct sockaddr *mask)
|
||||||
{
|
{
|
||||||
struct sockaddr_storage fullmask;
|
struct sockaddr_storage fullmask;
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ run_ifaddr_callback(PgIfAddrCallback callback, void *cb_data,
|
|||||||
if (!mask)
|
if (!mask)
|
||||||
{
|
{
|
||||||
pg_sockaddr_cidr_mask(&fullmask, NULL, addr->sa_family);
|
pg_sockaddr_cidr_mask(&fullmask, NULL, addr->sa_family);
|
||||||
mask = (struct sockaddr *) & fullmask;
|
mask = (struct sockaddr *) &fullmask;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*callback) (addr, mask, cb_data);
|
(*callback) (addr, mask, cb_data);
|
||||||
@ -284,8 +284,8 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data)
|
|||||||
|
|
||||||
for (i = 0; i < length / sizeof(INTERFACE_INFO); ++i)
|
for (i = 0; i < length / sizeof(INTERFACE_INFO); ++i)
|
||||||
run_ifaddr_callback(callback, cb_data,
|
run_ifaddr_callback(callback, cb_data,
|
||||||
(struct sockaddr *) & ii[i].iiAddress,
|
(struct sockaddr *) &ii[i].iiAddress,
|
||||||
(struct sockaddr *) & ii[i].iiNetmask);
|
(struct sockaddr *) &ii[i].iiNetmask);
|
||||||
|
|
||||||
closesocket(sock);
|
closesocket(sock);
|
||||||
free(ii);
|
free(ii);
|
||||||
@ -425,7 +425,7 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data)
|
|||||||
lifr = lifc.lifc_req;
|
lifr = lifc.lifc_req;
|
||||||
for (i = 0; i < total; ++i)
|
for (i = 0; i < total; ++i)
|
||||||
{
|
{
|
||||||
addr = (struct sockaddr *) & lifr[i].lifr_addr;
|
addr = (struct sockaddr *) &lifr[i].lifr_addr;
|
||||||
memcpy(&lmask, &lifr[i], sizeof(struct lifreq));
|
memcpy(&lmask, &lifr[i], sizeof(struct lifreq));
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
fd = (addr->sa_family == AF_INET6) ? sock6 : sock;
|
fd = (addr->sa_family == AF_INET6) ? sock6 : sock;
|
||||||
@ -435,7 +435,7 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data)
|
|||||||
if (ioctl(fd, SIOCGLIFNETMASK, &lmask) < 0)
|
if (ioctl(fd, SIOCGLIFNETMASK, &lmask) < 0)
|
||||||
mask = NULL;
|
mask = NULL;
|
||||||
else
|
else
|
||||||
mask = (struct sockaddr *) & lmask.lifr_addr;
|
mask = (struct sockaddr *) &lmask.lifr_addr;
|
||||||
run_ifaddr_callback(callback, cb_data, addr, mask);
|
run_ifaddr_callback(callback, cb_data, addr, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -572,8 +572,8 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data)
|
|||||||
memset(&mask, 0, sizeof(mask));
|
memset(&mask, 0, sizeof(mask));
|
||||||
pg_sockaddr_cidr_mask(&mask, "8", AF_INET);
|
pg_sockaddr_cidr_mask(&mask, "8", AF_INET);
|
||||||
run_ifaddr_callback(callback, cb_data,
|
run_ifaddr_callback(callback, cb_data,
|
||||||
(struct sockaddr *) & addr,
|
(struct sockaddr *) &addr,
|
||||||
(struct sockaddr *) & mask);
|
(struct sockaddr *) &mask);
|
||||||
|
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
/* addr ::1/128 */
|
/* addr ::1/128 */
|
||||||
@ -583,8 +583,8 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data)
|
|||||||
memset(&mask, 0, sizeof(mask));
|
memset(&mask, 0, sizeof(mask));
|
||||||
pg_sockaddr_cidr_mask(&mask, "128", AF_INET6);
|
pg_sockaddr_cidr_mask(&mask, "128", AF_INET6);
|
||||||
run_ifaddr_callback(callback, cb_data,
|
run_ifaddr_callback(callback, cb_data,
|
||||||
(struct sockaddr *) & addr6,
|
(struct sockaddr *) &addr6,
|
||||||
(struct sockaddr *) & mask);
|
(struct sockaddr *) &mask);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -699,7 +699,7 @@ StreamConnection(pgsocket server_fd, Port *port)
|
|||||||
/* accept connection and fill in the client (remote) address */
|
/* accept connection and fill in the client (remote) address */
|
||||||
port->raddr.salen = sizeof(port->raddr.addr);
|
port->raddr.salen = sizeof(port->raddr.addr);
|
||||||
if ((port->sock = accept(server_fd,
|
if ((port->sock = accept(server_fd,
|
||||||
(struct sockaddr *) & port->raddr.addr,
|
(struct sockaddr *) &port->raddr.addr,
|
||||||
&port->raddr.salen)) == PGINVALID_SOCKET)
|
&port->raddr.salen)) == PGINVALID_SOCKET)
|
||||||
{
|
{
|
||||||
ereport(LOG,
|
ereport(LOG,
|
||||||
@ -720,7 +720,7 @@ StreamConnection(pgsocket server_fd, Port *port)
|
|||||||
/* fill in the server (local) address */
|
/* fill in the server (local) address */
|
||||||
port->laddr.salen = sizeof(port->laddr.addr);
|
port->laddr.salen = sizeof(port->laddr.addr);
|
||||||
if (getsockname(port->sock,
|
if (getsockname(port->sock,
|
||||||
(struct sockaddr *) & port->laddr.addr,
|
(struct sockaddr *) &port->laddr.addr,
|
||||||
&port->laddr.salen) < 0)
|
&port->laddr.salen) < 0)
|
||||||
{
|
{
|
||||||
elog(LOG, "getsockname() failed: %m");
|
elog(LOG, "getsockname() failed: %m");
|
||||||
|
@ -827,7 +827,7 @@ index_pages_fetched(double tuples_fetched, BlockNumber pages,
|
|||||||
Assert(T <= total_pages);
|
Assert(T <= total_pages);
|
||||||
|
|
||||||
/* b is pro-rated share of effective_cache_size */
|
/* b is pro-rated share of effective_cache_size */
|
||||||
b = (double) effective_cache_size *T / total_pages;
|
b = (double) effective_cache_size * T / total_pages;
|
||||||
|
|
||||||
/* force it positive and integral */
|
/* force it positive and integral */
|
||||||
if (b <= 1.0)
|
if (b <= 1.0)
|
||||||
@ -3057,7 +3057,7 @@ final_cost_hashjoin(PlannerInfo *root, HashPath *path,
|
|||||||
path->num_batches = numbatches;
|
path->num_batches = numbatches;
|
||||||
|
|
||||||
/* and compute the number of "virtual" buckets in the whole join */
|
/* and compute the number of "virtual" buckets in the whole join */
|
||||||
virtualbuckets = (double) numbuckets *(double) numbatches;
|
virtualbuckets = (double) numbuckets * (double) numbatches;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine bucketsize fraction for inner relation. We use the smallest
|
* Determine bucketsize fraction for inner relation. We use the smallest
|
||||||
|
@ -89,7 +89,7 @@ typedef BOOL (WINAPI * MINIDUMPWRITEDUMP) (HANDLE hProcess, DWORD dwPid, HANDLE
|
|||||||
* any PostgreSQL functions.
|
* any PostgreSQL functions.
|
||||||
*/
|
*/
|
||||||
static LONG WINAPI
|
static LONG WINAPI
|
||||||
crashDumpHandler(struct _EXCEPTION_POINTERS * pExceptionInfo)
|
crashDumpHandler(struct _EXCEPTION_POINTERS *pExceptionInfo)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* We only write crash dumps if the "crashdumps" directory within the
|
* We only write crash dumps if the "crashdumps" directory within the
|
||||||
|
@ -298,7 +298,7 @@ pgwin32_socket(int af, int type, int protocol)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pgwin32_bind(SOCKET s, struct sockaddr * addr, int addrlen)
|
pgwin32_bind(SOCKET s, struct sockaddr *addr, int addrlen)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
@ -320,7 +320,7 @@ pgwin32_listen(SOCKET s, int backlog)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SOCKET
|
SOCKET
|
||||||
pgwin32_accept(SOCKET s, struct sockaddr * addr, int *addrlen)
|
pgwin32_accept(SOCKET s, struct sockaddr *addr, int *addrlen)
|
||||||
{
|
{
|
||||||
SOCKET rs;
|
SOCKET rs;
|
||||||
|
|
||||||
@ -342,7 +342,7 @@ pgwin32_accept(SOCKET s, struct sockaddr * addr, int *addrlen)
|
|||||||
|
|
||||||
/* No signal delivery during connect. */
|
/* No signal delivery during connect. */
|
||||||
int
|
int
|
||||||
pgwin32_connect(SOCKET s, const struct sockaddr * addr, int addrlen)
|
pgwin32_connect(SOCKET s, const struct sockaddr *addr, int addrlen)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ pgwin32_send(SOCKET s, const void *buf, int len, int flags)
|
|||||||
* since it is not used in postgresql!
|
* since it is not used in postgresql!
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval * timeout)
|
pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout)
|
||||||
{
|
{
|
||||||
WSAEVENT events[FD_SETSIZE * 2]; /* worst case is readfds totally
|
WSAEVENT events[FD_SETSIZE * 2]; /* worst case is readfds totally
|
||||||
* different from writefds, so
|
* different from writefds, so
|
||||||
|
@ -83,7 +83,7 @@ pg_timer_thread(LPVOID param)
|
|||||||
* to handle the timer setting and notification upon timeout.
|
* to handle the timer setting and notification upon timeout.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
setitimer(int which, const struct itimerval * value, struct itimerval * ovalue)
|
setitimer(int which, const struct itimerval *value, struct itimerval *ovalue)
|
||||||
{
|
{
|
||||||
Assert(value != NULL);
|
Assert(value != NULL);
|
||||||
Assert(value->it_interval.tv_sec == 0 && value->it_interval.tv_usec == 0);
|
Assert(value->it_interval.tv_sec == 0 && value->it_interval.tv_usec == 0);
|
||||||
|
@ -321,7 +321,7 @@ NON_EXEC_STATIC void AutoVacLauncherMain(int argc, char *argv[]) pg_attribute_no
|
|||||||
|
|
||||||
static Oid do_start_worker(void);
|
static Oid do_start_worker(void);
|
||||||
static void launcher_determine_sleep(bool canlaunch, bool recursing,
|
static void launcher_determine_sleep(bool canlaunch, bool recursing,
|
||||||
struct timeval * nap);
|
struct timeval *nap);
|
||||||
static void launch_worker(TimestampTz now);
|
static void launch_worker(TimestampTz now);
|
||||||
static List *get_database_list(void);
|
static List *get_database_list(void);
|
||||||
static void rebuild_database_list(Oid newdb);
|
static void rebuild_database_list(Oid newdb);
|
||||||
@ -849,7 +849,7 @@ shutdown:
|
|||||||
* cause a long sleep, which will be interrupted when a worker exits.
|
* cause a long sleep, which will be interrupted when a worker exits.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
launcher_determine_sleep(bool canlaunch, bool recursing, struct timeval * nap)
|
launcher_determine_sleep(bool canlaunch, bool recursing, struct timeval *nap)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* We sleep until the next scheduled vacuum. We trust that when the
|
* We sleep until the next scheduled vacuum. We trust that when the
|
||||||
|
@ -443,7 +443,7 @@ pgstat_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
alen = sizeof(pgStatAddr);
|
alen = sizeof(pgStatAddr);
|
||||||
if (getsockname(pgStatSock, (struct sockaddr *) & pgStatAddr, &alen) < 0)
|
if (getsockname(pgStatSock, (struct sockaddr *) &pgStatAddr, &alen) < 0)
|
||||||
{
|
{
|
||||||
ereport(LOG,
|
ereport(LOG,
|
||||||
(errcode_for_socket_access(),
|
(errcode_for_socket_access(),
|
||||||
@ -459,7 +459,7 @@ pgstat_init(void)
|
|||||||
* provides a kernel-level check that only packets from this same
|
* provides a kernel-level check that only packets from this same
|
||||||
* address will be received.
|
* address will be received.
|
||||||
*/
|
*/
|
||||||
if (connect(pgStatSock, (struct sockaddr *) & pgStatAddr, alen) < 0)
|
if (connect(pgStatSock, (struct sockaddr *) &pgStatAddr, alen) < 0)
|
||||||
{
|
{
|
||||||
ereport(LOG,
|
ereport(LOG,
|
||||||
(errcode_for_socket_access(),
|
(errcode_for_socket_access(),
|
||||||
@ -1107,7 +1107,7 @@ pgstat_vacuum_stat(void)
|
|||||||
if (msg.m_nentries >= PGSTAT_NUM_TABPURGE)
|
if (msg.m_nentries >= PGSTAT_NUM_TABPURGE)
|
||||||
{
|
{
|
||||||
len = offsetof(PgStat_MsgTabpurge, m_tableid[0])
|
len = offsetof(PgStat_MsgTabpurge, m_tableid[0])
|
||||||
+msg.m_nentries * sizeof(Oid);
|
+ msg.m_nentries * sizeof(Oid);
|
||||||
|
|
||||||
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_TABPURGE);
|
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_TABPURGE);
|
||||||
msg.m_databaseid = MyDatabaseId;
|
msg.m_databaseid = MyDatabaseId;
|
||||||
@ -1123,7 +1123,7 @@ pgstat_vacuum_stat(void)
|
|||||||
if (msg.m_nentries > 0)
|
if (msg.m_nentries > 0)
|
||||||
{
|
{
|
||||||
len = offsetof(PgStat_MsgTabpurge, m_tableid[0])
|
len = offsetof(PgStat_MsgTabpurge, m_tableid[0])
|
||||||
+msg.m_nentries * sizeof(Oid);
|
+ msg.m_nentries * sizeof(Oid);
|
||||||
|
|
||||||
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_TABPURGE);
|
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_TABPURGE);
|
||||||
msg.m_databaseid = MyDatabaseId;
|
msg.m_databaseid = MyDatabaseId;
|
||||||
@ -1167,7 +1167,7 @@ pgstat_vacuum_stat(void)
|
|||||||
if (f_msg.m_nentries >= PGSTAT_NUM_FUNCPURGE)
|
if (f_msg.m_nentries >= PGSTAT_NUM_FUNCPURGE)
|
||||||
{
|
{
|
||||||
len = offsetof(PgStat_MsgFuncpurge, m_functionid[0])
|
len = offsetof(PgStat_MsgFuncpurge, m_functionid[0])
|
||||||
+f_msg.m_nentries * sizeof(Oid);
|
+ f_msg.m_nentries * sizeof(Oid);
|
||||||
|
|
||||||
pgstat_send(&f_msg, len);
|
pgstat_send(&f_msg, len);
|
||||||
|
|
||||||
@ -1181,7 +1181,7 @@ pgstat_vacuum_stat(void)
|
|||||||
if (f_msg.m_nentries > 0)
|
if (f_msg.m_nentries > 0)
|
||||||
{
|
{
|
||||||
len = offsetof(PgStat_MsgFuncpurge, m_functionid[0])
|
len = offsetof(PgStat_MsgFuncpurge, m_functionid[0])
|
||||||
+f_msg.m_nentries * sizeof(Oid);
|
+ f_msg.m_nentries * sizeof(Oid);
|
||||||
|
|
||||||
pgstat_send(&f_msg, len);
|
pgstat_send(&f_msg, len);
|
||||||
}
|
}
|
||||||
@ -1284,7 +1284,7 @@ pgstat_drop_relation(Oid relid)
|
|||||||
msg.m_tableid[0] = relid;
|
msg.m_tableid[0] = relid;
|
||||||
msg.m_nentries = 1;
|
msg.m_nentries = 1;
|
||||||
|
|
||||||
len = offsetof(PgStat_MsgTabpurge, m_tableid[0]) +sizeof(Oid);
|
len = offsetof(PgStat_MsgTabpurge, m_tableid[0]) + sizeof(Oid);
|
||||||
|
|
||||||
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_TABPURGE);
|
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_TABPURGE);
|
||||||
msg.m_databaseid = MyDatabaseId;
|
msg.m_databaseid = MyDatabaseId;
|
||||||
|
@ -340,6 +340,7 @@ static PMState pmState = PM_INIT;
|
|||||||
/* Start time of SIGKILL timeout during immediate shutdown or child crash */
|
/* Start time of SIGKILL timeout during immediate shutdown or child crash */
|
||||||
/* Zero means timeout is not running */
|
/* Zero means timeout is not running */
|
||||||
static time_t AbortStartTime = 0;
|
static time_t AbortStartTime = 0;
|
||||||
|
|
||||||
/* Length of said timeout */
|
/* Length of said timeout */
|
||||||
#define SIGKILL_CHILDREN_AFTER_SECS 5
|
#define SIGKILL_CHILDREN_AFTER_SECS 5
|
||||||
|
|
||||||
@ -1558,7 +1559,7 @@ checkDataDir(void)
|
|||||||
* cases are as shown in the code.
|
* cases are as shown in the code.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
DetermineSleepTime(struct timeval * timeout)
|
DetermineSleepTime(struct timeval *timeout)
|
||||||
{
|
{
|
||||||
TimestampTz next_wakeup = 0;
|
TimestampTz next_wakeup = 0;
|
||||||
|
|
||||||
|
@ -797,7 +797,7 @@ process_pipe_input(char *logbuffer, int *bytes_in_logbuffer)
|
|||||||
int dest = LOG_DESTINATION_STDERR;
|
int dest = LOG_DESTINATION_STDERR;
|
||||||
|
|
||||||
/* While we have enough for a header, process data... */
|
/* While we have enough for a header, process data... */
|
||||||
while (count >= (int) (offsetof(PipeProtoHeader, data) +1))
|
while (count >= (int) (offsetof(PipeProtoHeader, data) + 1))
|
||||||
{
|
{
|
||||||
PipeProtoHeader p;
|
PipeProtoHeader p;
|
||||||
int chunklen;
|
int chunklen;
|
||||||
|
@ -46,8 +46,8 @@
|
|||||||
* initcm - set up new colormap
|
* initcm - set up new colormap
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
initcm(struct vars * v,
|
initcm(struct vars *v,
|
||||||
struct colormap * cm)
|
struct colormap *cm)
|
||||||
{
|
{
|
||||||
struct colordesc *cd;
|
struct colordesc *cd;
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ initcm(struct vars * v,
|
|||||||
* freecm - free dynamically-allocated things in a colormap
|
* freecm - free dynamically-allocated things in a colormap
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
freecm(struct colormap * cm)
|
freecm(struct colormap *cm)
|
||||||
{
|
{
|
||||||
cm->magic = 0;
|
cm->magic = 0;
|
||||||
if (cm->cd != cm->cdspace)
|
if (cm->cd != cm->cdspace)
|
||||||
@ -117,7 +117,7 @@ freecm(struct colormap * cm)
|
|||||||
* pg_reg_getcolor - slow case of GETCOLOR()
|
* pg_reg_getcolor - slow case of GETCOLOR()
|
||||||
*/
|
*/
|
||||||
color
|
color
|
||||||
pg_reg_getcolor(struct colormap * cm, chr c)
|
pg_reg_getcolor(struct colormap *cm, chr c)
|
||||||
{
|
{
|
||||||
int rownum,
|
int rownum,
|
||||||
colnum,
|
colnum,
|
||||||
@ -169,7 +169,7 @@ pg_reg_getcolor(struct colormap * cm, chr c)
|
|||||||
* maxcolor - report largest color number in use
|
* maxcolor - report largest color number in use
|
||||||
*/
|
*/
|
||||||
static color
|
static color
|
||||||
maxcolor(struct colormap * cm)
|
maxcolor(struct colormap *cm)
|
||||||
{
|
{
|
||||||
if (CISERR())
|
if (CISERR())
|
||||||
return COLORLESS;
|
return COLORLESS;
|
||||||
@ -182,7 +182,7 @@ maxcolor(struct colormap * cm)
|
|||||||
* Beware: may relocate the colordescs.
|
* Beware: may relocate the colordescs.
|
||||||
*/
|
*/
|
||||||
static color /* COLORLESS for error */
|
static color /* COLORLESS for error */
|
||||||
newcolor(struct colormap * cm)
|
newcolor(struct colormap *cm)
|
||||||
{
|
{
|
||||||
struct colordesc *cd;
|
struct colordesc *cd;
|
||||||
size_t n;
|
size_t n;
|
||||||
@ -254,7 +254,7 @@ newcolor(struct colormap * cm)
|
|||||||
* freecolor - free a color (must have no arcs or subcolor)
|
* freecolor - free a color (must have no arcs or subcolor)
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
freecolor(struct colormap * cm,
|
freecolor(struct colormap *cm,
|
||||||
color co)
|
color co)
|
||||||
{
|
{
|
||||||
struct colordesc *cd = &cm->cd[co];
|
struct colordesc *cd = &cm->cd[co];
|
||||||
@ -309,7 +309,7 @@ freecolor(struct colormap * cm,
|
|||||||
* pseudocolor - allocate a false color, to be managed by other means
|
* pseudocolor - allocate a false color, to be managed by other means
|
||||||
*/
|
*/
|
||||||
static color
|
static color
|
||||||
pseudocolor(struct colormap * cm)
|
pseudocolor(struct colormap *cm)
|
||||||
{
|
{
|
||||||
color co;
|
color co;
|
||||||
struct colordesc *cd;
|
struct colordesc *cd;
|
||||||
@ -333,7 +333,7 @@ pseudocolor(struct colormap * cm)
|
|||||||
* This works only for chrs that map into the low color map.
|
* This works only for chrs that map into the low color map.
|
||||||
*/
|
*/
|
||||||
static color
|
static color
|
||||||
subcolor(struct colormap * cm, chr c)
|
subcolor(struct colormap *cm, chr c)
|
||||||
{
|
{
|
||||||
color co; /* current color of c */
|
color co; /* current color of c */
|
||||||
color sco; /* new subcolor */
|
color sco; /* new subcolor */
|
||||||
@ -363,7 +363,7 @@ subcolor(struct colormap * cm, chr c)
|
|||||||
* colormap, which do not necessarily correspond to exactly one chr code.
|
* colormap, which do not necessarily correspond to exactly one chr code.
|
||||||
*/
|
*/
|
||||||
static color
|
static color
|
||||||
subcolorhi(struct colormap * cm, color *pco)
|
subcolorhi(struct colormap *cm, color *pco)
|
||||||
{
|
{
|
||||||
color co; /* current color of entry */
|
color co; /* current color of entry */
|
||||||
color sco; /* new subcolor */
|
color sco; /* new subcolor */
|
||||||
@ -386,7 +386,7 @@ subcolorhi(struct colormap * cm, color *pco)
|
|||||||
* newsub - allocate a new subcolor (if necessary) for a color
|
* newsub - allocate a new subcolor (if necessary) for a color
|
||||||
*/
|
*/
|
||||||
static color
|
static color
|
||||||
newsub(struct colormap * cm,
|
newsub(struct colormap *cm,
|
||||||
color co)
|
color co)
|
||||||
{
|
{
|
||||||
color sco; /* new subcolor */
|
color sco; /* new subcolor */
|
||||||
@ -417,7 +417,7 @@ newsub(struct colormap * cm,
|
|||||||
* Returns array index of new row. Note the array might move.
|
* Returns array index of new row. Note the array might move.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
newhicolorrow(struct colormap * cm,
|
newhicolorrow(struct colormap *cm,
|
||||||
int oldrow)
|
int oldrow)
|
||||||
{
|
{
|
||||||
int newrow = cm->hiarrayrows;
|
int newrow = cm->hiarrayrows;
|
||||||
@ -466,7 +466,7 @@ newhicolorrow(struct colormap * cm,
|
|||||||
* Essentially, extends the 2-D array to the right with a copy of itself.
|
* Essentially, extends the 2-D array to the right with a copy of itself.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
newhicolorcols(struct colormap * cm)
|
newhicolorcols(struct colormap *cm)
|
||||||
{
|
{
|
||||||
color *newarray;
|
color *newarray;
|
||||||
int r,
|
int r,
|
||||||
@ -519,10 +519,10 @@ newhicolorcols(struct colormap * cm)
|
|||||||
* mechanized with the "lastsubcolor" state variable.
|
* mechanized with the "lastsubcolor" state variable.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
subcolorcvec(struct vars * v,
|
subcolorcvec(struct vars *v,
|
||||||
struct cvec * cv,
|
struct cvec *cv,
|
||||||
struct state * lp,
|
struct state *lp,
|
||||||
struct state * rp)
|
struct state *rp)
|
||||||
{
|
{
|
||||||
struct colormap *cm = v->cm;
|
struct colormap *cm = v->cm;
|
||||||
color lastsubcolor = COLORLESS;
|
color lastsubcolor = COLORLESS;
|
||||||
@ -621,10 +621,10 @@ subcolorcvec(struct vars * v,
|
|||||||
* to be able to handle both low and high chr codes.
|
* to be able to handle both low and high chr codes.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
subcoloronechr(struct vars * v,
|
subcoloronechr(struct vars *v,
|
||||||
chr ch,
|
chr ch,
|
||||||
struct state * lp,
|
struct state *lp,
|
||||||
struct state * rp,
|
struct state *rp,
|
||||||
color *lastsubcolor)
|
color *lastsubcolor)
|
||||||
{
|
{
|
||||||
struct colormap *cm = v->cm;
|
struct colormap *cm = v->cm;
|
||||||
@ -744,11 +744,11 @@ subcoloronechr(struct vars * v,
|
|||||||
* subcoloronerange - do subcolorcvec's work for a high range
|
* subcoloronerange - do subcolorcvec's work for a high range
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
subcoloronerange(struct vars * v,
|
subcoloronerange(struct vars *v,
|
||||||
chr from,
|
chr from,
|
||||||
chr to,
|
chr to,
|
||||||
struct state * lp,
|
struct state *lp,
|
||||||
struct state * rp,
|
struct state *rp,
|
||||||
color *lastsubcolor)
|
color *lastsubcolor)
|
||||||
{
|
{
|
||||||
struct colormap *cm = v->cm;
|
struct colormap *cm = v->cm;
|
||||||
@ -882,10 +882,10 @@ subcoloronerange(struct vars * v,
|
|||||||
* subcoloronerow - do subcolorcvec's work for one new row in the high colormap
|
* subcoloronerow - do subcolorcvec's work for one new row in the high colormap
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
subcoloronerow(struct vars * v,
|
subcoloronerow(struct vars *v,
|
||||||
int rownum,
|
int rownum,
|
||||||
struct state * lp,
|
struct state *lp,
|
||||||
struct state * rp,
|
struct state *rp,
|
||||||
color *lastsubcolor)
|
color *lastsubcolor)
|
||||||
{
|
{
|
||||||
struct colormap *cm = v->cm;
|
struct colormap *cm = v->cm;
|
||||||
@ -913,8 +913,8 @@ subcoloronerow(struct vars * v,
|
|||||||
* okcolors - promote subcolors to full colors
|
* okcolors - promote subcolors to full colors
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
okcolors(struct nfa * nfa,
|
okcolors(struct nfa *nfa,
|
||||||
struct colormap * cm)
|
struct colormap *cm)
|
||||||
{
|
{
|
||||||
struct colordesc *cd;
|
struct colordesc *cd;
|
||||||
struct colordesc *end = CDEND(cm);
|
struct colordesc *end = CDEND(cm);
|
||||||
@ -972,8 +972,8 @@ okcolors(struct nfa * nfa,
|
|||||||
* colorchain - add this arc to the color chain of its color
|
* colorchain - add this arc to the color chain of its color
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
colorchain(struct colormap * cm,
|
colorchain(struct colormap *cm,
|
||||||
struct arc * a)
|
struct arc *a)
|
||||||
{
|
{
|
||||||
struct colordesc *cd = &cm->cd[a->co];
|
struct colordesc *cd = &cm->cd[a->co];
|
||||||
|
|
||||||
@ -988,8 +988,8 @@ colorchain(struct colormap * cm,
|
|||||||
* uncolorchain - delete this arc from the color chain of its color
|
* uncolorchain - delete this arc from the color chain of its color
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
uncolorchain(struct colormap * cm,
|
uncolorchain(struct colormap *cm,
|
||||||
struct arc * a)
|
struct arc *a)
|
||||||
{
|
{
|
||||||
struct colordesc *cd = &cm->cd[a->co];
|
struct colordesc *cd = &cm->cd[a->co];
|
||||||
struct arc *aa = a->colorchainRev;
|
struct arc *aa = a->colorchainRev;
|
||||||
@ -1014,12 +1014,12 @@ uncolorchain(struct colormap * cm,
|
|||||||
* rainbow - add arcs of all full colors (but one) between specified states
|
* rainbow - add arcs of all full colors (but one) between specified states
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
rainbow(struct nfa * nfa,
|
rainbow(struct nfa *nfa,
|
||||||
struct colormap * cm,
|
struct colormap *cm,
|
||||||
int type,
|
int type,
|
||||||
color but, /* COLORLESS if no exceptions */
|
color but, /* COLORLESS if no exceptions */
|
||||||
struct state * from,
|
struct state *from,
|
||||||
struct state * to)
|
struct state *to)
|
||||||
{
|
{
|
||||||
struct colordesc *cd;
|
struct colordesc *cd;
|
||||||
struct colordesc *end = CDEND(cm);
|
struct colordesc *end = CDEND(cm);
|
||||||
@ -1037,13 +1037,13 @@ rainbow(struct nfa * nfa,
|
|||||||
* The calling sequence ought to be reconciled with cloneouts().
|
* The calling sequence ought to be reconciled with cloneouts().
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
colorcomplement(struct nfa * nfa,
|
colorcomplement(struct nfa *nfa,
|
||||||
struct colormap * cm,
|
struct colormap *cm,
|
||||||
int type,
|
int type,
|
||||||
struct state * of, /* complements of this guy's PLAIN
|
struct state *of, /* complements of this guy's PLAIN
|
||||||
* outarcs */
|
* outarcs */
|
||||||
struct state * from,
|
struct state *from,
|
||||||
struct state * to)
|
struct state *to)
|
||||||
{
|
{
|
||||||
struct colordesc *cd;
|
struct colordesc *cd;
|
||||||
struct colordesc *end = CDEND(cm);
|
struct colordesc *end = CDEND(cm);
|
||||||
@ -1063,7 +1063,7 @@ colorcomplement(struct nfa * nfa,
|
|||||||
* dumpcolors - debugging output
|
* dumpcolors - debugging output
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
dumpcolors(struct colormap * cm,
|
dumpcolors(struct colormap *cm,
|
||||||
FILE *f)
|
FILE *f)
|
||||||
{
|
{
|
||||||
struct colordesc *cd;
|
struct colordesc *cd;
|
||||||
|
@ -63,7 +63,7 @@ newcvec(int nchrs, /* to hold this many chrs... */
|
|||||||
* Returns pointer as convenience.
|
* Returns pointer as convenience.
|
||||||
*/
|
*/
|
||||||
static struct cvec *
|
static struct cvec *
|
||||||
clearcvec(struct cvec * cv)
|
clearcvec(struct cvec *cv)
|
||||||
{
|
{
|
||||||
assert(cv != NULL);
|
assert(cv != NULL);
|
||||||
cv->nchrs = 0;
|
cv->nchrs = 0;
|
||||||
@ -76,7 +76,7 @@ clearcvec(struct cvec * cv)
|
|||||||
* addchr - add a chr to a cvec
|
* addchr - add a chr to a cvec
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
addchr(struct cvec * cv, /* character vector */
|
addchr(struct cvec *cv, /* character vector */
|
||||||
chr c) /* character to add */
|
chr c) /* character to add */
|
||||||
{
|
{
|
||||||
assert(cv->nchrs < cv->chrspace);
|
assert(cv->nchrs < cv->chrspace);
|
||||||
@ -87,7 +87,7 @@ addchr(struct cvec * cv, /* character vector */
|
|||||||
* addrange - add a range to a cvec
|
* addrange - add a range to a cvec
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
addrange(struct cvec * cv, /* character vector */
|
addrange(struct cvec *cv, /* character vector */
|
||||||
chr from, /* first character of range */
|
chr from, /* first character of range */
|
||||||
chr to) /* last character of range */
|
chr to) /* last character of range */
|
||||||
{
|
{
|
||||||
@ -109,7 +109,7 @@ addrange(struct cvec * cv, /* character vector */
|
|||||||
* so transientness is a convenient behavior.
|
* so transientness is a convenient behavior.
|
||||||
*/
|
*/
|
||||||
static struct cvec *
|
static struct cvec *
|
||||||
getcvec(struct vars * v, /* context */
|
getcvec(struct vars *v, /* context */
|
||||||
int nchrs, /* to hold this many chrs... */
|
int nchrs, /* to hold this many chrs... */
|
||||||
int nranges) /* ... and this many ranges */
|
int nranges) /* ... and this many ranges */
|
||||||
{
|
{
|
||||||
@ -132,7 +132,7 @@ getcvec(struct vars * v, /* context */
|
|||||||
* freecvec - free a cvec
|
* freecvec - free a cvec
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
freecvec(struct cvec * cv)
|
freecvec(struct cvec *cv)
|
||||||
{
|
{
|
||||||
FREE(cv);
|
FREE(cv);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
* lexstart - set up lexical stuff, scan leading options
|
* lexstart - set up lexical stuff, scan leading options
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
lexstart(struct vars * v)
|
lexstart(struct vars *v)
|
||||||
{
|
{
|
||||||
prefixes(v); /* may turn on new type bits etc. */
|
prefixes(v); /* may turn on new type bits etc. */
|
||||||
NOERR();
|
NOERR();
|
||||||
@ -96,7 +96,7 @@ lexstart(struct vars * v)
|
|||||||
* prefixes - implement various special prefixes
|
* prefixes - implement various special prefixes
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
prefixes(struct vars * v)
|
prefixes(struct vars *v)
|
||||||
{
|
{
|
||||||
/* literal string doesn't get any of this stuff */
|
/* literal string doesn't get any of this stuff */
|
||||||
if (v->cflags & REG_QUOTE)
|
if (v->cflags & REG_QUOTE)
|
||||||
@ -200,7 +200,7 @@ prefixes(struct vars * v)
|
|||||||
* implicit assumptions about what sorts of strings can be subroutines.
|
* implicit assumptions about what sorts of strings can be subroutines.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
lexnest(struct vars * v,
|
lexnest(struct vars *v,
|
||||||
const chr *beginp, /* start of interpolation */
|
const chr *beginp, /* start of interpolation */
|
||||||
const chr *endp) /* one past end of interpolation */
|
const chr *endp) /* one past end of interpolation */
|
||||||
{
|
{
|
||||||
@ -265,7 +265,7 @@ static const chr brbackw[] = { /* \w within brackets */
|
|||||||
* Possibly ought to inquire whether there is a "word" character class.
|
* Possibly ought to inquire whether there is a "word" character class.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
lexword(struct vars * v)
|
lexword(struct vars *v)
|
||||||
{
|
{
|
||||||
lexnest(v, backw, ENDOF(backw));
|
lexnest(v, backw, ENDOF(backw));
|
||||||
}
|
}
|
||||||
@ -274,7 +274,7 @@ lexword(struct vars * v)
|
|||||||
* next - get next token
|
* next - get next token
|
||||||
*/
|
*/
|
||||||
static int /* 1 normal, 0 failure */
|
static int /* 1 normal, 0 failure */
|
||||||
next(struct vars * v)
|
next(struct vars *v)
|
||||||
{
|
{
|
||||||
chr c;
|
chr c;
|
||||||
|
|
||||||
@ -734,7 +734,7 @@ next(struct vars * v)
|
|||||||
* Note slightly nonstandard use of the CCLASS type code.
|
* Note slightly nonstandard use of the CCLASS type code.
|
||||||
*/
|
*/
|
||||||
static int /* not actually used, but convenient for RETV */
|
static int /* not actually used, but convenient for RETV */
|
||||||
lexescape(struct vars * v)
|
lexescape(struct vars *v)
|
||||||
{
|
{
|
||||||
chr c;
|
chr c;
|
||||||
static const chr alert[] = {
|
static const chr alert[] = {
|
||||||
@ -904,7 +904,7 @@ lexescape(struct vars * v)
|
|||||||
* if maxlen is large enough to make that possible.
|
* if maxlen is large enough to make that possible.
|
||||||
*/
|
*/
|
||||||
static chr /* chr value; errors signalled via ERR */
|
static chr /* chr value; errors signalled via ERR */
|
||||||
lexdigits(struct vars * v,
|
lexdigits(struct vars *v,
|
||||||
int base,
|
int base,
|
||||||
int minlen,
|
int minlen,
|
||||||
int maxlen)
|
int maxlen)
|
||||||
@ -985,7 +985,7 @@ lexdigits(struct vars * v,
|
|||||||
* context-dependency of some things.
|
* context-dependency of some things.
|
||||||
*/
|
*/
|
||||||
static int /* 1 normal, 0 failure */
|
static int /* 1 normal, 0 failure */
|
||||||
brenext(struct vars * v,
|
brenext(struct vars *v,
|
||||||
chr c)
|
chr c)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
@ -1106,7 +1106,7 @@ brenext(struct vars * v,
|
|||||||
* skip - skip white space and comments in expanded form
|
* skip - skip white space and comments in expanded form
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
skip(struct vars * v)
|
skip(struct vars *v)
|
||||||
{
|
{
|
||||||
const chr *start = v->now;
|
const chr *start = v->now;
|
||||||
|
|
||||||
@ -1146,7 +1146,7 @@ newline(void)
|
|||||||
* use that it hardly matters.
|
* use that it hardly matters.
|
||||||
*/
|
*/
|
||||||
static chr
|
static chr
|
||||||
chrnamed(struct vars * v,
|
chrnamed(struct vars *v,
|
||||||
const chr *startp, /* start of name */
|
const chr *startp, /* start of name */
|
||||||
const chr *endp, /* just past end of name */
|
const chr *endp, /* just past end of name */
|
||||||
chr lastresort) /* what to return if name lookup fails */
|
chr lastresort) /* what to return if name lookup fails */
|
||||||
|
@ -377,7 +377,7 @@ enum classes
|
|||||||
* element - map collating-element name to chr
|
* element - map collating-element name to chr
|
||||||
*/
|
*/
|
||||||
static chr
|
static chr
|
||||||
element(struct vars * v, /* context */
|
element(struct vars *v, /* context */
|
||||||
const chr *startp, /* points to start of name */
|
const chr *startp, /* points to start of name */
|
||||||
const chr *endp) /* points just past end of name */
|
const chr *endp) /* points just past end of name */
|
||||||
{
|
{
|
||||||
@ -413,7 +413,7 @@ element(struct vars * v, /* context */
|
|||||||
* range - supply cvec for a range, including legality check
|
* range - supply cvec for a range, including legality check
|
||||||
*/
|
*/
|
||||||
static struct cvec *
|
static struct cvec *
|
||||||
range(struct vars * v, /* context */
|
range(struct vars *v, /* context */
|
||||||
chr a, /* range start */
|
chr a, /* range start */
|
||||||
chr b, /* range end, might equal a */
|
chr b, /* range end, might equal a */
|
||||||
int cases) /* case-independent? */
|
int cases) /* case-independent? */
|
||||||
@ -505,7 +505,7 @@ before(chr x, chr y)
|
|||||||
* Must include case counterparts on request.
|
* Must include case counterparts on request.
|
||||||
*/
|
*/
|
||||||
static struct cvec *
|
static struct cvec *
|
||||||
eclass(struct vars * v, /* context */
|
eclass(struct vars *v, /* context */
|
||||||
chr c, /* Collating element representing the
|
chr c, /* Collating element representing the
|
||||||
* equivalence class. */
|
* equivalence class. */
|
||||||
int cases) /* all cases? */
|
int cases) /* all cases? */
|
||||||
@ -545,14 +545,14 @@ eclass(struct vars * v, /* context */
|
|||||||
* because callers are not supposed to explicitly free the result either way.
|
* because callers are not supposed to explicitly free the result either way.
|
||||||
*/
|
*/
|
||||||
static struct cvec *
|
static struct cvec *
|
||||||
cclass(struct vars * v, /* context */
|
cclass(struct vars *v, /* context */
|
||||||
const chr *startp, /* where the name starts */
|
const chr *startp, /* where the name starts */
|
||||||
const chr *endp, /* just past the end of the name */
|
const chr *endp, /* just past the end of the name */
|
||||||
int cases) /* case-independent? */
|
int cases) /* case-independent? */
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
struct cvec *cv = NULL;
|
struct cvec *cv = NULL;
|
||||||
const char *const * namePtr;
|
const char *const *namePtr;
|
||||||
int i,
|
int i,
|
||||||
index;
|
index;
|
||||||
|
|
||||||
@ -669,7 +669,7 @@ cclass(struct vars * v, /* context */
|
|||||||
* cclass_column_index - get appropriate high colormap column index for chr
|
* cclass_column_index - get appropriate high colormap column index for chr
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
cclass_column_index(struct colormap * cm, chr c)
|
cclass_column_index(struct colormap *cm, chr c)
|
||||||
{
|
{
|
||||||
int colnum = 0;
|
int colnum = 0;
|
||||||
|
|
||||||
@ -713,7 +713,7 @@ cclass_column_index(struct colormap * cm, chr c)
|
|||||||
* messy cases are done via range().
|
* messy cases are done via range().
|
||||||
*/
|
*/
|
||||||
static struct cvec *
|
static struct cvec *
|
||||||
allcases(struct vars * v, /* context */
|
allcases(struct vars *v, /* context */
|
||||||
chr c) /* character to get case equivs of */
|
chr c) /* character to get case equivs of */
|
||||||
{
|
{
|
||||||
struct cvec *cv;
|
struct cvec *cv;
|
||||||
|
@ -44,9 +44,9 @@
|
|||||||
* newnfa - set up an NFA
|
* newnfa - set up an NFA
|
||||||
*/
|
*/
|
||||||
static struct nfa * /* the NFA, or NULL */
|
static struct nfa * /* the NFA, or NULL */
|
||||||
newnfa(struct vars * v,
|
newnfa(struct vars *v,
|
||||||
struct colormap * cm,
|
struct colormap *cm,
|
||||||
struct nfa * parent) /* NULL if primary NFA */
|
struct nfa *parent) /* NULL if primary NFA */
|
||||||
{
|
{
|
||||||
struct nfa *nfa;
|
struct nfa *nfa;
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ newnfa(struct vars * v,
|
|||||||
* freenfa - free an entire NFA
|
* freenfa - free an entire NFA
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
freenfa(struct nfa * nfa)
|
freenfa(struct nfa *nfa)
|
||||||
{
|
{
|
||||||
struct state *s;
|
struct state *s;
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ freenfa(struct nfa * nfa)
|
|||||||
* newstate - allocate an NFA state, with zero flag value
|
* newstate - allocate an NFA state, with zero flag value
|
||||||
*/
|
*/
|
||||||
static struct state * /* NULL on error */
|
static struct state * /* NULL on error */
|
||||||
newstate(struct nfa * nfa)
|
newstate(struct nfa *nfa)
|
||||||
{
|
{
|
||||||
struct state *s;
|
struct state *s;
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ newstate(struct nfa * nfa)
|
|||||||
* newfstate - allocate an NFA state with a specified flag value
|
* newfstate - allocate an NFA state with a specified flag value
|
||||||
*/
|
*/
|
||||||
static struct state * /* NULL on error */
|
static struct state * /* NULL on error */
|
||||||
newfstate(struct nfa * nfa, int flag)
|
newfstate(struct nfa *nfa, int flag)
|
||||||
{
|
{
|
||||||
struct state *s;
|
struct state *s;
|
||||||
|
|
||||||
@ -199,8 +199,8 @@ newfstate(struct nfa * nfa, int flag)
|
|||||||
* dropstate - delete a state's inarcs and outarcs and free it
|
* dropstate - delete a state's inarcs and outarcs and free it
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
dropstate(struct nfa * nfa,
|
dropstate(struct nfa *nfa,
|
||||||
struct state * s)
|
struct state *s)
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
|
|
||||||
@ -215,8 +215,8 @@ dropstate(struct nfa * nfa,
|
|||||||
* freestate - free a state, which has no in-arcs or out-arcs
|
* freestate - free a state, which has no in-arcs or out-arcs
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
freestate(struct nfa * nfa,
|
freestate(struct nfa *nfa,
|
||||||
struct state * s)
|
struct state *s)
|
||||||
{
|
{
|
||||||
assert(s != NULL);
|
assert(s != NULL);
|
||||||
assert(s->nins == 0 && s->nouts == 0);
|
assert(s->nins == 0 && s->nouts == 0);
|
||||||
@ -246,8 +246,8 @@ freestate(struct nfa * nfa,
|
|||||||
* destroystate - really get rid of an already-freed state
|
* destroystate - really get rid of an already-freed state
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
destroystate(struct nfa * nfa,
|
destroystate(struct nfa *nfa,
|
||||||
struct state * s)
|
struct state *s)
|
||||||
{
|
{
|
||||||
struct arcbatch *ab;
|
struct arcbatch *ab;
|
||||||
struct arcbatch *abnext;
|
struct arcbatch *abnext;
|
||||||
@ -273,11 +273,11 @@ destroystate(struct nfa * nfa,
|
|||||||
* In general we never want duplicates.
|
* In general we never want duplicates.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
newarc(struct nfa * nfa,
|
newarc(struct nfa *nfa,
|
||||||
int t,
|
int t,
|
||||||
color co,
|
color co,
|
||||||
struct state * from,
|
struct state *from,
|
||||||
struct state * to)
|
struct state *to)
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
|
|
||||||
@ -319,11 +319,11 @@ newarc(struct nfa * nfa,
|
|||||||
* identical arc (same type/color/from/to).
|
* identical arc (same type/color/from/to).
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
createarc(struct nfa * nfa,
|
createarc(struct nfa *nfa,
|
||||||
int t,
|
int t,
|
||||||
color co,
|
color co,
|
||||||
struct state * from,
|
struct state *from,
|
||||||
struct state * to)
|
struct state *to)
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
|
|
||||||
@ -365,8 +365,8 @@ createarc(struct nfa * nfa,
|
|||||||
* allocarc - allocate a new out-arc within a state
|
* allocarc - allocate a new out-arc within a state
|
||||||
*/
|
*/
|
||||||
static struct arc * /* NULL for failure */
|
static struct arc * /* NULL for failure */
|
||||||
allocarc(struct nfa * nfa,
|
allocarc(struct nfa *nfa,
|
||||||
struct state * s)
|
struct state *s)
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
|
|
||||||
@ -418,8 +418,8 @@ allocarc(struct nfa * nfa,
|
|||||||
* freearc - free an arc
|
* freearc - free an arc
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
freearc(struct nfa * nfa,
|
freearc(struct nfa *nfa,
|
||||||
struct arc * victim)
|
struct arc *victim)
|
||||||
{
|
{
|
||||||
struct state *from = victim->from;
|
struct state *from = victim->from;
|
||||||
struct state *to = victim->to;
|
struct state *to = victim->to;
|
||||||
@ -492,7 +492,7 @@ freearc(struct nfa * nfa,
|
|||||||
* a similar changearcsource function.
|
* a similar changearcsource function.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
changearctarget(struct arc * a, struct state * newto)
|
changearctarget(struct arc *a, struct state *newto)
|
||||||
{
|
{
|
||||||
struct state *oldto = a->to;
|
struct state *oldto = a->to;
|
||||||
struct arc *predecessor;
|
struct arc *predecessor;
|
||||||
@ -534,7 +534,7 @@ changearctarget(struct arc * a, struct state * newto)
|
|||||||
* hasnonemptyout - Does state have a non-EMPTY out arc?
|
* hasnonemptyout - Does state have a non-EMPTY out arc?
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
hasnonemptyout(struct state * s)
|
hasnonemptyout(struct state *s)
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
|
|
||||||
@ -551,7 +551,7 @@ hasnonemptyout(struct state * s)
|
|||||||
* If there is more than one such arc, the result is random.
|
* If there is more than one such arc, the result is random.
|
||||||
*/
|
*/
|
||||||
static struct arc *
|
static struct arc *
|
||||||
findarc(struct state * s,
|
findarc(struct state *s,
|
||||||
int type,
|
int type,
|
||||||
color co)
|
color co)
|
||||||
{
|
{
|
||||||
@ -567,10 +567,10 @@ findarc(struct state * s,
|
|||||||
* cparc - allocate a new arc within an NFA, copying details from old one
|
* cparc - allocate a new arc within an NFA, copying details from old one
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
cparc(struct nfa * nfa,
|
cparc(struct nfa *nfa,
|
||||||
struct arc * oa,
|
struct arc *oa,
|
||||||
struct state * from,
|
struct state *from,
|
||||||
struct state * to)
|
struct state *to)
|
||||||
{
|
{
|
||||||
newarc(nfa, oa->type, oa->co, from, to);
|
newarc(nfa, oa->type, oa->co, from, to);
|
||||||
}
|
}
|
||||||
@ -579,8 +579,8 @@ cparc(struct nfa * nfa,
|
|||||||
* sortins - sort the in arcs of a state by from/color/type
|
* sortins - sort the in arcs of a state by from/color/type
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
sortins(struct nfa * nfa,
|
sortins(struct nfa *nfa,
|
||||||
struct state * s)
|
struct state *s)
|
||||||
{
|
{
|
||||||
struct arc **sortarray;
|
struct arc **sortarray;
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
@ -623,8 +623,8 @@ sortins(struct nfa * nfa,
|
|||||||
static int
|
static int
|
||||||
sortins_cmp(const void *a, const void *b)
|
sortins_cmp(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
const struct arc *aa = *((const struct arc * const *) a);
|
const struct arc *aa = *((const struct arc *const *) a);
|
||||||
const struct arc *bb = *((const struct arc * const *) b);
|
const struct arc *bb = *((const struct arc *const *) b);
|
||||||
|
|
||||||
/* we check the fields in the order they are most likely to be different */
|
/* we check the fields in the order they are most likely to be different */
|
||||||
if (aa->from->no < bb->from->no)
|
if (aa->from->no < bb->from->no)
|
||||||
@ -646,8 +646,8 @@ sortins_cmp(const void *a, const void *b)
|
|||||||
* sortouts - sort the out arcs of a state by to/color/type
|
* sortouts - sort the out arcs of a state by to/color/type
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
sortouts(struct nfa * nfa,
|
sortouts(struct nfa *nfa,
|
||||||
struct state * s)
|
struct state *s)
|
||||||
{
|
{
|
||||||
struct arc **sortarray;
|
struct arc **sortarray;
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
@ -690,8 +690,8 @@ sortouts(struct nfa * nfa,
|
|||||||
static int
|
static int
|
||||||
sortouts_cmp(const void *a, const void *b)
|
sortouts_cmp(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
const struct arc *aa = *((const struct arc * const *) a);
|
const struct arc *aa = *((const struct arc *const *) a);
|
||||||
const struct arc *bb = *((const struct arc * const *) b);
|
const struct arc *bb = *((const struct arc *const *) b);
|
||||||
|
|
||||||
/* we check the fields in the order they are most likely to be different */
|
/* we check the fields in the order they are most likely to be different */
|
||||||
if (aa->to->no < bb->to->no)
|
if (aa->to->no < bb->to->no)
|
||||||
@ -733,9 +733,9 @@ sortouts_cmp(const void *a, const void *b)
|
|||||||
* the arc lists, and then we can indeed just update the arcs in-place.
|
* the arc lists, and then we can indeed just update the arcs in-place.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
moveins(struct nfa * nfa,
|
moveins(struct nfa *nfa,
|
||||||
struct state * oldState,
|
struct state *oldState,
|
||||||
struct state * newState)
|
struct state *newState)
|
||||||
{
|
{
|
||||||
assert(oldState != newState);
|
assert(oldState != newState);
|
||||||
|
|
||||||
@ -825,9 +825,9 @@ moveins(struct nfa * nfa,
|
|||||||
* copyins - copy in arcs of a state to another state
|
* copyins - copy in arcs of a state to another state
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
copyins(struct nfa * nfa,
|
copyins(struct nfa *nfa,
|
||||||
struct state * oldState,
|
struct state *oldState,
|
||||||
struct state * newState)
|
struct state *newState)
|
||||||
{
|
{
|
||||||
assert(oldState != newState);
|
assert(oldState != newState);
|
||||||
|
|
||||||
@ -907,9 +907,9 @@ copyins(struct nfa * nfa,
|
|||||||
* and are not guaranteed unique. It's okay to clobber the array contents.
|
* and are not guaranteed unique. It's okay to clobber the array contents.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
mergeins(struct nfa * nfa,
|
mergeins(struct nfa *nfa,
|
||||||
struct state * s,
|
struct state *s,
|
||||||
struct arc ** arcarray,
|
struct arc **arcarray,
|
||||||
int arccount)
|
int arccount)
|
||||||
{
|
{
|
||||||
struct arc *na;
|
struct arc *na;
|
||||||
@ -1004,9 +1004,9 @@ mergeins(struct nfa * nfa,
|
|||||||
* moveouts - move all out arcs of a state to another state
|
* moveouts - move all out arcs of a state to another state
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
moveouts(struct nfa * nfa,
|
moveouts(struct nfa *nfa,
|
||||||
struct state * oldState,
|
struct state *oldState,
|
||||||
struct state * newState)
|
struct state *newState)
|
||||||
{
|
{
|
||||||
assert(oldState != newState);
|
assert(oldState != newState);
|
||||||
|
|
||||||
@ -1093,9 +1093,9 @@ moveouts(struct nfa * nfa,
|
|||||||
* copyouts - copy out arcs of a state to another state
|
* copyouts - copy out arcs of a state to another state
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
copyouts(struct nfa * nfa,
|
copyouts(struct nfa *nfa,
|
||||||
struct state * oldState,
|
struct state *oldState,
|
||||||
struct state * newState)
|
struct state *newState)
|
||||||
{
|
{
|
||||||
assert(oldState != newState);
|
assert(oldState != newState);
|
||||||
|
|
||||||
@ -1172,10 +1172,10 @@ copyouts(struct nfa * nfa,
|
|||||||
* cloneouts - copy out arcs of a state to another state pair, modifying type
|
* cloneouts - copy out arcs of a state to another state pair, modifying type
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
cloneouts(struct nfa * nfa,
|
cloneouts(struct nfa *nfa,
|
||||||
struct state * old,
|
struct state *old,
|
||||||
struct state * from,
|
struct state *from,
|
||||||
struct state * to,
|
struct state *to,
|
||||||
int type)
|
int type)
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
@ -1193,9 +1193,9 @@ cloneouts(struct nfa * nfa,
|
|||||||
* states using their tmp pointer.
|
* states using their tmp pointer.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
delsub(struct nfa * nfa,
|
delsub(struct nfa *nfa,
|
||||||
struct state * lp, /* the sub-NFA goes from here... */
|
struct state *lp, /* the sub-NFA goes from here... */
|
||||||
struct state * rp) /* ...to here, *not* inclusive */
|
struct state *rp) /* ...to here, *not* inclusive */
|
||||||
{
|
{
|
||||||
assert(lp != rp);
|
assert(lp != rp);
|
||||||
|
|
||||||
@ -1216,9 +1216,9 @@ delsub(struct nfa * nfa,
|
|||||||
* This routine's basic job is to destroy all out-arcs of the state.
|
* This routine's basic job is to destroy all out-arcs of the state.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
deltraverse(struct nfa * nfa,
|
deltraverse(struct nfa *nfa,
|
||||||
struct state * leftend,
|
struct state *leftend,
|
||||||
struct state * s)
|
struct state *s)
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
struct state *to;
|
struct state *to;
|
||||||
@ -1267,11 +1267,11 @@ deltraverse(struct nfa * nfa,
|
|||||||
* it's a state pointer, didn't you? :-))
|
* it's a state pointer, didn't you? :-))
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
dupnfa(struct nfa * nfa,
|
dupnfa(struct nfa *nfa,
|
||||||
struct state * start, /* duplicate of subNFA starting here */
|
struct state *start, /* duplicate of subNFA starting here */
|
||||||
struct state * stop, /* and stopping here */
|
struct state *stop, /* and stopping here */
|
||||||
struct state * from, /* stringing duplicate from here */
|
struct state *from, /* stringing duplicate from here */
|
||||||
struct state * to) /* to here */
|
struct state *to) /* to here */
|
||||||
{
|
{
|
||||||
if (start == stop)
|
if (start == stop)
|
||||||
{
|
{
|
||||||
@ -1291,9 +1291,9 @@ dupnfa(struct nfa * nfa,
|
|||||||
* duptraverse - recursive heart of dupnfa
|
* duptraverse - recursive heart of dupnfa
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
duptraverse(struct nfa * nfa,
|
duptraverse(struct nfa *nfa,
|
||||||
struct state * s,
|
struct state *s,
|
||||||
struct state * stmp) /* s's duplicate, or NULL */
|
struct state *stmp) /* s's duplicate, or NULL */
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
|
|
||||||
@ -1328,8 +1328,8 @@ duptraverse(struct nfa * nfa,
|
|||||||
* cleartraverse - recursive cleanup for algorithms that leave tmp ptrs set
|
* cleartraverse - recursive cleanup for algorithms that leave tmp ptrs set
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
cleartraverse(struct nfa * nfa,
|
cleartraverse(struct nfa *nfa,
|
||||||
struct state * s)
|
struct state *s)
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
|
|
||||||
@ -1365,7 +1365,7 @@ cleartraverse(struct nfa * nfa,
|
|||||||
* that implementation detail not create user-visible performance differences.
|
* that implementation detail not create user-visible performance differences.
|
||||||
*/
|
*/
|
||||||
static struct state *
|
static struct state *
|
||||||
single_color_transition(struct state * s1, struct state * s2)
|
single_color_transition(struct state *s1, struct state *s2)
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
|
|
||||||
@ -1395,7 +1395,7 @@ single_color_transition(struct state * s1, struct state * s2)
|
|||||||
* specialcolors - fill in special colors for an NFA
|
* specialcolors - fill in special colors for an NFA
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
specialcolors(struct nfa * nfa)
|
specialcolors(struct nfa *nfa)
|
||||||
{
|
{
|
||||||
/* false colors for BOS, BOL, EOS, EOL */
|
/* false colors for BOS, BOL, EOS, EOL */
|
||||||
if (nfa->parent == NULL)
|
if (nfa->parent == NULL)
|
||||||
@ -1434,7 +1434,7 @@ specialcolors(struct nfa * nfa)
|
|||||||
* without making any progress in the input string.
|
* without making any progress in the input string.
|
||||||
*/
|
*/
|
||||||
static long /* re_info bits */
|
static long /* re_info bits */
|
||||||
optimize(struct nfa * nfa,
|
optimize(struct nfa *nfa,
|
||||||
FILE *f) /* for debug output; NULL none */
|
FILE *f) /* for debug output; NULL none */
|
||||||
{
|
{
|
||||||
#ifdef REG_DEBUG
|
#ifdef REG_DEBUG
|
||||||
@ -1474,7 +1474,7 @@ optimize(struct nfa * nfa,
|
|||||||
* pullback - pull back constraints backward to eliminate them
|
* pullback - pull back constraints backward to eliminate them
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pullback(struct nfa * nfa,
|
pullback(struct nfa *nfa,
|
||||||
FILE *f) /* for debug output; NULL none */
|
FILE *f) /* for debug output; NULL none */
|
||||||
{
|
{
|
||||||
struct state *s;
|
struct state *s;
|
||||||
@ -1554,9 +1554,9 @@ pullback(struct nfa * nfa,
|
|||||||
* through their tmp fields).
|
* through their tmp fields).
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
pull(struct nfa * nfa,
|
pull(struct nfa *nfa,
|
||||||
struct arc * con,
|
struct arc *con,
|
||||||
struct state ** intermediates)
|
struct state **intermediates)
|
||||||
{
|
{
|
||||||
struct state *from = con->from;
|
struct state *from = con->from;
|
||||||
struct state *to = con->to;
|
struct state *to = con->to;
|
||||||
@ -1641,7 +1641,7 @@ pull(struct nfa * nfa,
|
|||||||
* pushfwd - push forward constraints forward to eliminate them
|
* pushfwd - push forward constraints forward to eliminate them
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pushfwd(struct nfa * nfa,
|
pushfwd(struct nfa *nfa,
|
||||||
FILE *f) /* for debug output; NULL none */
|
FILE *f) /* for debug output; NULL none */
|
||||||
{
|
{
|
||||||
struct state *s;
|
struct state *s;
|
||||||
@ -1721,9 +1721,9 @@ pushfwd(struct nfa * nfa,
|
|||||||
* through their tmp fields).
|
* through their tmp fields).
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
push(struct nfa * nfa,
|
push(struct nfa *nfa,
|
||||||
struct arc * con,
|
struct arc *con,
|
||||||
struct state ** intermediates)
|
struct state **intermediates)
|
||||||
{
|
{
|
||||||
struct state *from = con->from;
|
struct state *from = con->from;
|
||||||
struct state *to = con->to;
|
struct state *to = con->to;
|
||||||
@ -1812,8 +1812,8 @@ push(struct nfa * nfa,
|
|||||||
* #def COMPATIBLE 3 // compatible but not satisfied yet
|
* #def COMPATIBLE 3 // compatible but not satisfied yet
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
combine(struct arc * con,
|
combine(struct arc *con,
|
||||||
struct arc * a)
|
struct arc *a)
|
||||||
{
|
{
|
||||||
#define CA(ct,at) (((ct)<<CHAR_BIT) | (at))
|
#define CA(ct,at) (((ct)<<CHAR_BIT) | (at))
|
||||||
|
|
||||||
@ -1866,7 +1866,7 @@ combine(struct arc * con,
|
|||||||
* fixempties - get rid of EMPTY arcs
|
* fixempties - get rid of EMPTY arcs
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
fixempties(struct nfa * nfa,
|
fixempties(struct nfa *nfa,
|
||||||
FILE *f) /* for debug output; NULL none */
|
FILE *f) /* for debug output; NULL none */
|
||||||
{
|
{
|
||||||
struct state *s;
|
struct state *s;
|
||||||
@ -2093,10 +2093,10 @@ fixempties(struct nfa * nfa,
|
|||||||
* the NFA ... but that could still be enough to cause trouble.
|
* the NFA ... but that could still be enough to cause trouble.
|
||||||
*/
|
*/
|
||||||
static struct state *
|
static struct state *
|
||||||
emptyreachable(struct nfa * nfa,
|
emptyreachable(struct nfa *nfa,
|
||||||
struct state * s,
|
struct state *s,
|
||||||
struct state * lastfound,
|
struct state *lastfound,
|
||||||
struct arc ** inarcsorig)
|
struct arc **inarcsorig)
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
|
|
||||||
@ -2121,7 +2121,7 @@ emptyreachable(struct nfa * nfa,
|
|||||||
* isconstraintarc - detect whether an arc is of a constraint type
|
* isconstraintarc - detect whether an arc is of a constraint type
|
||||||
*/
|
*/
|
||||||
static inline int
|
static inline int
|
||||||
isconstraintarc(struct arc * a)
|
isconstraintarc(struct arc *a)
|
||||||
{
|
{
|
||||||
switch (a->type)
|
switch (a->type)
|
||||||
{
|
{
|
||||||
@ -2139,7 +2139,7 @@ isconstraintarc(struct arc * a)
|
|||||||
* hasconstraintout - does state have a constraint out arc?
|
* hasconstraintout - does state have a constraint out arc?
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
hasconstraintout(struct state * s)
|
hasconstraintout(struct state *s)
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
|
|
||||||
@ -2160,7 +2160,7 @@ hasconstraintout(struct state * s)
|
|||||||
* of such loops before doing that.
|
* of such loops before doing that.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
fixconstraintloops(struct nfa * nfa,
|
fixconstraintloops(struct nfa *nfa,
|
||||||
FILE *f) /* for debug output; NULL none */
|
FILE *f) /* for debug output; NULL none */
|
||||||
{
|
{
|
||||||
struct state *s;
|
struct state *s;
|
||||||
@ -2259,7 +2259,7 @@ restart:
|
|||||||
* of the NFA ... but that could still be enough to cause trouble.
|
* of the NFA ... but that could still be enough to cause trouble.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
findconstraintloop(struct nfa * nfa, struct state * s)
|
findconstraintloop(struct nfa *nfa, struct state *s)
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
|
|
||||||
@ -2348,7 +2348,7 @@ findconstraintloop(struct nfa * nfa, struct state * s)
|
|||||||
* break the loop just by removing those loop arcs, with no new states added.
|
* break the loop just by removing those loop arcs, with no new states added.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
breakconstraintloop(struct nfa * nfa, struct state * sinitial)
|
breakconstraintloop(struct nfa *nfa, struct state *sinitial)
|
||||||
{
|
{
|
||||||
struct state *s;
|
struct state *s;
|
||||||
struct state *shead;
|
struct state *shead;
|
||||||
@ -2494,11 +2494,11 @@ breakconstraintloop(struct nfa * nfa, struct state * sinitial)
|
|||||||
* successor states.
|
* successor states.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
clonesuccessorstates(struct nfa * nfa,
|
clonesuccessorstates(struct nfa *nfa,
|
||||||
struct state * ssource,
|
struct state *ssource,
|
||||||
struct state * sclone,
|
struct state *sclone,
|
||||||
struct state * spredecessor,
|
struct state *spredecessor,
|
||||||
struct arc * refarc,
|
struct arc *refarc,
|
||||||
char *curdonemap,
|
char *curdonemap,
|
||||||
char *outerdonemap,
|
char *outerdonemap,
|
||||||
int nstates)
|
int nstates)
|
||||||
@ -2726,7 +2726,7 @@ clonesuccessorstates(struct nfa * nfa,
|
|||||||
* cleanup - clean up NFA after optimizations
|
* cleanup - clean up NFA after optimizations
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
cleanup(struct nfa * nfa)
|
cleanup(struct nfa *nfa)
|
||||||
{
|
{
|
||||||
struct state *s;
|
struct state *s;
|
||||||
struct state *nexts;
|
struct state *nexts;
|
||||||
@ -2761,10 +2761,10 @@ cleanup(struct nfa * nfa)
|
|||||||
* markreachable - recursive marking of reachable states
|
* markreachable - recursive marking of reachable states
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
markreachable(struct nfa * nfa,
|
markreachable(struct nfa *nfa,
|
||||||
struct state * s,
|
struct state *s,
|
||||||
struct state * okay, /* consider only states with this mark */
|
struct state *okay, /* consider only states with this mark */
|
||||||
struct state * mark) /* the value to mark with */
|
struct state *mark) /* the value to mark with */
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
|
|
||||||
@ -2787,10 +2787,10 @@ markreachable(struct nfa * nfa,
|
|||||||
* markcanreach - recursive marking of states which can reach here
|
* markcanreach - recursive marking of states which can reach here
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
markcanreach(struct nfa * nfa,
|
markcanreach(struct nfa *nfa,
|
||||||
struct state * s,
|
struct state *s,
|
||||||
struct state * okay, /* consider only states with this mark */
|
struct state *okay, /* consider only states with this mark */
|
||||||
struct state * mark) /* the value to mark with */
|
struct state *mark) /* the value to mark with */
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
|
|
||||||
@ -2813,7 +2813,7 @@ markcanreach(struct nfa * nfa,
|
|||||||
* analyze - ascertain potentially-useful facts about an optimized NFA
|
* analyze - ascertain potentially-useful facts about an optimized NFA
|
||||||
*/
|
*/
|
||||||
static long /* re_info bits to be ORed in */
|
static long /* re_info bits to be ORed in */
|
||||||
analyze(struct nfa * nfa)
|
analyze(struct nfa *nfa)
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
struct arc *aa;
|
struct arc *aa;
|
||||||
@ -2834,8 +2834,8 @@ analyze(struct nfa * nfa)
|
|||||||
* compact - construct the compact representation of an NFA
|
* compact - construct the compact representation of an NFA
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
compact(struct nfa * nfa,
|
compact(struct nfa *nfa,
|
||||||
struct cnfa * cnfa)
|
struct cnfa *cnfa)
|
||||||
{
|
{
|
||||||
struct state *s;
|
struct state *s;
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
@ -2922,7 +2922,7 @@ compact(struct nfa * nfa,
|
|||||||
* carcsort - sort compacted-NFA arcs by color
|
* carcsort - sort compacted-NFA arcs by color
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
carcsort(struct carc * first, size_t n)
|
carcsort(struct carc *first, size_t n)
|
||||||
{
|
{
|
||||||
if (n > 1)
|
if (n > 1)
|
||||||
qsort(first, n, sizeof(struct carc), carc_cmp);
|
qsort(first, n, sizeof(struct carc), carc_cmp);
|
||||||
@ -2949,7 +2949,7 @@ carc_cmp(const void *a, const void *b)
|
|||||||
* freecnfa - free a compacted NFA
|
* freecnfa - free a compacted NFA
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
freecnfa(struct cnfa * cnfa)
|
freecnfa(struct cnfa *cnfa)
|
||||||
{
|
{
|
||||||
assert(cnfa->nstates != 0); /* not empty already */
|
assert(cnfa->nstates != 0); /* not empty already */
|
||||||
cnfa->nstates = 0;
|
cnfa->nstates = 0;
|
||||||
@ -2962,7 +2962,7 @@ freecnfa(struct cnfa * cnfa)
|
|||||||
* dumpnfa - dump an NFA in human-readable form
|
* dumpnfa - dump an NFA in human-readable form
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
dumpnfa(struct nfa * nfa,
|
dumpnfa(struct nfa *nfa,
|
||||||
FILE *f)
|
FILE *f)
|
||||||
{
|
{
|
||||||
#ifdef REG_DEBUG
|
#ifdef REG_DEBUG
|
||||||
@ -2999,7 +2999,7 @@ dumpnfa(struct nfa * nfa,
|
|||||||
* dumpstate - dump an NFA state in human-readable form
|
* dumpstate - dump an NFA state in human-readable form
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
dumpstate(struct state * s,
|
dumpstate(struct state *s,
|
||||||
FILE *f)
|
FILE *f)
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
@ -3025,7 +3025,7 @@ dumpstate(struct state * s,
|
|||||||
* dumparcs - dump out-arcs in human-readable form
|
* dumparcs - dump out-arcs in human-readable form
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
dumparcs(struct state * s,
|
dumparcs(struct state *s,
|
||||||
FILE *f)
|
FILE *f)
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
@ -3057,8 +3057,8 @@ dumparcs(struct state * s,
|
|||||||
* dumparc - dump one outarc in readable form, including prefixing tab
|
* dumparc - dump one outarc in readable form, including prefixing tab
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
dumparc(struct arc * a,
|
dumparc(struct arc *a,
|
||||||
struct state * s,
|
struct state *s,
|
||||||
FILE *f)
|
FILE *f)
|
||||||
{
|
{
|
||||||
struct arc *aa;
|
struct arc *aa;
|
||||||
@ -3121,7 +3121,7 @@ dumparc(struct arc * a,
|
|||||||
*/
|
*/
|
||||||
#ifdef REG_DEBUG
|
#ifdef REG_DEBUG
|
||||||
static void
|
static void
|
||||||
dumpcnfa(struct cnfa * cnfa,
|
dumpcnfa(struct cnfa *cnfa,
|
||||||
FILE *f)
|
FILE *f)
|
||||||
{
|
{
|
||||||
int st;
|
int st;
|
||||||
@ -3151,7 +3151,7 @@ dumpcnfa(struct cnfa * cnfa,
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
dumpcstate(int st,
|
dumpcstate(int st,
|
||||||
struct cnfa * cnfa,
|
struct cnfa *cnfa,
|
||||||
FILE *f)
|
FILE *f)
|
||||||
{
|
{
|
||||||
struct carc *ca;
|
struct carc *ca;
|
||||||
|
@ -491,14 +491,14 @@ pg_regcomp(regex_t *re,
|
|||||||
* moresubs - enlarge subRE vector
|
* moresubs - enlarge subRE vector
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
moresubs(struct vars * v,
|
moresubs(struct vars *v,
|
||||||
int wanted) /* want enough room for this one */
|
int wanted) /* want enough room for this one */
|
||||||
{
|
{
|
||||||
struct subre **p;
|
struct subre **p;
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
assert(wanted > 0 && (size_t) wanted >= v->nsubs);
|
assert(wanted > 0 && (size_t) wanted >= v->nsubs);
|
||||||
n = (size_t) wanted *3 / 2 + 1;
|
n = (size_t) wanted * 3 / 2 + 1;
|
||||||
|
|
||||||
if (v->subs == v->sub10)
|
if (v->subs == v->sub10)
|
||||||
{
|
{
|
||||||
@ -528,7 +528,7 @@ moresubs(struct vars * v,
|
|||||||
* (if any), to make error-handling code terser.
|
* (if any), to make error-handling code terser.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
freev(struct vars * v,
|
freev(struct vars *v,
|
||||||
int err)
|
int err)
|
||||||
{
|
{
|
||||||
if (v->re != NULL)
|
if (v->re != NULL)
|
||||||
@ -557,8 +557,8 @@ freev(struct vars * v,
|
|||||||
* NFA must have been optimize()d already.
|
* NFA must have been optimize()d already.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
makesearch(struct vars * v,
|
makesearch(struct vars *v,
|
||||||
struct nfa * nfa)
|
struct nfa *nfa)
|
||||||
{
|
{
|
||||||
struct arc *a;
|
struct arc *a;
|
||||||
struct arc *b;
|
struct arc *b;
|
||||||
@ -646,11 +646,11 @@ makesearch(struct vars * v,
|
|||||||
* of a chain of '|' subres.
|
* of a chain of '|' subres.
|
||||||
*/
|
*/
|
||||||
static struct subre *
|
static struct subre *
|
||||||
parse(struct vars * v,
|
parse(struct vars *v,
|
||||||
int stopper, /* EOS or ')' */
|
int stopper, /* EOS or ')' */
|
||||||
int type, /* LACON (lookaround subRE) or PLAIN */
|
int type, /* LACON (lookaround subRE) or PLAIN */
|
||||||
struct state * init, /* initial state */
|
struct state *init, /* initial state */
|
||||||
struct state * final) /* final state */
|
struct state *final) /* final state */
|
||||||
{
|
{
|
||||||
struct state *left; /* scaffolding for branch */
|
struct state *left; /* scaffolding for branch */
|
||||||
struct state *right;
|
struct state *right;
|
||||||
@ -725,11 +725,11 @@ parse(struct vars * v,
|
|||||||
* ',' nodes introduced only when necessary due to substructure.
|
* ',' nodes introduced only when necessary due to substructure.
|
||||||
*/
|
*/
|
||||||
static struct subre *
|
static struct subre *
|
||||||
parsebranch(struct vars * v,
|
parsebranch(struct vars *v,
|
||||||
int stopper, /* EOS or ')' */
|
int stopper, /* EOS or ')' */
|
||||||
int type, /* LACON (lookaround subRE) or PLAIN */
|
int type, /* LACON (lookaround subRE) or PLAIN */
|
||||||
struct state * left, /* leftmost state */
|
struct state *left, /* leftmost state */
|
||||||
struct state * right, /* rightmost state */
|
struct state *right, /* rightmost state */
|
||||||
int partial) /* is this only part of a branch? */
|
int partial) /* is this only part of a branch? */
|
||||||
{
|
{
|
||||||
struct state *lp; /* left end of current construct */
|
struct state *lp; /* left end of current construct */
|
||||||
@ -774,12 +774,12 @@ parsebranch(struct vars * v,
|
|||||||
* of the branch, making this function's name somewhat inaccurate.
|
* of the branch, making this function's name somewhat inaccurate.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
parseqatom(struct vars * v,
|
parseqatom(struct vars *v,
|
||||||
int stopper, /* EOS or ')' */
|
int stopper, /* EOS or ')' */
|
||||||
int type, /* LACON (lookaround subRE) or PLAIN */
|
int type, /* LACON (lookaround subRE) or PLAIN */
|
||||||
struct state * lp, /* left state to hang it on */
|
struct state *lp, /* left state to hang it on */
|
||||||
struct state * rp, /* right state to hang it on */
|
struct state *rp, /* right state to hang it on */
|
||||||
struct subre * top) /* subtree top */
|
struct subre *top) /* subtree top */
|
||||||
{
|
{
|
||||||
struct state *s; /* temporaries for new states */
|
struct state *s; /* temporaries for new states */
|
||||||
struct state *s2;
|
struct state *s2;
|
||||||
@ -1222,10 +1222,10 @@ parseqatom(struct vars * v,
|
|||||||
* nonword - generate arcs for non-word-character ahead or behind
|
* nonword - generate arcs for non-word-character ahead or behind
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
nonword(struct vars * v,
|
nonword(struct vars *v,
|
||||||
int dir, /* AHEAD or BEHIND */
|
int dir, /* AHEAD or BEHIND */
|
||||||
struct state * lp,
|
struct state *lp,
|
||||||
struct state * rp)
|
struct state *rp)
|
||||||
{
|
{
|
||||||
int anchor = (dir == AHEAD) ? '$' : '^';
|
int anchor = (dir == AHEAD) ? '$' : '^';
|
||||||
|
|
||||||
@ -1240,10 +1240,10 @@ nonword(struct vars * v,
|
|||||||
* word - generate arcs for word character ahead or behind
|
* word - generate arcs for word character ahead or behind
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
word(struct vars * v,
|
word(struct vars *v,
|
||||||
int dir, /* AHEAD or BEHIND */
|
int dir, /* AHEAD or BEHIND */
|
||||||
struct state * lp,
|
struct state *lp,
|
||||||
struct state * rp)
|
struct state *rp)
|
||||||
{
|
{
|
||||||
assert(dir == AHEAD || dir == BEHIND);
|
assert(dir == AHEAD || dir == BEHIND);
|
||||||
cloneouts(v->nfa, v->wordchrs, lp, rp, dir);
|
cloneouts(v->nfa, v->wordchrs, lp, rp, dir);
|
||||||
@ -1254,7 +1254,7 @@ word(struct vars * v,
|
|||||||
* scannum - scan a number
|
* scannum - scan a number
|
||||||
*/
|
*/
|
||||||
static int /* value, <= DUPMAX */
|
static int /* value, <= DUPMAX */
|
||||||
scannum(struct vars * v)
|
scannum(struct vars *v)
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
@ -1285,9 +1285,9 @@ scannum(struct vars * v)
|
|||||||
* code in parse(), and when this is called, it doesn't matter any more.
|
* code in parse(), and when this is called, it doesn't matter any more.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
repeat(struct vars * v,
|
repeat(struct vars *v,
|
||||||
struct state * lp,
|
struct state *lp,
|
||||||
struct state * rp,
|
struct state *rp,
|
||||||
int m,
|
int m,
|
||||||
int n)
|
int n)
|
||||||
{
|
{
|
||||||
@ -1371,9 +1371,9 @@ repeat(struct vars * v,
|
|||||||
* Also called from cbracket for complemented bracket expressions.
|
* Also called from cbracket for complemented bracket expressions.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
bracket(struct vars * v,
|
bracket(struct vars *v,
|
||||||
struct state * lp,
|
struct state *lp,
|
||||||
struct state * rp)
|
struct state *rp)
|
||||||
{
|
{
|
||||||
assert(SEE('['));
|
assert(SEE('['));
|
||||||
NEXT();
|
NEXT();
|
||||||
@ -1390,9 +1390,9 @@ bracket(struct vars * v,
|
|||||||
* arcs as the b.e. is seen... but that gets messy.
|
* arcs as the b.e. is seen... but that gets messy.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
cbracket(struct vars * v,
|
cbracket(struct vars *v,
|
||||||
struct state * lp,
|
struct state *lp,
|
||||||
struct state * rp)
|
struct state *rp)
|
||||||
{
|
{
|
||||||
struct state *left = newstate(v->nfa);
|
struct state *left = newstate(v->nfa);
|
||||||
struct state *right = newstate(v->nfa);
|
struct state *right = newstate(v->nfa);
|
||||||
@ -1420,9 +1420,9 @@ cbracket(struct vars * v,
|
|||||||
* brackpart - handle one item (or range) within a bracket expression
|
* brackpart - handle one item (or range) within a bracket expression
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
brackpart(struct vars * v,
|
brackpart(struct vars *v,
|
||||||
struct state * lp,
|
struct state *lp,
|
||||||
struct state * rp)
|
struct state *rp)
|
||||||
{
|
{
|
||||||
chr startc;
|
chr startc;
|
||||||
chr endc;
|
chr endc;
|
||||||
@ -1533,7 +1533,7 @@ brackpart(struct vars * v,
|
|||||||
* to look past the final bracket of the [. etc.
|
* to look past the final bracket of the [. etc.
|
||||||
*/
|
*/
|
||||||
static const chr * /* just after end of sequence */
|
static const chr * /* just after end of sequence */
|
||||||
scanplain(struct vars * v)
|
scanplain(struct vars *v)
|
||||||
{
|
{
|
||||||
const chr *endp;
|
const chr *endp;
|
||||||
|
|
||||||
@ -1558,10 +1558,10 @@ scanplain(struct vars * v)
|
|||||||
* This is mostly a shortcut for efficient handling of the common case.
|
* This is mostly a shortcut for efficient handling of the common case.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
onechr(struct vars * v,
|
onechr(struct vars *v,
|
||||||
chr c,
|
chr c,
|
||||||
struct state * lp,
|
struct state *lp,
|
||||||
struct state * rp)
|
struct state *rp)
|
||||||
{
|
{
|
||||||
if (!(v->cflags & REG_ICASE))
|
if (!(v->cflags & REG_ICASE))
|
||||||
{
|
{
|
||||||
@ -1585,7 +1585,7 @@ onechr(struct vars * v,
|
|||||||
* should be cleaned up to reduce dependencies on input scanning.
|
* should be cleaned up to reduce dependencies on input scanning.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
wordchrs(struct vars * v)
|
wordchrs(struct vars *v)
|
||||||
{
|
{
|
||||||
struct state *left;
|
struct state *left;
|
||||||
struct state *right;
|
struct state *right;
|
||||||
@ -1617,12 +1617,12 @@ wordchrs(struct vars * v)
|
|||||||
* can be optimized.
|
* can be optimized.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
processlacon(struct vars * v,
|
processlacon(struct vars *v,
|
||||||
struct state * begin, /* start of parsed LACON sub-re */
|
struct state *begin, /* start of parsed LACON sub-re */
|
||||||
struct state * end, /* end of parsed LACON sub-re */
|
struct state *end, /* end of parsed LACON sub-re */
|
||||||
int latype,
|
int latype,
|
||||||
struct state * lp, /* left state to hang it on */
|
struct state *lp, /* left state to hang it on */
|
||||||
struct state * rp) /* right state to hang it on */
|
struct state *rp) /* right state to hang it on */
|
||||||
{
|
{
|
||||||
struct state *s1;
|
struct state *s1;
|
||||||
int n;
|
int n;
|
||||||
@ -1683,11 +1683,11 @@ processlacon(struct vars * v,
|
|||||||
* subre - allocate a subre
|
* subre - allocate a subre
|
||||||
*/
|
*/
|
||||||
static struct subre *
|
static struct subre *
|
||||||
subre(struct vars * v,
|
subre(struct vars *v,
|
||||||
int op,
|
int op,
|
||||||
int flags,
|
int flags,
|
||||||
struct state * begin,
|
struct state *begin,
|
||||||
struct state * end)
|
struct state *end)
|
||||||
{
|
{
|
||||||
struct subre *ret = v->treefree;
|
struct subre *ret = v->treefree;
|
||||||
|
|
||||||
@ -1735,8 +1735,8 @@ subre(struct vars * v,
|
|||||||
* freesubre - free a subRE subtree
|
* freesubre - free a subRE subtree
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
freesubre(struct vars * v, /* might be NULL */
|
freesubre(struct vars *v, /* might be NULL */
|
||||||
struct subre * sr)
|
struct subre *sr)
|
||||||
{
|
{
|
||||||
if (sr == NULL)
|
if (sr == NULL)
|
||||||
return;
|
return;
|
||||||
@ -1753,8 +1753,8 @@ freesubre(struct vars * v, /* might be NULL */
|
|||||||
* freesrnode - free one node in a subRE subtree
|
* freesrnode - free one node in a subRE subtree
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
freesrnode(struct vars * v, /* might be NULL */
|
freesrnode(struct vars *v, /* might be NULL */
|
||||||
struct subre * sr)
|
struct subre *sr)
|
||||||
{
|
{
|
||||||
if (sr == NULL)
|
if (sr == NULL)
|
||||||
return;
|
return;
|
||||||
@ -1777,8 +1777,8 @@ freesrnode(struct vars * v, /* might be NULL */
|
|||||||
* optst - optimize a subRE subtree
|
* optst - optimize a subRE subtree
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
optst(struct vars * v,
|
optst(struct vars *v,
|
||||||
struct subre * t)
|
struct subre *t)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* DGP (2007-11-13): I assume it was the programmer's intent to eventually
|
* DGP (2007-11-13): I assume it was the programmer's intent to eventually
|
||||||
@ -1793,7 +1793,7 @@ optst(struct vars * v,
|
|||||||
* numst - number tree nodes (assigning "id" indexes)
|
* numst - number tree nodes (assigning "id" indexes)
|
||||||
*/
|
*/
|
||||||
static int /* next number */
|
static int /* next number */
|
||||||
numst(struct subre * t,
|
numst(struct subre *t,
|
||||||
int start) /* starting point for subtree numbers */
|
int start) /* starting point for subtree numbers */
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -1827,7 +1827,7 @@ numst(struct subre * t,
|
|||||||
* in or between these two functions.
|
* in or between these two functions.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
markst(struct subre * t)
|
markst(struct subre *t)
|
||||||
{
|
{
|
||||||
assert(t != NULL);
|
assert(t != NULL);
|
||||||
|
|
||||||
@ -1842,7 +1842,7 @@ markst(struct subre * t)
|
|||||||
* cleanst - free any tree nodes not marked INUSE
|
* cleanst - free any tree nodes not marked INUSE
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
cleanst(struct vars * v)
|
cleanst(struct vars *v)
|
||||||
{
|
{
|
||||||
struct subre *t;
|
struct subre *t;
|
||||||
struct subre *next;
|
struct subre *next;
|
||||||
@ -1861,8 +1861,8 @@ cleanst(struct vars * v)
|
|||||||
* nfatree - turn a subRE subtree into a tree of compacted NFAs
|
* nfatree - turn a subRE subtree into a tree of compacted NFAs
|
||||||
*/
|
*/
|
||||||
static long /* optimize results from top node */
|
static long /* optimize results from top node */
|
||||||
nfatree(struct vars * v,
|
nfatree(struct vars *v,
|
||||||
struct subre * t,
|
struct subre *t,
|
||||||
FILE *f) /* for debug output */
|
FILE *f) /* for debug output */
|
||||||
{
|
{
|
||||||
assert(t != NULL && t->begin != NULL);
|
assert(t != NULL && t->begin != NULL);
|
||||||
@ -1881,8 +1881,8 @@ nfatree(struct vars * v,
|
|||||||
* If converttosearch is true, apply makesearch() to the NFA.
|
* If converttosearch is true, apply makesearch() to the NFA.
|
||||||
*/
|
*/
|
||||||
static long /* optimize results */
|
static long /* optimize results */
|
||||||
nfanode(struct vars * v,
|
nfanode(struct vars *v,
|
||||||
struct subre * t,
|
struct subre *t,
|
||||||
int converttosearch,
|
int converttosearch,
|
||||||
FILE *f) /* for debug output */
|
FILE *f) /* for debug output */
|
||||||
{
|
{
|
||||||
@ -1920,9 +1920,9 @@ nfanode(struct vars * v,
|
|||||||
* newlacon - allocate a lookaround-constraint subRE
|
* newlacon - allocate a lookaround-constraint subRE
|
||||||
*/
|
*/
|
||||||
static int /* lacon number */
|
static int /* lacon number */
|
||||||
newlacon(struct vars * v,
|
newlacon(struct vars *v,
|
||||||
struct state * begin,
|
struct state *begin,
|
||||||
struct state * end,
|
struct state *end,
|
||||||
int latype)
|
int latype)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
@ -1959,7 +1959,7 @@ newlacon(struct vars * v,
|
|||||||
* freelacons - free lookaround-constraint subRE vector
|
* freelacons - free lookaround-constraint subRE vector
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
freelacons(struct subre * subs,
|
freelacons(struct subre *subs,
|
||||||
int n)
|
int n)
|
||||||
{
|
{
|
||||||
struct subre *sub;
|
struct subre *sub;
|
||||||
@ -2102,7 +2102,7 @@ dump(regex_t *re,
|
|||||||
* dumpst - dump a subRE tree
|
* dumpst - dump a subRE tree
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
dumpst(struct subre * t,
|
dumpst(struct subre *t,
|
||||||
FILE *f,
|
FILE *f,
|
||||||
int nfapresent) /* is the original NFA still around? */
|
int nfapresent) /* is the original NFA still around? */
|
||||||
{
|
{
|
||||||
@ -2117,7 +2117,7 @@ dumpst(struct subre * t,
|
|||||||
* stdump - recursive guts of dumpst
|
* stdump - recursive guts of dumpst
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
stdump(struct subre * t,
|
stdump(struct subre *t,
|
||||||
FILE *f,
|
FILE *f,
|
||||||
int nfapresent) /* is the original NFA still around? */
|
int nfapresent) /* is the original NFA still around? */
|
||||||
{
|
{
|
||||||
@ -2167,7 +2167,7 @@ stdump(struct subre * t,
|
|||||||
* stid - identify a subtree node for dumping
|
* stid - identify a subtree node for dumping
|
||||||
*/
|
*/
|
||||||
static const char * /* points to buf or constant string */
|
static const char * /* points to buf or constant string */
|
||||||
stid(struct subre * t,
|
stid(struct subre *t,
|
||||||
char *buf,
|
char *buf,
|
||||||
size_t bufsize)
|
size_t bufsize)
|
||||||
{
|
{
|
||||||
|
@ -39,8 +39,8 @@
|
|||||||
* Internal errors also return NULL, with v->err set.
|
* Internal errors also return NULL, with v->err set.
|
||||||
*/
|
*/
|
||||||
static chr *
|
static chr *
|
||||||
longest(struct vars * v,
|
longest(struct vars *v,
|
||||||
struct dfa * d,
|
struct dfa *d,
|
||||||
chr *start, /* where the match should start */
|
chr *start, /* where the match should start */
|
||||||
chr *stop, /* match must end at or before here */
|
chr *stop, /* match must end at or before here */
|
||||||
int *hitstopp) /* record whether hit v->stop, if non-NULL */
|
int *hitstopp) /* record whether hit v->stop, if non-NULL */
|
||||||
@ -165,8 +165,8 @@ longest(struct vars * v,
|
|||||||
* Internal errors also return NULL, with v->err set.
|
* Internal errors also return NULL, with v->err set.
|
||||||
*/
|
*/
|
||||||
static chr *
|
static chr *
|
||||||
shortest(struct vars * v,
|
shortest(struct vars *v,
|
||||||
struct dfa * d,
|
struct dfa *d,
|
||||||
chr *start, /* where the match should start */
|
chr *start, /* where the match should start */
|
||||||
chr *min, /* match must end at or after here */
|
chr *min, /* match must end at or after here */
|
||||||
chr *max, /* match must end at or before here */
|
chr *max, /* match must end at or before here */
|
||||||
@ -300,10 +300,10 @@ shortest(struct vars * v,
|
|||||||
* Internal errors also return 0, with v->err set.
|
* Internal errors also return 0, with v->err set.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
matchuntil(struct vars * v,
|
matchuntil(struct vars *v,
|
||||||
struct dfa * d,
|
struct dfa *d,
|
||||||
chr *probe, /* we want to know if a match ends here */
|
chr *probe, /* we want to know if a match ends here */
|
||||||
struct sset ** lastcss, /* state storage across calls */
|
struct sset **lastcss, /* state storage across calls */
|
||||||
chr **lastcp) /* state storage across calls */
|
chr **lastcp) /* state storage across calls */
|
||||||
{
|
{
|
||||||
chr *cp = *lastcp;
|
chr *cp = *lastcp;
|
||||||
@ -414,8 +414,8 @@ matchuntil(struct vars * v,
|
|||||||
* lastcold - determine last point at which no progress had been made
|
* lastcold - determine last point at which no progress had been made
|
||||||
*/
|
*/
|
||||||
static chr * /* endpoint, or NULL */
|
static chr * /* endpoint, or NULL */
|
||||||
lastcold(struct vars * v,
|
lastcold(struct vars *v,
|
||||||
struct dfa * d)
|
struct dfa *d)
|
||||||
{
|
{
|
||||||
struct sset *ss;
|
struct sset *ss;
|
||||||
chr *nopr;
|
chr *nopr;
|
||||||
@ -434,10 +434,10 @@ lastcold(struct vars * v,
|
|||||||
* newdfa - set up a fresh DFA
|
* newdfa - set up a fresh DFA
|
||||||
*/
|
*/
|
||||||
static struct dfa *
|
static struct dfa *
|
||||||
newdfa(struct vars * v,
|
newdfa(struct vars *v,
|
||||||
struct cnfa * cnfa,
|
struct cnfa *cnfa,
|
||||||
struct colormap * cm,
|
struct colormap *cm,
|
||||||
struct smalldfa * sml) /* preallocated space, may be NULL */
|
struct smalldfa *sml) /* preallocated space, may be NULL */
|
||||||
{
|
{
|
||||||
struct dfa *d;
|
struct dfa *d;
|
||||||
size_t nss = cnfa->nstates * 2;
|
size_t nss = cnfa->nstates * 2;
|
||||||
@ -514,7 +514,7 @@ newdfa(struct vars * v,
|
|||||||
* freedfa - free a DFA
|
* freedfa - free a DFA
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
freedfa(struct dfa * d)
|
freedfa(struct dfa *d)
|
||||||
{
|
{
|
||||||
if (d->cptsmalloced)
|
if (d->cptsmalloced)
|
||||||
{
|
{
|
||||||
@ -554,8 +554,8 @@ hash(unsigned *uv,
|
|||||||
* initialize - hand-craft a cache entry for startup, otherwise get ready
|
* initialize - hand-craft a cache entry for startup, otherwise get ready
|
||||||
*/
|
*/
|
||||||
static struct sset *
|
static struct sset *
|
||||||
initialize(struct vars * v,
|
initialize(struct vars *v,
|
||||||
struct dfa * d,
|
struct dfa *d,
|
||||||
chr *start)
|
chr *start)
|
||||||
{
|
{
|
||||||
struct sset *ss;
|
struct sset *ss;
|
||||||
@ -600,9 +600,9 @@ initialize(struct vars * v,
|
|||||||
* Internal errors also return NULL, with v->err set.
|
* Internal errors also return NULL, with v->err set.
|
||||||
*/
|
*/
|
||||||
static struct sset *
|
static struct sset *
|
||||||
miss(struct vars * v,
|
miss(struct vars *v,
|
||||||
struct dfa * d,
|
struct dfa *d,
|
||||||
struct sset * css,
|
struct sset *css,
|
||||||
color co,
|
color co,
|
||||||
chr *cp, /* next chr */
|
chr *cp, /* next chr */
|
||||||
chr *start) /* where the attempt got started */
|
chr *start) /* where the attempt got started */
|
||||||
@ -740,8 +740,8 @@ miss(struct vars * v,
|
|||||||
* lacon - lookaround-constraint checker for miss()
|
* lacon - lookaround-constraint checker for miss()
|
||||||
*/
|
*/
|
||||||
static int /* predicate: constraint satisfied? */
|
static int /* predicate: constraint satisfied? */
|
||||||
lacon(struct vars * v,
|
lacon(struct vars *v,
|
||||||
struct cnfa * pcnfa, /* parent cnfa */
|
struct cnfa *pcnfa, /* parent cnfa */
|
||||||
chr *cp,
|
chr *cp,
|
||||||
color co) /* "color" of the lookaround constraint */
|
color co) /* "color" of the lookaround constraint */
|
||||||
{
|
{
|
||||||
@ -797,8 +797,8 @@ lacon(struct vars * v,
|
|||||||
* clear the innards of the state set -- that's up to the caller.
|
* clear the innards of the state set -- that's up to the caller.
|
||||||
*/
|
*/
|
||||||
static struct sset *
|
static struct sset *
|
||||||
getvacant(struct vars * v,
|
getvacant(struct vars *v,
|
||||||
struct dfa * d,
|
struct dfa *d,
|
||||||
chr *cp,
|
chr *cp,
|
||||||
chr *start)
|
chr *start)
|
||||||
{
|
{
|
||||||
@ -868,8 +868,8 @@ getvacant(struct vars * v,
|
|||||||
* pickss - pick the next stateset to be used
|
* pickss - pick the next stateset to be used
|
||||||
*/
|
*/
|
||||||
static struct sset *
|
static struct sset *
|
||||||
pickss(struct vars * v,
|
pickss(struct vars *v,
|
||||||
struct dfa * d,
|
struct dfa *d,
|
||||||
chr *cp,
|
chr *cp,
|
||||||
chr *start)
|
chr *start)
|
||||||
{
|
{
|
||||||
|
@ -334,8 +334,8 @@ cleanup:
|
|||||||
* The DFA will be freed by the cleanup step in pg_regexec().
|
* The DFA will be freed by the cleanup step in pg_regexec().
|
||||||
*/
|
*/
|
||||||
static struct dfa *
|
static struct dfa *
|
||||||
getsubdfa(struct vars * v,
|
getsubdfa(struct vars *v,
|
||||||
struct subre * t)
|
struct subre *t)
|
||||||
{
|
{
|
||||||
if (v->subdfas[t->id] == NULL)
|
if (v->subdfas[t->id] == NULL)
|
||||||
{
|
{
|
||||||
@ -352,7 +352,7 @@ getsubdfa(struct vars * v,
|
|||||||
* Same as above, but for LACONs.
|
* Same as above, but for LACONs.
|
||||||
*/
|
*/
|
||||||
static struct dfa *
|
static struct dfa *
|
||||||
getladfa(struct vars * v,
|
getladfa(struct vars *v,
|
||||||
int n)
|
int n)
|
||||||
{
|
{
|
||||||
assert(n > 0 && n < v->g->nlacons && v->g->lacons != NULL);
|
assert(n > 0 && n < v->g->nlacons && v->g->lacons != NULL);
|
||||||
@ -372,9 +372,9 @@ getladfa(struct vars * v,
|
|||||||
* find - find a match for the main NFA (no-complications case)
|
* find - find a match for the main NFA (no-complications case)
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
find(struct vars * v,
|
find(struct vars *v,
|
||||||
struct cnfa * cnfa,
|
struct cnfa *cnfa,
|
||||||
struct colormap * cm)
|
struct colormap *cm)
|
||||||
{
|
{
|
||||||
struct dfa *s;
|
struct dfa *s;
|
||||||
struct dfa *d;
|
struct dfa *d;
|
||||||
@ -463,9 +463,9 @@ find(struct vars * v,
|
|||||||
* cfind - find a match for the main NFA (with complications)
|
* cfind - find a match for the main NFA (with complications)
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
cfind(struct vars * v,
|
cfind(struct vars *v,
|
||||||
struct cnfa * cnfa,
|
struct cnfa *cnfa,
|
||||||
struct colormap * cm)
|
struct colormap *cm)
|
||||||
{
|
{
|
||||||
struct dfa *s;
|
struct dfa *s;
|
||||||
struct dfa *d;
|
struct dfa *d;
|
||||||
@ -503,11 +503,11 @@ cfind(struct vars * v,
|
|||||||
* cfindloop - the heart of cfind
|
* cfindloop - the heart of cfind
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
cfindloop(struct vars * v,
|
cfindloop(struct vars *v,
|
||||||
struct cnfa * cnfa,
|
struct cnfa *cnfa,
|
||||||
struct colormap * cm,
|
struct colormap *cm,
|
||||||
struct dfa * d,
|
struct dfa *d,
|
||||||
struct dfa * s,
|
struct dfa *s,
|
||||||
chr **coldp) /* where to put coldstart pointer */
|
chr **coldp) /* where to put coldstart pointer */
|
||||||
{
|
{
|
||||||
chr *begin;
|
chr *begin;
|
||||||
@ -632,8 +632,8 @@ zapallsubs(regmatch_t *p,
|
|||||||
* zaptreesubs - initialize subexpressions within subtree to "no match"
|
* zaptreesubs - initialize subexpressions within subtree to "no match"
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
zaptreesubs(struct vars * v,
|
zaptreesubs(struct vars *v,
|
||||||
struct subre * t)
|
struct subre *t)
|
||||||
{
|
{
|
||||||
if (t->op == '(')
|
if (t->op == '(')
|
||||||
{
|
{
|
||||||
@ -657,8 +657,8 @@ zaptreesubs(struct vars * v,
|
|||||||
* subset - set subexpression match data for a successful subre
|
* subset - set subexpression match data for a successful subre
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
subset(struct vars * v,
|
subset(struct vars *v,
|
||||||
struct subre * sub,
|
struct subre *sub,
|
||||||
chr *begin,
|
chr *begin,
|
||||||
chr *end)
|
chr *end)
|
||||||
{
|
{
|
||||||
@ -689,8 +689,8 @@ subset(struct vars * v,
|
|||||||
* zaptreesubs (or zapallsubs at the top level).
|
* zaptreesubs (or zapallsubs at the top level).
|
||||||
*/
|
*/
|
||||||
static int /* regexec return code */
|
static int /* regexec return code */
|
||||||
cdissect(struct vars * v,
|
cdissect(struct vars *v,
|
||||||
struct subre * t,
|
struct subre *t,
|
||||||
chr *begin, /* beginning of relevant substring */
|
chr *begin, /* beginning of relevant substring */
|
||||||
chr *end) /* end of same */
|
chr *end) /* end of same */
|
||||||
{
|
{
|
||||||
@ -760,8 +760,8 @@ cdissect(struct vars * v,
|
|||||||
* ccondissect - dissect match for concatenation node
|
* ccondissect - dissect match for concatenation node
|
||||||
*/
|
*/
|
||||||
static int /* regexec return code */
|
static int /* regexec return code */
|
||||||
ccondissect(struct vars * v,
|
ccondissect(struct vars *v,
|
||||||
struct subre * t,
|
struct subre *t,
|
||||||
chr *begin, /* beginning of relevant substring */
|
chr *begin, /* beginning of relevant substring */
|
||||||
chr *end) /* end of same */
|
chr *end) /* end of same */
|
||||||
{
|
{
|
||||||
@ -838,8 +838,8 @@ ccondissect(struct vars * v,
|
|||||||
* crevcondissect - dissect match for concatenation node, shortest-first
|
* crevcondissect - dissect match for concatenation node, shortest-first
|
||||||
*/
|
*/
|
||||||
static int /* regexec return code */
|
static int /* regexec return code */
|
||||||
crevcondissect(struct vars * v,
|
crevcondissect(struct vars *v,
|
||||||
struct subre * t,
|
struct subre *t,
|
||||||
chr *begin, /* beginning of relevant substring */
|
chr *begin, /* beginning of relevant substring */
|
||||||
chr *end) /* end of same */
|
chr *end) /* end of same */
|
||||||
{
|
{
|
||||||
@ -916,8 +916,8 @@ crevcondissect(struct vars * v,
|
|||||||
* cbrdissect - dissect match for backref node
|
* cbrdissect - dissect match for backref node
|
||||||
*/
|
*/
|
||||||
static int /* regexec return code */
|
static int /* regexec return code */
|
||||||
cbrdissect(struct vars * v,
|
cbrdissect(struct vars *v,
|
||||||
struct subre * t,
|
struct subre *t,
|
||||||
chr *begin, /* beginning of relevant substring */
|
chr *begin, /* beginning of relevant substring */
|
||||||
chr *end) /* end of same */
|
chr *end) /* end of same */
|
||||||
{
|
{
|
||||||
@ -997,8 +997,8 @@ cbrdissect(struct vars * v,
|
|||||||
* caltdissect - dissect match for alternation node
|
* caltdissect - dissect match for alternation node
|
||||||
*/
|
*/
|
||||||
static int /* regexec return code */
|
static int /* regexec return code */
|
||||||
caltdissect(struct vars * v,
|
caltdissect(struct vars *v,
|
||||||
struct subre * t,
|
struct subre *t,
|
||||||
chr *begin, /* beginning of relevant substring */
|
chr *begin, /* beginning of relevant substring */
|
||||||
chr *end) /* end of same */
|
chr *end) /* end of same */
|
||||||
{
|
{
|
||||||
@ -1034,8 +1034,8 @@ caltdissect(struct vars * v,
|
|||||||
* citerdissect - dissect match for iteration node
|
* citerdissect - dissect match for iteration node
|
||||||
*/
|
*/
|
||||||
static int /* regexec return code */
|
static int /* regexec return code */
|
||||||
citerdissect(struct vars * v,
|
citerdissect(struct vars *v,
|
||||||
struct subre * t,
|
struct subre *t,
|
||||||
chr *begin, /* beginning of relevant substring */
|
chr *begin, /* beginning of relevant substring */
|
||||||
chr *end) /* end of same */
|
chr *end) /* end of same */
|
||||||
{
|
{
|
||||||
@ -1235,8 +1235,8 @@ backtrack:
|
|||||||
* creviterdissect - dissect match for iteration node, shortest-first
|
* creviterdissect - dissect match for iteration node, shortest-first
|
||||||
*/
|
*/
|
||||||
static int /* regexec return code */
|
static int /* regexec return code */
|
||||||
creviterdissect(struct vars * v,
|
creviterdissect(struct vars *v,
|
||||||
struct subre * t,
|
struct subre *t,
|
||||||
chr *begin, /* beginning of relevant substring */
|
chr *begin, /* beginning of relevant substring */
|
||||||
chr *end) /* end of same */
|
chr *end) /* end of same */
|
||||||
{
|
{
|
||||||
|
@ -90,7 +90,7 @@ pg_reg_getfinalstate(const regex_t *regex)
|
|||||||
* arcs_len (possibly 0) are emitted into arcs[].
|
* arcs_len (possibly 0) are emitted into arcs[].
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
traverse_lacons(struct cnfa * cnfa, int st,
|
traverse_lacons(struct cnfa *cnfa, int st,
|
||||||
int *arcs_count,
|
int *arcs_count,
|
||||||
regex_arc_t *arcs, int arcs_len)
|
regex_arc_t *arcs, int arcs_len)
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
/*
|
/*
|
||||||
* forward declarations
|
* forward declarations
|
||||||
*/
|
*/
|
||||||
static int findprefix(struct cnfa * cnfa, struct colormap * cm,
|
static int findprefix(struct cnfa *cnfa, struct colormap *cm,
|
||||||
chr *string, size_t *slength);
|
chr *string, size_t *slength);
|
||||||
|
|
||||||
|
|
||||||
@ -109,8 +109,8 @@ pg_regprefix(regex_t *re,
|
|||||||
* *slength (which must be preset to zero) incremented for each chr.
|
* *slength (which must be preset to zero) incremented for each chr.
|
||||||
*/
|
*/
|
||||||
static int /* regprefix return code */
|
static int /* regprefix return code */
|
||||||
findprefix(struct cnfa * cnfa,
|
findprefix(struct cnfa *cnfa,
|
||||||
struct colormap * cm,
|
struct colormap *cm,
|
||||||
chr *string,
|
chr *string,
|
||||||
size_t *slength)
|
size_t *slength)
|
||||||
{
|
{
|
||||||
|
@ -54,11 +54,11 @@ typedef struct
|
|||||||
static int64 sendDir(char *path, int basepathlen, bool sizeonly,
|
static int64 sendDir(char *path, int basepathlen, bool sizeonly,
|
||||||
List *tablespaces, bool sendtblspclinks);
|
List *tablespaces, bool sendtblspclinks);
|
||||||
static bool sendFile(char *readfilename, char *tarfilename,
|
static bool sendFile(char *readfilename, char *tarfilename,
|
||||||
struct stat * statbuf, bool missing_ok);
|
struct stat *statbuf, bool missing_ok);
|
||||||
static void sendFileWithContent(const char *filename, const char *content);
|
static void sendFileWithContent(const char *filename, const char *content);
|
||||||
static int64 _tarWriteHeader(const char *filename, const char *linktarget,
|
static int64 _tarWriteHeader(const char *filename, const char *linktarget,
|
||||||
struct stat * statbuf, bool sizeonly);
|
struct stat *statbuf, bool sizeonly);
|
||||||
static int64 _tarWriteDir(const char *pathbuf, int basepathlen, struct stat * statbuf,
|
static int64 _tarWriteDir(const char *pathbuf, int basepathlen, struct stat *statbuf,
|
||||||
bool sizeonly);
|
bool sizeonly);
|
||||||
static void send_int8_string(StringInfoData *buf, int64 intval);
|
static void send_int8_string(StringInfoData *buf, int64 intval);
|
||||||
static void SendBackupHeader(List *tablespaces);
|
static void SendBackupHeader(List *tablespaces);
|
||||||
@ -1199,7 +1199,7 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces,
|
|||||||
* and the file did not exist.
|
* and the file did not exist.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
sendFile(char *readfilename, char *tarfilename, struct stat * statbuf,
|
sendFile(char *readfilename, char *tarfilename, struct stat *statbuf,
|
||||||
bool missing_ok)
|
bool missing_ok)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@ -1273,7 +1273,7 @@ sendFile(char *readfilename, char *tarfilename, struct stat * statbuf,
|
|||||||
|
|
||||||
static int64
|
static int64
|
||||||
_tarWriteHeader(const char *filename, const char *linktarget,
|
_tarWriteHeader(const char *filename, const char *linktarget,
|
||||||
struct stat * statbuf, bool sizeonly)
|
struct stat *statbuf, bool sizeonly)
|
||||||
{
|
{
|
||||||
char h[512];
|
char h[512];
|
||||||
enum tarError rc;
|
enum tarError rc;
|
||||||
@ -1314,7 +1314,7 @@ _tarWriteHeader(const char *filename, const char *linktarget,
|
|||||||
* write it as a directory anyway.
|
* write it as a directory anyway.
|
||||||
*/
|
*/
|
||||||
static int64
|
static int64
|
||||||
_tarWriteDir(const char *pathbuf, int basepathlen, struct stat * statbuf,
|
_tarWriteDir(const char *pathbuf, int basepathlen, struct stat *statbuf,
|
||||||
bool sizeonly)
|
bool sizeonly)
|
||||||
{
|
{
|
||||||
/* If symlink, write it as a directory anyway */
|
/* If symlink, write it as a directory anyway */
|
||||||
|
@ -180,8 +180,7 @@ static void AssertTXNLsnOrder(ReorderBuffer *rb);
|
|||||||
* ---------------------------------------
|
* ---------------------------------------
|
||||||
*/
|
*/
|
||||||
static ReorderBufferIterTXNState *ReorderBufferIterTXNInit(ReorderBuffer *rb, ReorderBufferTXN *txn);
|
static ReorderBufferIterTXNState *ReorderBufferIterTXNInit(ReorderBuffer *rb, ReorderBufferTXN *txn);
|
||||||
static ReorderBufferChange *
|
static ReorderBufferChange *ReorderBufferIterTXNNext(ReorderBuffer *rb, ReorderBufferIterTXNState *state);
|
||||||
ReorderBufferIterTXNNext(ReorderBuffer *rb, ReorderBufferIterTXNState *state);
|
|
||||||
static void ReorderBufferIterTXNFinish(ReorderBuffer *rb,
|
static void ReorderBufferIterTXNFinish(ReorderBuffer *rb,
|
||||||
ReorderBufferIterTXNState *state);
|
ReorderBufferIterTXNState *state);
|
||||||
static void ReorderBufferExecuteInvalidations(ReorderBuffer *rb, ReorderBufferTXN *txn);
|
static void ReorderBufferExecuteInvalidations(ReorderBuffer *rb, ReorderBufferTXN *txn);
|
||||||
|
@ -117,7 +117,8 @@ bool am_cascading_walsender = false; /* Am I cascading WAL to
|
|||||||
bool am_db_walsender = false; /* Connected to a database? */
|
bool am_db_walsender = false; /* Connected to a database? */
|
||||||
|
|
||||||
/* User-settable parameters for walsender */
|
/* User-settable parameters for walsender */
|
||||||
int max_wal_senders = 0; /* the maximum number of concurrent walsenders */
|
int max_wal_senders = 0; /* the maximum number of concurrent
|
||||||
|
* walsenders */
|
||||||
int wal_sender_timeout = 60 * 1000; /* maximum time to send one
|
int wal_sender_timeout = 60 * 1000; /* maximum time to send one
|
||||||
* WAL data message */
|
* WAL data message */
|
||||||
bool log_replication_commands = false;
|
bool log_replication_commands = false;
|
||||||
|
@ -126,7 +126,7 @@ typedef struct DictSnowball
|
|||||||
struct SN_env *z;
|
struct SN_env *z;
|
||||||
StopList stoplist;
|
StopList stoplist;
|
||||||
bool needrecode; /* needs recoding before/after call stem */
|
bool needrecode; /* needs recoding before/after call stem */
|
||||||
int (*stem) (struct SN_env * z);
|
int (*stem) (struct SN_env *z);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* snowball saves alloced memory between calls, so we should run it in our
|
* snowball saves alloced memory between calls, so we should run it in our
|
||||||
|
@ -409,7 +409,7 @@ statext_dependencies_build(int numrows, HeapTuple *rows, Bitmapset *attrs,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
d = (MVDependency *) palloc0(offsetof(MVDependency, attributes)
|
d = (MVDependency *) palloc0(offsetof(MVDependency, attributes)
|
||||||
+k * sizeof(AttrNumber));
|
+ k * sizeof(AttrNumber));
|
||||||
|
|
||||||
/* copy the dependency (and keep the indexes into stxkeys) */
|
/* copy the dependency (and keep the indexes into stxkeys) */
|
||||||
d->degree = degree;
|
d->degree = degree;
|
||||||
@ -431,7 +431,7 @@ statext_dependencies_build(int numrows, HeapTuple *rows, Bitmapset *attrs,
|
|||||||
dependencies->ndeps++;
|
dependencies->ndeps++;
|
||||||
dependencies = (MVDependencies *) repalloc(dependencies,
|
dependencies = (MVDependencies *) repalloc(dependencies,
|
||||||
offsetof(MVDependencies, deps)
|
offsetof(MVDependencies, deps)
|
||||||
+dependencies->ndeps * sizeof(MVDependency));
|
+ dependencies->ndeps * sizeof(MVDependency));
|
||||||
|
|
||||||
dependencies->deps[dependencies->ndeps - 1] = d;
|
dependencies->deps[dependencies->ndeps - 1] = d;
|
||||||
}
|
}
|
||||||
@ -552,7 +552,7 @@ statext_dependencies_deserialize(bytea *data)
|
|||||||
|
|
||||||
/* allocate space for the MCV items */
|
/* allocate space for the MCV items */
|
||||||
dependencies = repalloc(dependencies, offsetof(MVDependencies, deps)
|
dependencies = repalloc(dependencies, offsetof(MVDependencies, deps)
|
||||||
+(dependencies->ndeps * sizeof(MVDependency *)));
|
+ (dependencies->ndeps * sizeof(MVDependency *)));
|
||||||
|
|
||||||
for (i = 0; i < dependencies->ndeps; i++)
|
for (i = 0; i < dependencies->ndeps; i++)
|
||||||
{
|
{
|
||||||
@ -573,7 +573,7 @@ statext_dependencies_deserialize(bytea *data)
|
|||||||
|
|
||||||
/* now that we know the number of attributes, allocate the dependency */
|
/* now that we know the number of attributes, allocate the dependency */
|
||||||
d = (MVDependency *) palloc0(offsetof(MVDependency, attributes)
|
d = (MVDependency *) palloc0(offsetof(MVDependency, attributes)
|
||||||
+(k * sizeof(AttrNumber)));
|
+ (k * sizeof(AttrNumber)));
|
||||||
|
|
||||||
d->degree = degree;
|
d->degree = degree;
|
||||||
d->nattributes = k;
|
d->nattributes = k;
|
||||||
|
@ -353,7 +353,7 @@ multi_sort_init(int ndims)
|
|||||||
Assert(ndims >= 2);
|
Assert(ndims >= 2);
|
||||||
|
|
||||||
mss = (MultiSortSupport) palloc0(offsetof(MultiSortSupportData, ssup)
|
mss = (MultiSortSupport) palloc0(offsetof(MultiSortSupportData, ssup)
|
||||||
+sizeof(SortSupportData) * ndims);
|
+ sizeof(SortSupportData) * ndims);
|
||||||
|
|
||||||
mss->ndims = ndims;
|
mss->ndims = ndims;
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ statext_ndistinct_serialize(MVNDistinct *ndistinct)
|
|||||||
* for each item, including number of items for each.
|
* for each item, including number of items for each.
|
||||||
*/
|
*/
|
||||||
len = VARHDRSZ + SizeOfMVNDistinct +
|
len = VARHDRSZ + SizeOfMVNDistinct +
|
||||||
ndistinct->nitems * (offsetof(MVNDistinctItem, attrs) +sizeof(int));
|
ndistinct->nitems * (offsetof(MVNDistinctItem, attrs) + sizeof(int));
|
||||||
|
|
||||||
/* and also include space for the actual attribute numbers */
|
/* and also include space for the actual attribute numbers */
|
||||||
for (i = 0; i < ndistinct->nitems; i++)
|
for (i = 0; i < ndistinct->nitems; i++)
|
||||||
@ -513,10 +513,10 @@ estimate_ndistinct(double totalrows, int numrows, int d, int f1)
|
|||||||
denom,
|
denom,
|
||||||
ndistinct;
|
ndistinct;
|
||||||
|
|
||||||
numer = (double) numrows *(double) d;
|
numer = (double) numrows * (double) d;
|
||||||
|
|
||||||
denom = (double) (numrows - f1) +
|
denom = (double) (numrows - f1) +
|
||||||
(double) f1 *(double) numrows / totalrows;
|
(double) f1 * (double) numrows / totalrows;
|
||||||
|
|
||||||
ndistinct = numer / denom;
|
ndistinct = numer / denom;
|
||||||
|
|
||||||
|
@ -2118,7 +2118,7 @@ BgBufferSync(WritebackContext *wb_context)
|
|||||||
int32 passes_delta = strategy_passes - prev_strategy_passes;
|
int32 passes_delta = strategy_passes - prev_strategy_passes;
|
||||||
|
|
||||||
strategy_delta = strategy_buf_id - prev_strategy_buf_id;
|
strategy_delta = strategy_buf_id - prev_strategy_buf_id;
|
||||||
strategy_delta += (long) passes_delta *NBuffers;
|
strategy_delta += (long) passes_delta * NBuffers;
|
||||||
|
|
||||||
Assert(strategy_delta >= 0);
|
Assert(strategy_delta >= 0);
|
||||||
|
|
||||||
|
@ -1160,5 +1160,5 @@ static uint64
|
|||||||
dsm_control_bytes_needed(uint32 nitems)
|
dsm_control_bytes_needed(uint32 nitems)
|
||||||
{
|
{
|
||||||
return offsetof(dsm_control_header, item)
|
return offsetof(dsm_control_header, item)
|
||||||
+sizeof(dsm_control_item) * (uint64) nitems;
|
+ sizeof(dsm_control_item) * (uint64) nitems;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ static shm_mq_result shm_mq_receive_bytes(shm_mq *mq, Size bytes_needed,
|
|||||||
bool nowait, Size *nbytesp, void **datap);
|
bool nowait, Size *nbytesp, void **datap);
|
||||||
static bool shm_mq_counterparty_gone(volatile shm_mq *mq,
|
static bool shm_mq_counterparty_gone(volatile shm_mq *mq,
|
||||||
BackgroundWorkerHandle *handle);
|
BackgroundWorkerHandle *handle);
|
||||||
static bool shm_mq_wait_internal(volatile shm_mq *mq, PGPROC *volatile * ptr,
|
static bool shm_mq_wait_internal(volatile shm_mq *mq, PGPROC *volatile *ptr,
|
||||||
BackgroundWorkerHandle *handle);
|
BackgroundWorkerHandle *handle);
|
||||||
static uint64 shm_mq_get_bytes_read(volatile shm_mq *mq, bool *detached);
|
static uint64 shm_mq_get_bytes_read(volatile shm_mq *mq, bool *detached);
|
||||||
static void shm_mq_inc_bytes_read(volatile shm_mq *mq, Size n);
|
static void shm_mq_inc_bytes_read(volatile shm_mq *mq, Size n);
|
||||||
@ -365,7 +365,7 @@ shm_mq_sendv(shm_mq_handle *mqh, shm_mq_iovec *iov, int iovcnt, bool nowait)
|
|||||||
{
|
{
|
||||||
Assert(mqh->mqh_partial_bytes < sizeof(Size));
|
Assert(mqh->mqh_partial_bytes < sizeof(Size));
|
||||||
res = shm_mq_send_bytes(mqh, sizeof(Size) - mqh->mqh_partial_bytes,
|
res = shm_mq_send_bytes(mqh, sizeof(Size) - mqh->mqh_partial_bytes,
|
||||||
((char *) &nbytes) +mqh->mqh_partial_bytes,
|
((char *) &nbytes) + mqh->mqh_partial_bytes,
|
||||||
nowait, &bytes_written);
|
nowait, &bytes_written);
|
||||||
|
|
||||||
if (res == SHM_MQ_DETACHED)
|
if (res == SHM_MQ_DETACHED)
|
||||||
@ -1053,7 +1053,7 @@ shm_mq_counterparty_gone(volatile shm_mq *mq, BackgroundWorkerHandle *handle)
|
|||||||
* non-NULL when our counterpart attaches to the queue.
|
* non-NULL when our counterpart attaches to the queue.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
shm_mq_wait_internal(volatile shm_mq *mq, PGPROC *volatile * ptr,
|
shm_mq_wait_internal(volatile shm_mq *mq, PGPROC *volatile *ptr,
|
||||||
BackgroundWorkerHandle *handle)
|
BackgroundWorkerHandle *handle)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
@ -96,7 +96,7 @@ shm_toc_allocate(shm_toc *toc, Size nbytes)
|
|||||||
total_bytes = vtoc->toc_total_bytes;
|
total_bytes = vtoc->toc_total_bytes;
|
||||||
allocated_bytes = vtoc->toc_allocated_bytes;
|
allocated_bytes = vtoc->toc_allocated_bytes;
|
||||||
nentry = vtoc->toc_nentry;
|
nentry = vtoc->toc_nentry;
|
||||||
toc_bytes = offsetof(shm_toc, toc_entry) +nentry * sizeof(shm_toc_entry)
|
toc_bytes = offsetof(shm_toc, toc_entry) + nentry * sizeof(shm_toc_entry)
|
||||||
+ allocated_bytes;
|
+ allocated_bytes;
|
||||||
|
|
||||||
/* Check for memory exhaustion and overflow. */
|
/* Check for memory exhaustion and overflow. */
|
||||||
@ -132,7 +132,7 @@ shm_toc_freespace(shm_toc *toc)
|
|||||||
nentry = vtoc->toc_nentry;
|
nentry = vtoc->toc_nentry;
|
||||||
SpinLockRelease(&toc->toc_mutex);
|
SpinLockRelease(&toc->toc_mutex);
|
||||||
|
|
||||||
toc_bytes = offsetof(shm_toc, toc_entry) +nentry * sizeof(shm_toc_entry);
|
toc_bytes = offsetof(shm_toc, toc_entry) + nentry * sizeof(shm_toc_entry);
|
||||||
Assert(allocated_bytes + BUFFERALIGN(toc_bytes) <= total_bytes);
|
Assert(allocated_bytes + BUFFERALIGN(toc_bytes) <= total_bytes);
|
||||||
return total_bytes - (allocated_bytes + BUFFERALIGN(toc_bytes));
|
return total_bytes - (allocated_bytes + BUFFERALIGN(toc_bytes));
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ shm_toc_insert(shm_toc *toc, uint64 key, void *address)
|
|||||||
total_bytes = vtoc->toc_total_bytes;
|
total_bytes = vtoc->toc_total_bytes;
|
||||||
allocated_bytes = vtoc->toc_allocated_bytes;
|
allocated_bytes = vtoc->toc_allocated_bytes;
|
||||||
nentry = vtoc->toc_nentry;
|
nentry = vtoc->toc_nentry;
|
||||||
toc_bytes = offsetof(shm_toc, toc_entry) +nentry * sizeof(shm_toc_entry)
|
toc_bytes = offsetof(shm_toc, toc_entry) + nentry * sizeof(shm_toc_entry)
|
||||||
+ allocated_bytes;
|
+ allocated_bytes;
|
||||||
|
|
||||||
/* Check for memory exhaustion and overflow. */
|
/* Check for memory exhaustion and overflow. */
|
||||||
|
@ -232,7 +232,7 @@ LOG_LWDEBUG(const char *where, LWLock *lock, const char *msg)
|
|||||||
|
|
||||||
static void init_lwlock_stats(void);
|
static void init_lwlock_stats(void);
|
||||||
static void print_lwlock_stats(int code, Datum arg);
|
static void print_lwlock_stats(int code, Datum arg);
|
||||||
static lwlock_stats *get_lwlock_stats_entry(LWLock *lockid);
|
static lwlock_stats * get_lwlock_stats_entry(LWLock *lockid);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_lwlock_stats(void)
|
init_lwlock_stats(void)
|
||||||
|
@ -286,7 +286,7 @@ InitProcGlobal(void)
|
|||||||
void
|
void
|
||||||
InitProcess(void)
|
InitProcess(void)
|
||||||
{
|
{
|
||||||
PGPROC *volatile * procgloballist;
|
PGPROC *volatile *procgloballist;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ProcGlobal should be set up already (if we are a backend, we inherit
|
* ProcGlobal should be set up already (if we are a backend, we inherit
|
||||||
@ -781,7 +781,7 @@ static void
|
|||||||
ProcKill(int code, Datum arg)
|
ProcKill(int code, Datum arg)
|
||||||
{
|
{
|
||||||
PGPROC *proc;
|
PGPROC *proc;
|
||||||
PGPROC *volatile * procgloballist;
|
PGPROC *volatile *procgloballist;
|
||||||
|
|
||||||
Assert(MyProc != NULL);
|
Assert(MyProc != NULL);
|
||||||
|
|
||||||
|
@ -518,7 +518,7 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
|||||||
|
|
||||||
v = _mdfd_getseg(reln, forknum, blocknum, skipFsync, EXTENSION_CREATE);
|
v = _mdfd_getseg(reln, forknum, blocknum, skipFsync, EXTENSION_CREATE);
|
||||||
|
|
||||||
seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE));
|
seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE));
|
||||||
|
|
||||||
Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE);
|
Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE);
|
||||||
|
|
||||||
@ -664,7 +664,7 @@ mdprefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum)
|
|||||||
|
|
||||||
v = _mdfd_getseg(reln, forknum, blocknum, false, EXTENSION_FAIL);
|
v = _mdfd_getseg(reln, forknum, blocknum, false, EXTENSION_FAIL);
|
||||||
|
|
||||||
seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE));
|
seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE));
|
||||||
|
|
||||||
Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE);
|
Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE);
|
||||||
|
|
||||||
@ -715,7 +715,7 @@ mdwriteback(SMgrRelation reln, ForkNumber forknum,
|
|||||||
Assert(nflush >= 1);
|
Assert(nflush >= 1);
|
||||||
Assert(nflush <= nblocks);
|
Assert(nflush <= nblocks);
|
||||||
|
|
||||||
seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE));
|
seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE));
|
||||||
|
|
||||||
FileWriteback(v->mdfd_vfd, seekpos, (off_t) BLCKSZ * nflush, WAIT_EVENT_DATA_FILE_FLUSH);
|
FileWriteback(v->mdfd_vfd, seekpos, (off_t) BLCKSZ * nflush, WAIT_EVENT_DATA_FILE_FLUSH);
|
||||||
|
|
||||||
@ -744,7 +744,7 @@ mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
|||||||
v = _mdfd_getseg(reln, forknum, blocknum, false,
|
v = _mdfd_getseg(reln, forknum, blocknum, false,
|
||||||
EXTENSION_FAIL | EXTENSION_CREATE_RECOVERY);
|
EXTENSION_FAIL | EXTENSION_CREATE_RECOVERY);
|
||||||
|
|
||||||
seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE));
|
seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE));
|
||||||
|
|
||||||
Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE);
|
Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE);
|
||||||
|
|
||||||
@ -820,7 +820,7 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
|||||||
v = _mdfd_getseg(reln, forknum, blocknum, skipFsync,
|
v = _mdfd_getseg(reln, forknum, blocknum, skipFsync,
|
||||||
EXTENSION_FAIL | EXTENSION_CREATE_RECOVERY);
|
EXTENSION_FAIL | EXTENSION_CREATE_RECOVERY);
|
||||||
|
|
||||||
seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE));
|
seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE));
|
||||||
|
|
||||||
Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE);
|
Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE);
|
||||||
|
|
||||||
|
@ -58,9 +58,9 @@ struct fp_info
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int16 parse_fcall_arguments(StringInfo msgBuf, struct fp_info * fip,
|
static int16 parse_fcall_arguments(StringInfo msgBuf, struct fp_info *fip,
|
||||||
FunctionCallInfo fcinfo);
|
FunctionCallInfo fcinfo);
|
||||||
static int16 parse_fcall_arguments_20(StringInfo msgBuf, struct fp_info * fip,
|
static int16 parse_fcall_arguments_20(StringInfo msgBuf, struct fp_info *fip,
|
||||||
FunctionCallInfo fcinfo);
|
FunctionCallInfo fcinfo);
|
||||||
|
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ SendFunctionResult(Datum retval, bool isnull, Oid rettype, int16 format)
|
|||||||
* function 'func_id'.
|
* function 'func_id'.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
fetch_fp_info(Oid func_id, struct fp_info * fip)
|
fetch_fp_info(Oid func_id, struct fp_info *fip)
|
||||||
{
|
{
|
||||||
HeapTuple func_htp;
|
HeapTuple func_htp;
|
||||||
Form_pg_proc pp;
|
Form_pg_proc pp;
|
||||||
@ -405,7 +405,7 @@ HandleFunctionRequest(StringInfo msgBuf)
|
|||||||
* is returned.
|
* is returned.
|
||||||
*/
|
*/
|
||||||
static int16
|
static int16
|
||||||
parse_fcall_arguments(StringInfo msgBuf, struct fp_info * fip,
|
parse_fcall_arguments(StringInfo msgBuf, struct fp_info *fip,
|
||||||
FunctionCallInfo fcinfo)
|
FunctionCallInfo fcinfo)
|
||||||
{
|
{
|
||||||
int nargs;
|
int nargs;
|
||||||
@ -543,7 +543,7 @@ parse_fcall_arguments(StringInfo msgBuf, struct fp_info * fip,
|
|||||||
* is returned.
|
* is returned.
|
||||||
*/
|
*/
|
||||||
static int16
|
static int16
|
||||||
parse_fcall_arguments_20(StringInfo msgBuf, struct fp_info * fip,
|
parse_fcall_arguments_20(StringInfo msgBuf, struct fp_info *fip,
|
||||||
FunctionCallInfo fcinfo)
|
FunctionCallInfo fcinfo)
|
||||||
{
|
{
|
||||||
int nargs;
|
int nargs;
|
||||||
|
@ -3044,7 +3044,7 @@ ia64_get_bsp(void)
|
|||||||
__asm__ __volatile__(
|
__asm__ __volatile__(
|
||||||
";;\n"
|
";;\n"
|
||||||
" mov %0=ar.bsp \n"
|
" mov %0=ar.bsp \n"
|
||||||
: "=r"(ret));
|
: "=r"(ret));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -501,8 +501,8 @@ lexeme_compare(const void *key1, const void *key2)
|
|||||||
static int
|
static int
|
||||||
trackitem_compare_frequencies_desc(const void *e1, const void *e2)
|
trackitem_compare_frequencies_desc(const void *e1, const void *e2)
|
||||||
{
|
{
|
||||||
const TrackItem *const * t1 = (const TrackItem *const *) e1;
|
const TrackItem *const *t1 = (const TrackItem *const *) e1;
|
||||||
const TrackItem *const * t2 = (const TrackItem *const *) e2;
|
const TrackItem *const *t2 = (const TrackItem *const *) e2;
|
||||||
|
|
||||||
return (*t2)->frequency - (*t1)->frequency;
|
return (*t2)->frequency - (*t1)->frequency;
|
||||||
}
|
}
|
||||||
@ -513,8 +513,8 @@ trackitem_compare_frequencies_desc(const void *e1, const void *e2)
|
|||||||
static int
|
static int
|
||||||
trackitem_compare_lexemes(const void *e1, const void *e2)
|
trackitem_compare_lexemes(const void *e1, const void *e2)
|
||||||
{
|
{
|
||||||
const TrackItem *const * t1 = (const TrackItem *const *) e1;
|
const TrackItem *const *t1 = (const TrackItem *const *) e1;
|
||||||
const TrackItem *const * t2 = (const TrackItem *const *) e2;
|
const TrackItem *const *t2 = (const TrackItem *const *) e2;
|
||||||
|
|
||||||
return lexeme_compare(&(*t1)->key, &(*t2)->key);
|
return lexeme_compare(&(*t1)->key, &(*t2)->key);
|
||||||
}
|
}
|
||||||
|
@ -751,8 +751,8 @@ element_compare(const void *key1, const void *key2)
|
|||||||
static int
|
static int
|
||||||
trackitem_compare_frequencies_desc(const void *e1, const void *e2)
|
trackitem_compare_frequencies_desc(const void *e1, const void *e2)
|
||||||
{
|
{
|
||||||
const TrackItem *const * t1 = (const TrackItem *const *) e1;
|
const TrackItem *const *t1 = (const TrackItem *const *) e1;
|
||||||
const TrackItem *const * t2 = (const TrackItem *const *) e2;
|
const TrackItem *const *t2 = (const TrackItem *const *) e2;
|
||||||
|
|
||||||
return (*t2)->frequency - (*t1)->frequency;
|
return (*t2)->frequency - (*t1)->frequency;
|
||||||
}
|
}
|
||||||
@ -763,8 +763,8 @@ trackitem_compare_frequencies_desc(const void *e1, const void *e2)
|
|||||||
static int
|
static int
|
||||||
trackitem_compare_element(const void *e1, const void *e2)
|
trackitem_compare_element(const void *e1, const void *e2)
|
||||||
{
|
{
|
||||||
const TrackItem *const * t1 = (const TrackItem *const *) e1;
|
const TrackItem *const *t1 = (const TrackItem *const *) e1;
|
||||||
const TrackItem *const * t2 = (const TrackItem *const *) e2;
|
const TrackItem *const *t2 = (const TrackItem *const *) e2;
|
||||||
|
|
||||||
return element_compare(&(*t1)->key, &(*t2)->key);
|
return element_compare(&(*t1)->key, &(*t2)->key);
|
||||||
}
|
}
|
||||||
@ -775,8 +775,8 @@ trackitem_compare_element(const void *e1, const void *e2)
|
|||||||
static int
|
static int
|
||||||
countitem_compare_count(const void *e1, const void *e2)
|
countitem_compare_count(const void *e1, const void *e2)
|
||||||
{
|
{
|
||||||
const DECountItem *const * t1 = (const DECountItem *const *) e1;
|
const DECountItem *const *t1 = (const DECountItem *const *) e1;
|
||||||
const DECountItem *const * t2 = (const DECountItem *const *) e2;
|
const DECountItem *const *t2 = (const DECountItem *const *) e2;
|
||||||
|
|
||||||
if ((*t1)->count < (*t2)->count)
|
if ((*t1)->count < (*t2)->count)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -93,7 +93,7 @@ ArrayGetNItems(int ndim, const int *dims)
|
|||||||
errmsg("array size exceeds the maximum allowed (%d)",
|
errmsg("array size exceeds the maximum allowed (%d)",
|
||||||
(int) MaxArraySize)));
|
(int) MaxArraySize)));
|
||||||
|
|
||||||
prod = (int64) ret *(int64) dims[i];
|
prod = (int64) ret * (int64) dims[i];
|
||||||
|
|
||||||
ret = (int32) prod;
|
ret = (int32) prod;
|
||||||
if ((int64) ret != prod)
|
if ((int64) ret != prod)
|
||||||
|
@ -41,10 +41,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int time2tm(TimeADT time, struct pg_tm * tm, fsec_t *fsec);
|
static int time2tm(TimeADT time, struct pg_tm *tm, fsec_t *fsec);
|
||||||
static int timetz2tm(TimeTzADT *time, struct pg_tm * tm, fsec_t *fsec, int *tzp);
|
static int timetz2tm(TimeTzADT *time, struct pg_tm *tm, fsec_t *fsec, int *tzp);
|
||||||
static int tm2time(struct pg_tm * tm, fsec_t fsec, TimeADT *result);
|
static int tm2time(struct pg_tm *tm, fsec_t fsec, TimeADT *result);
|
||||||
static int tm2timetz(struct pg_tm * tm, fsec_t fsec, int tz, TimeTzADT *result);
|
static int tm2timetz(struct pg_tm *tm, fsec_t fsec, int tz, TimeTzADT *result);
|
||||||
static void AdjustTimeForTypmod(TimeADT *time, int32 typmod);
|
static void AdjustTimeForTypmod(TimeADT *time, int32 typmod);
|
||||||
|
|
||||||
|
|
||||||
@ -1235,7 +1235,7 @@ time_in(PG_FUNCTION_ARGS)
|
|||||||
* Convert a tm structure to a time data type.
|
* Convert a tm structure to a time data type.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
tm2time(struct pg_tm * tm, fsec_t fsec, TimeADT *result)
|
tm2time(struct pg_tm *tm, fsec_t fsec, TimeADT *result)
|
||||||
{
|
{
|
||||||
*result = ((((tm->tm_hour * MINS_PER_HOUR + tm->tm_min) * SECS_PER_MINUTE) + tm->tm_sec)
|
*result = ((((tm->tm_hour * MINS_PER_HOUR + tm->tm_min) * SECS_PER_MINUTE) + tm->tm_sec)
|
||||||
* USECS_PER_SEC) + fsec;
|
* USECS_PER_SEC) + fsec;
|
||||||
@ -1250,7 +1250,7 @@ tm2time(struct pg_tm * tm, fsec_t fsec, TimeADT *result)
|
|||||||
* if pg_time_t is just 32 bits) - thomas 97/05/27
|
* if pg_time_t is just 32 bits) - thomas 97/05/27
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
time2tm(TimeADT time, struct pg_tm * tm, fsec_t *fsec)
|
time2tm(TimeADT time, struct pg_tm *tm, fsec_t *fsec)
|
||||||
{
|
{
|
||||||
tm->tm_hour = time / USECS_PER_HOUR;
|
tm->tm_hour = time / USECS_PER_HOUR;
|
||||||
time -= tm->tm_hour * USECS_PER_HOUR;
|
time -= tm->tm_hour * USECS_PER_HOUR;
|
||||||
@ -1934,7 +1934,7 @@ time_part(PG_FUNCTION_ARGS)
|
|||||||
* Convert a tm structure to a time data type.
|
* Convert a tm structure to a time data type.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
tm2timetz(struct pg_tm * tm, fsec_t fsec, int tz, TimeTzADT *result)
|
tm2timetz(struct pg_tm *tm, fsec_t fsec, int tz, TimeTzADT *result)
|
||||||
{
|
{
|
||||||
result->time = ((((tm->tm_hour * MINS_PER_HOUR + tm->tm_min) * SECS_PER_MINUTE) + tm->tm_sec) *
|
result->time = ((((tm->tm_hour * MINS_PER_HOUR + tm->tm_min) * SECS_PER_MINUTE) + tm->tm_sec) *
|
||||||
USECS_PER_SEC) + fsec;
|
USECS_PER_SEC) + fsec;
|
||||||
@ -2068,7 +2068,7 @@ timetztypmodout(PG_FUNCTION_ARGS)
|
|||||||
* Convert TIME WITH TIME ZONE data type to POSIX time structure.
|
* Convert TIME WITH TIME ZONE data type to POSIX time structure.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
timetz2tm(TimeTzADT *time, struct pg_tm * tm, fsec_t *fsec, int *tzp)
|
timetz2tm(TimeTzADT *time, struct pg_tm *tm, fsec_t *fsec, int *tzp)
|
||||||
{
|
{
|
||||||
TimeOffset trem = time->time;
|
TimeOffset trem = time->time;
|
||||||
|
|
||||||
|
@ -34,22 +34,22 @@
|
|||||||
|
|
||||||
static int DecodeNumber(int flen, char *field, bool haveTextMonth,
|
static int DecodeNumber(int flen, char *field, bool haveTextMonth,
|
||||||
int fmask, int *tmask,
|
int fmask, int *tmask,
|
||||||
struct pg_tm * tm, fsec_t *fsec, bool *is2digits);
|
struct pg_tm *tm, fsec_t *fsec, bool *is2digits);
|
||||||
static int DecodeNumberField(int len, char *str,
|
static int DecodeNumberField(int len, char *str,
|
||||||
int fmask, int *tmask,
|
int fmask, int *tmask,
|
||||||
struct pg_tm * tm, fsec_t *fsec, bool *is2digits);
|
struct pg_tm *tm, fsec_t *fsec, bool *is2digits);
|
||||||
static int DecodeTime(char *str, int fmask, int range,
|
static int DecodeTime(char *str, int fmask, int range,
|
||||||
int *tmask, struct pg_tm * tm, fsec_t *fsec);
|
int *tmask, struct pg_tm *tm, fsec_t *fsec);
|
||||||
static const datetkn *datebsearch(const char *key, const datetkn *base, int nel);
|
static const datetkn *datebsearch(const char *key, const datetkn *base, int nel);
|
||||||
static int DecodeDate(char *str, int fmask, int *tmask, bool *is2digits,
|
static int DecodeDate(char *str, int fmask, int *tmask, bool *is2digits,
|
||||||
struct pg_tm * tm);
|
struct pg_tm *tm);
|
||||||
static char *AppendSeconds(char *cp, int sec, fsec_t fsec,
|
static char *AppendSeconds(char *cp, int sec, fsec_t fsec,
|
||||||
int precision, bool fillzeros);
|
int precision, bool fillzeros);
|
||||||
static void AdjustFractSeconds(double frac, struct pg_tm * tm, fsec_t *fsec,
|
static void AdjustFractSeconds(double frac, struct pg_tm *tm, fsec_t *fsec,
|
||||||
int scale);
|
int scale);
|
||||||
static void AdjustFractDays(double frac, struct pg_tm * tm, fsec_t *fsec,
|
static void AdjustFractDays(double frac, struct pg_tm *tm, fsec_t *fsec,
|
||||||
int scale);
|
int scale);
|
||||||
static int DetermineTimeZoneOffsetInternal(struct pg_tm * tm, pg_tz *tzp,
|
static int DetermineTimeZoneOffsetInternal(struct pg_tm *tm, pg_tz *tzp,
|
||||||
pg_time_t *tp);
|
pg_time_t *tp);
|
||||||
static bool DetermineTimeZoneAbbrevOffsetInternal(pg_time_t t,
|
static bool DetermineTimeZoneAbbrevOffsetInternal(pg_time_t t,
|
||||||
const char *abbr, pg_tz *tzp,
|
const char *abbr, pg_tz *tzp,
|
||||||
@ -367,7 +367,7 @@ j2day(int date)
|
|||||||
* Get the transaction start time ("now()") broken down as a struct pg_tm.
|
* Get the transaction start time ("now()") broken down as a struct pg_tm.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
GetCurrentDateTime(struct pg_tm * tm)
|
GetCurrentDateTime(struct pg_tm *tm)
|
||||||
{
|
{
|
||||||
int tz;
|
int tz;
|
||||||
fsec_t fsec;
|
fsec_t fsec;
|
||||||
@ -384,7 +384,7 @@ GetCurrentDateTime(struct pg_tm * tm)
|
|||||||
* including fractional seconds and timezone offset.
|
* including fractional seconds and timezone offset.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
GetCurrentTimeUsec(struct pg_tm * tm, fsec_t *fsec, int *tzp)
|
GetCurrentTimeUsec(struct pg_tm *tm, fsec_t *fsec, int *tzp)
|
||||||
{
|
{
|
||||||
int tz;
|
int tz;
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ AppendSeconds(char *cp, int sec, fsec_t fsec, int precision, bool fillzeros)
|
|||||||
* there; callers are responsible for NUL terminating str themselves.
|
* there; callers are responsible for NUL terminating str themselves.
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
AppendTimestampSeconds(char *cp, struct pg_tm * tm, fsec_t fsec)
|
AppendTimestampSeconds(char *cp, struct pg_tm *tm, fsec_t fsec)
|
||||||
{
|
{
|
||||||
return AppendSeconds(cp, tm->tm_sec, fsec, MAX_TIMESTAMP_PRECISION, true);
|
return AppendSeconds(cp, tm->tm_sec, fsec, MAX_TIMESTAMP_PRECISION, true);
|
||||||
}
|
}
|
||||||
@ -481,7 +481,7 @@ AppendTimestampSeconds(char *cp, struct pg_tm * tm, fsec_t fsec)
|
|||||||
* We assume the input frac is less than 1 so overflow is not an issue.
|
* We assume the input frac is less than 1 so overflow is not an issue.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
AdjustFractSeconds(double frac, struct pg_tm * tm, fsec_t *fsec, int scale)
|
AdjustFractSeconds(double frac, struct pg_tm *tm, fsec_t *fsec, int scale)
|
||||||
{
|
{
|
||||||
int sec;
|
int sec;
|
||||||
|
|
||||||
@ -496,7 +496,7 @@ AdjustFractSeconds(double frac, struct pg_tm * tm, fsec_t *fsec, int scale)
|
|||||||
|
|
||||||
/* As above, but initial scale produces days */
|
/* As above, but initial scale produces days */
|
||||||
static void
|
static void
|
||||||
AdjustFractDays(double frac, struct pg_tm * tm, fsec_t *fsec, int scale)
|
AdjustFractDays(double frac, struct pg_tm *tm, fsec_t *fsec, int scale)
|
||||||
{
|
{
|
||||||
int extra_days;
|
int extra_days;
|
||||||
|
|
||||||
@ -781,7 +781,7 @@ ParseDateTime(const char *timestr, char *workbuf, size_t buflen,
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
DecodeDateTime(char **field, int *ftype, int nf,
|
DecodeDateTime(char **field, int *ftype, int nf,
|
||||||
int *dtype, struct pg_tm * tm, fsec_t *fsec, int *tzp)
|
int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp)
|
||||||
{
|
{
|
||||||
int fmask = 0,
|
int fmask = 0,
|
||||||
tmask,
|
tmask,
|
||||||
@ -1468,7 +1468,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
|
|||||||
* though probably some higher-level code will.
|
* though probably some higher-level code will.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
DetermineTimeZoneOffset(struct pg_tm * tm, pg_tz *tzp)
|
DetermineTimeZoneOffset(struct pg_tm *tm, pg_tz *tzp)
|
||||||
{
|
{
|
||||||
pg_time_t t;
|
pg_time_t t;
|
||||||
|
|
||||||
@ -1490,7 +1490,7 @@ DetermineTimeZoneOffset(struct pg_tm * tm, pg_tz *tzp)
|
|||||||
* of mktime(), anyway.
|
* of mktime(), anyway.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DetermineTimeZoneOffsetInternal(struct pg_tm * tm, pg_tz *tzp, pg_time_t *tp)
|
DetermineTimeZoneOffsetInternal(struct pg_tm *tm, pg_tz *tzp, pg_time_t *tp)
|
||||||
{
|
{
|
||||||
int date,
|
int date,
|
||||||
sec;
|
sec;
|
||||||
@ -1626,7 +1626,7 @@ overflow:
|
|||||||
* back to doing DetermineTimeZoneOffset().)
|
* back to doing DetermineTimeZoneOffset().)
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
DetermineTimeZoneAbbrevOffset(struct pg_tm * tm, const char *abbr, pg_tz *tzp)
|
DetermineTimeZoneAbbrevOffset(struct pg_tm *tm, const char *abbr, pg_tz *tzp)
|
||||||
{
|
{
|
||||||
pg_time_t t;
|
pg_time_t t;
|
||||||
int zone_offset;
|
int zone_offset;
|
||||||
@ -1742,7 +1742,7 @@ DetermineTimeZoneAbbrevOffsetInternal(pg_time_t t, const char *abbr, pg_tz *tzp,
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
DecodeTimeOnly(char **field, int *ftype, int nf,
|
DecodeTimeOnly(char **field, int *ftype, int nf,
|
||||||
int *dtype, struct pg_tm * tm, fsec_t *fsec, int *tzp)
|
int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp)
|
||||||
{
|
{
|
||||||
int fmask = 0,
|
int fmask = 0,
|
||||||
tmask,
|
tmask,
|
||||||
@ -2367,7 +2367,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DecodeDate(char *str, int fmask, int *tmask, bool *is2digits,
|
DecodeDate(char *str, int fmask, int *tmask, bool *is2digits,
|
||||||
struct pg_tm * tm)
|
struct pg_tm *tm)
|
||||||
{
|
{
|
||||||
fsec_t fsec;
|
fsec_t fsec;
|
||||||
int nf = 0;
|
int nf = 0;
|
||||||
@ -2477,7 +2477,7 @@ DecodeDate(char *str, int fmask, int *tmask, bool *is2digits,
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc,
|
ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc,
|
||||||
struct pg_tm * tm)
|
struct pg_tm *tm)
|
||||||
{
|
{
|
||||||
if (fmask & DTK_M(YEAR))
|
if (fmask & DTK_M(YEAR))
|
||||||
{
|
{
|
||||||
@ -2556,7 +2556,7 @@ ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc,
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DecodeTime(char *str, int fmask, int range,
|
DecodeTime(char *str, int fmask, int range,
|
||||||
int *tmask, struct pg_tm * tm, fsec_t *fsec)
|
int *tmask, struct pg_tm *tm, fsec_t *fsec)
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
int dterr;
|
int dterr;
|
||||||
@ -2632,7 +2632,7 @@ DecodeTime(char *str, int fmask, int range,
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask,
|
DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask,
|
||||||
int *tmask, struct pg_tm * tm, fsec_t *fsec, bool *is2digits)
|
int *tmask, struct pg_tm *tm, fsec_t *fsec, bool *is2digits)
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
char *cp;
|
char *cp;
|
||||||
@ -2817,7 +2817,7 @@ DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask,
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DecodeNumberField(int len, char *str, int fmask,
|
DecodeNumberField(int len, char *str, int fmask,
|
||||||
int *tmask, struct pg_tm * tm, fsec_t *fsec, bool *is2digits)
|
int *tmask, struct pg_tm *tm, fsec_t *fsec, bool *is2digits)
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
@ -3068,7 +3068,7 @@ DecodeSpecial(int field, char *lowtoken, int *val)
|
|||||||
* Zero out a pg_tm and associated fsec_t
|
* Zero out a pg_tm and associated fsec_t
|
||||||
*/
|
*/
|
||||||
static inline void
|
static inline void
|
||||||
ClearPgTm(struct pg_tm * tm, fsec_t *fsec)
|
ClearPgTm(struct pg_tm *tm, fsec_t *fsec)
|
||||||
{
|
{
|
||||||
tm->tm_year = 0;
|
tm->tm_year = 0;
|
||||||
tm->tm_mon = 0;
|
tm->tm_mon = 0;
|
||||||
@ -3093,7 +3093,7 @@ ClearPgTm(struct pg_tm * tm, fsec_t *fsec)
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
DecodeInterval(char **field, int *ftype, int nf, int range,
|
DecodeInterval(char **field, int *ftype, int nf, int range,
|
||||||
int *dtype, struct pg_tm * tm, fsec_t *fsec)
|
int *dtype, struct pg_tm *tm, fsec_t *fsec)
|
||||||
{
|
{
|
||||||
bool is_before = FALSE;
|
bool is_before = FALSE;
|
||||||
char *cp;
|
char *cp;
|
||||||
@ -3519,7 +3519,7 @@ ISO8601IntegerWidth(char *fieldstart)
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
DecodeISO8601Interval(char *str,
|
DecodeISO8601Interval(char *str,
|
||||||
int *dtype, struct pg_tm * tm, fsec_t *fsec)
|
int *dtype, struct pg_tm *tm, fsec_t *fsec)
|
||||||
{
|
{
|
||||||
bool datepart = true;
|
bool datepart = true;
|
||||||
bool havefield = false;
|
bool havefield = false;
|
||||||
@ -3881,7 +3881,7 @@ EncodeTimezone(char *str, int tz, int style)
|
|||||||
* Encode date as local time.
|
* Encode date as local time.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
EncodeDateOnly(struct pg_tm * tm, int style, char *str)
|
EncodeDateOnly(struct pg_tm *tm, int style, char *str)
|
||||||
{
|
{
|
||||||
Assert(tm->tm_mon >= 1 && tm->tm_mon <= MONTHS_PER_YEAR);
|
Assert(tm->tm_mon >= 1 && tm->tm_mon <= MONTHS_PER_YEAR);
|
||||||
|
|
||||||
@ -3966,7 +3966,7 @@ EncodeDateOnly(struct pg_tm * tm, int style, char *str)
|
|||||||
* output.
|
* output.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, int style, char *str)
|
EncodeTimeOnly(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, int style, char *str)
|
||||||
{
|
{
|
||||||
str = pg_ltostr_zeropad(str, tm->tm_hour, 2);
|
str = pg_ltostr_zeropad(str, tm->tm_hour, 2);
|
||||||
*str++ = ':';
|
*str++ = ':';
|
||||||
@ -3996,7 +3996,7 @@ EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, int style,
|
|||||||
* XSD - yyyy-mm-ddThh:mm:ss.ss+/-tz
|
* XSD - yyyy-mm-ddThh:mm:ss.ss+/-tz
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
EncodeDateTime(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str)
|
EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str)
|
||||||
{
|
{
|
||||||
int day;
|
int day;
|
||||||
|
|
||||||
@ -4238,7 +4238,7 @@ AddVerboseIntPart(char *cp, int value, const char *units,
|
|||||||
* "day-time literal"s (that look like ('4 5:6:7')
|
* "day-time literal"s (that look like ('4 5:6:7')
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str)
|
EncodeInterval(struct pg_tm *tm, fsec_t fsec, int style, char *str)
|
||||||
{
|
{
|
||||||
char *cp = str;
|
char *cp = str;
|
||||||
int year = tm->tm_year;
|
int year = tm->tm_year;
|
||||||
|
@ -976,10 +976,10 @@ static void from_char_set_mode(TmFromChar *tmfc, const FromCharDateMode mode);
|
|||||||
static void from_char_set_int(int *dest, const int value, const FormatNode *node);
|
static void from_char_set_int(int *dest, const int value, const FormatNode *node);
|
||||||
static int from_char_parse_int_len(int *dest, char **src, const int len, FormatNode *node);
|
static int from_char_parse_int_len(int *dest, char **src, const int len, FormatNode *node);
|
||||||
static int from_char_parse_int(int *dest, char **src, FormatNode *node);
|
static int from_char_parse_int(int *dest, char **src, FormatNode *node);
|
||||||
static int seq_search(char *name, const char *const * array, int type, int max, int *len);
|
static int seq_search(char *name, const char *const *array, int type, int max, int *len);
|
||||||
static int from_char_seq_search(int *dest, char **src, const char *const * array, int type, int max, FormatNode *node);
|
static int from_char_seq_search(int *dest, char **src, const char *const *array, int type, int max, FormatNode *node);
|
||||||
static void do_to_timestamp(text *date_txt, text *fmt,
|
static void do_to_timestamp(text *date_txt, text *fmt,
|
||||||
struct pg_tm * tm, fsec_t *fsec);
|
struct pg_tm *tm, fsec_t *fsec);
|
||||||
static char *fill_str(char *str, int c, int max);
|
static char *fill_str(char *str, int c, int max);
|
||||||
static FormatNode *NUM_cache(int len, NUMDesc *Num, text *pars_str, bool *shouldFree);
|
static FormatNode *NUM_cache(int len, NUMDesc *Num, text *pars_str, bool *shouldFree);
|
||||||
static char *int_to_roman(int number);
|
static char *int_to_roman(int number);
|
||||||
@ -2303,10 +2303,10 @@ from_char_parse_int(int *dest, char **src, FormatNode *node)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
seq_search(char *name, const char *const * array, int type, int max, int *len)
|
seq_search(char *name, const char *const *array, int type, int max, int *len)
|
||||||
{
|
{
|
||||||
const char *p;
|
const char *p;
|
||||||
const char *const * a;
|
const char *const *a;
|
||||||
char *n;
|
char *n;
|
||||||
int last,
|
int last,
|
||||||
i;
|
i;
|
||||||
@ -2381,7 +2381,7 @@ seq_search(char *name, const char *const * array, int type, int max, int *len)
|
|||||||
* If the string doesn't match, throw an error.
|
* If the string doesn't match, throw an error.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
from_char_seq_search(int *dest, char **src, const char *const * array, int type, int max,
|
from_char_seq_search(int *dest, char **src, const char *const *array, int type, int max,
|
||||||
FormatNode *node)
|
FormatNode *node)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
@ -3609,7 +3609,7 @@ to_date(PG_FUNCTION_ARGS)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
do_to_timestamp(text *date_txt, text *fmt,
|
do_to_timestamp(text *date_txt, text *fmt,
|
||||||
struct pg_tm * tm, fsec_t *fsec)
|
struct pg_tm *tm, fsec_t *fsec)
|
||||||
{
|
{
|
||||||
FormatNode *format;
|
FormatNode *format;
|
||||||
TmFromChar tmfc;
|
TmFromChar tmfc;
|
||||||
|
@ -1333,7 +1333,7 @@ path_in(PG_FUNCTION_ARGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
base_size = sizeof(path->p[0]) * npts;
|
base_size = sizeof(path->p[0]) * npts;
|
||||||
size = offsetof(PATH, p) +base_size;
|
size = offsetof(PATH, p) + base_size;
|
||||||
|
|
||||||
/* Check for integer overflow */
|
/* Check for integer overflow */
|
||||||
if (base_size / npts != sizeof(path->p[0]) || size <= base_size)
|
if (base_size / npts != sizeof(path->p[0]) || size <= base_size)
|
||||||
@ -1403,7 +1403,7 @@ path_recv(PG_FUNCTION_ARGS)
|
|||||||
(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
|
(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
|
||||||
errmsg("invalid number of points in external \"path\" value")));
|
errmsg("invalid number of points in external \"path\" value")));
|
||||||
|
|
||||||
size = offsetof(PATH, p) +sizeof(path->p[0]) * npts;
|
size = offsetof(PATH, p) + sizeof(path->p[0]) * npts;
|
||||||
path = (PATH *) palloc(size);
|
path = (PATH *) palloc(size);
|
||||||
|
|
||||||
SET_VARSIZE(path, size);
|
SET_VARSIZE(path, size);
|
||||||
@ -3431,7 +3431,7 @@ poly_in(PG_FUNCTION_ARGS)
|
|||||||
"polygon", str)));
|
"polygon", str)));
|
||||||
|
|
||||||
base_size = sizeof(poly->p[0]) * npts;
|
base_size = sizeof(poly->p[0]) * npts;
|
||||||
size = offsetof(POLYGON, p) +base_size;
|
size = offsetof(POLYGON, p) + base_size;
|
||||||
|
|
||||||
/* Check for integer overflow */
|
/* Check for integer overflow */
|
||||||
if (base_size / npts != sizeof(poly->p[0]) || size <= base_size)
|
if (base_size / npts != sizeof(poly->p[0]) || size <= base_size)
|
||||||
@ -3486,7 +3486,7 @@ poly_recv(PG_FUNCTION_ARGS)
|
|||||||
(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
|
(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
|
||||||
errmsg("invalid number of points in external \"polygon\" value")));
|
errmsg("invalid number of points in external \"polygon\" value")));
|
||||||
|
|
||||||
size = offsetof(POLYGON, p) +sizeof(poly->p[0]) * npts;
|
size = offsetof(POLYGON, p) + sizeof(poly->p[0]) * npts;
|
||||||
poly = (POLYGON *) palloc0(size); /* zero any holes */
|
poly = (POLYGON *) palloc0(size); /* zero any holes */
|
||||||
|
|
||||||
SET_VARSIZE(poly, size);
|
SET_VARSIZE(poly, size);
|
||||||
@ -4243,7 +4243,7 @@ path_add(PG_FUNCTION_ARGS)
|
|||||||
PG_RETURN_NULL();
|
PG_RETURN_NULL();
|
||||||
|
|
||||||
base_size = sizeof(p1->p[0]) * (p1->npts + p2->npts);
|
base_size = sizeof(p1->p[0]) * (p1->npts + p2->npts);
|
||||||
size = offsetof(PATH, p) +base_size;
|
size = offsetof(PATH, p) + base_size;
|
||||||
|
|
||||||
/* Check for integer overflow */
|
/* Check for integer overflow */
|
||||||
if (base_size / sizeof(p1->p[0]) != (p1->npts + p2->npts) ||
|
if (base_size / sizeof(p1->p[0]) != (p1->npts + p2->npts) ||
|
||||||
@ -4385,7 +4385,7 @@ path_poly(PG_FUNCTION_ARGS)
|
|||||||
* Never overflows: the old size fit in MaxAllocSize, and the new size is
|
* Never overflows: the old size fit in MaxAllocSize, and the new size is
|
||||||
* just a small constant larger.
|
* just a small constant larger.
|
||||||
*/
|
*/
|
||||||
size = offsetof(POLYGON, p) +sizeof(poly->p[0]) * path->npts;
|
size = offsetof(POLYGON, p) + sizeof(poly->p[0]) * path->npts;
|
||||||
poly = (POLYGON *) palloc(size);
|
poly = (POLYGON *) palloc(size);
|
||||||
|
|
||||||
SET_VARSIZE(poly, size);
|
SET_VARSIZE(poly, size);
|
||||||
@ -4460,7 +4460,7 @@ box_poly(PG_FUNCTION_ARGS)
|
|||||||
int size;
|
int size;
|
||||||
|
|
||||||
/* map four corners of the box to a polygon */
|
/* map four corners of the box to a polygon */
|
||||||
size = offsetof(POLYGON, p) +sizeof(poly->p[0]) * 4;
|
size = offsetof(POLYGON, p) + sizeof(poly->p[0]) * 4;
|
||||||
poly = (POLYGON *) palloc(size);
|
poly = (POLYGON *) palloc(size);
|
||||||
|
|
||||||
SET_VARSIZE(poly, size);
|
SET_VARSIZE(poly, size);
|
||||||
@ -4494,7 +4494,7 @@ poly_path(PG_FUNCTION_ARGS)
|
|||||||
* Never overflows: the old size fit in MaxAllocSize, and the new size is
|
* Never overflows: the old size fit in MaxAllocSize, and the new size is
|
||||||
* smaller by a small constant.
|
* smaller by a small constant.
|
||||||
*/
|
*/
|
||||||
size = offsetof(PATH, p) +sizeof(path->p[0]) * poly->npts;
|
size = offsetof(PATH, p) + sizeof(path->p[0]) * poly->npts;
|
||||||
path = (PATH *) palloc(size);
|
path = (PATH *) palloc(size);
|
||||||
|
|
||||||
SET_VARSIZE(path, size);
|
SET_VARSIZE(path, size);
|
||||||
@ -5172,7 +5172,7 @@ circle_poly(PG_FUNCTION_ARGS)
|
|||||||
errmsg("must request at least 2 points")));
|
errmsg("must request at least 2 points")));
|
||||||
|
|
||||||
base_size = sizeof(poly->p[0]) * npts;
|
base_size = sizeof(poly->p[0]) * npts;
|
||||||
size = offsetof(POLYGON, p) +base_size;
|
size = offsetof(POLYGON, p) + base_size;
|
||||||
|
|
||||||
/* Check for integer overflow */
|
/* Check for integer overflow */
|
||||||
if (base_size / npts != sizeof(poly->p[0]) || size <= base_size)
|
if (base_size / npts != sizeof(poly->p[0]) || size <= base_size)
|
||||||
|
@ -822,7 +822,7 @@ int2mul(PG_FUNCTION_ARGS)
|
|||||||
* The most practical way to detect overflow is to do the arithmetic in
|
* The most practical way to detect overflow is to do the arithmetic in
|
||||||
* int32 (so that the result can't overflow) and then do a range check.
|
* int32 (so that the result can't overflow) and then do a range check.
|
||||||
*/
|
*/
|
||||||
result32 = (int32) arg1 *(int32) arg2;
|
result32 = (int32) arg1 * (int32) arg2;
|
||||||
|
|
||||||
if (result32 < SHRT_MIN || result32 > SHRT_MAX)
|
if (result32 < SHRT_MIN || result32 > SHRT_MAX)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
|
@ -84,7 +84,8 @@ typedef struct GetState
|
|||||||
char **path_names; /* field name(s) being sought */
|
char **path_names; /* field name(s) being sought */
|
||||||
int *path_indexes; /* array index(es) being sought */
|
int *path_indexes; /* array index(es) being sought */
|
||||||
bool *pathok; /* is path matched to current depth? */
|
bool *pathok; /* is path matched to current depth? */
|
||||||
int *array_cur_index; /* current element index at each path level */
|
int *array_cur_index; /* current element index at each path
|
||||||
|
* level */
|
||||||
} GetState;
|
} GetState;
|
||||||
|
|
||||||
/* state for json_array_length */
|
/* state for json_array_length */
|
||||||
|
@ -71,8 +71,8 @@
|
|||||||
* Function prototypes -- internal to this file only
|
* Function prototypes -- internal to this file only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static AbsoluteTime tm2abstime(struct pg_tm * tm, int tz);
|
static AbsoluteTime tm2abstime(struct pg_tm *tm, int tz);
|
||||||
static void reltime2tm(RelativeTime time, struct pg_tm * tm);
|
static void reltime2tm(RelativeTime time, struct pg_tm *tm);
|
||||||
static void parsetinterval(char *i_string,
|
static void parsetinterval(char *i_string,
|
||||||
AbsoluteTime *i_start,
|
AbsoluteTime *i_start,
|
||||||
AbsoluteTime *i_end);
|
AbsoluteTime *i_end);
|
||||||
@ -96,7 +96,7 @@ GetCurrentAbsoluteTime(void)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
abstime2tm(AbsoluteTime _time, int *tzp, struct pg_tm * tm, char **tzn)
|
abstime2tm(AbsoluteTime _time, int *tzp, struct pg_tm *tm, char **tzn)
|
||||||
{
|
{
|
||||||
pg_time_t time = (pg_time_t) _time;
|
pg_time_t time = (pg_time_t) _time;
|
||||||
struct pg_tm *tx;
|
struct pg_tm *tx;
|
||||||
@ -148,7 +148,7 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct pg_tm * tm, char **tzn)
|
|||||||
* Note that tm has full year (not 1900-based) and 1-based month.
|
* Note that tm has full year (not 1900-based) and 1-based month.
|
||||||
*/
|
*/
|
||||||
static AbsoluteTime
|
static AbsoluteTime
|
||||||
tm2abstime(struct pg_tm * tm, int tz)
|
tm2abstime(struct pg_tm *tm, int tz)
|
||||||
{
|
{
|
||||||
int day;
|
int day;
|
||||||
AbsoluteTime sec;
|
AbsoluteTime sec;
|
||||||
@ -680,7 +680,7 @@ reltimesend(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
reltime2tm(RelativeTime time, struct pg_tm * tm)
|
reltime2tm(RelativeTime time, struct pg_tm *tm)
|
||||||
{
|
{
|
||||||
double dtime = time;
|
double dtime = time;
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ assign_locale_messages(const char *newval, void *extra)
|
|||||||
* itself.) It's important that this not throw elog(ERROR).
|
* itself.) It's important that this not throw elog(ERROR).
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
free_struct_lconv(struct lconv * s)
|
free_struct_lconv(struct lconv *s)
|
||||||
{
|
{
|
||||||
if (s->decimal_point)
|
if (s->decimal_point)
|
||||||
free(s->decimal_point);
|
free(s->decimal_point);
|
||||||
@ -419,7 +419,7 @@ free_struct_lconv(struct lconv * s)
|
|||||||
* about) are non-NULL. The field list must match free_struct_lconv().
|
* about) are non-NULL. The field list must match free_struct_lconv().
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
struct_lconv_is_valid(struct lconv * s)
|
struct_lconv_is_valid(struct lconv *s)
|
||||||
{
|
{
|
||||||
if (s->decimal_point == NULL)
|
if (s->decimal_point == NULL)
|
||||||
return false;
|
return false;
|
||||||
@ -705,7 +705,7 @@ PGLC_localeconv(void)
|
|||||||
*/
|
*/
|
||||||
static size_t
|
static size_t
|
||||||
strftime_win32(char *dst, size_t dstlen,
|
strftime_win32(char *dst, size_t dstlen,
|
||||||
const char *format, const struct tm * tm)
|
const char *format, const struct tm *tm)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
wchar_t wformat[8]; /* formats used below need 3 bytes */
|
wchar_t wformat[8]; /* formats used below need 3 bytes */
|
||||||
@ -756,7 +756,7 @@ strftime_win32(char *dst, size_t dstlen,
|
|||||||
|
|
||||||
/* Subroutine for cache_locale_time(). */
|
/* Subroutine for cache_locale_time(). */
|
||||||
static void
|
static void
|
||||||
cache_single_time(char **dst, const char *format, const struct tm * tm)
|
cache_single_time(char **dst, const char *format, const struct tm *tm)
|
||||||
{
|
{
|
||||||
char buf[MAX_L10N_DATA];
|
char buf[MAX_L10N_DATA];
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
@ -4221,7 +4221,8 @@ convert_string_datum(Datum value, Oid typid)
|
|||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?
|
* http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?
|
||||||
* FeedbackID=99694 */
|
* FeedbackID=99694
|
||||||
|
*/
|
||||||
{
|
{
|
||||||
char x[1];
|
char x[1];
|
||||||
|
|
||||||
|
@ -455,7 +455,7 @@ timestamptz_in(PG_FUNCTION_ARGS)
|
|||||||
* don't care, so we don't bother being consistent.
|
* don't care, so we don't bother being consistent.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
parse_sane_timezone(struct pg_tm * tm, text *zone)
|
parse_sane_timezone(struct pg_tm *tm, text *zone)
|
||||||
{
|
{
|
||||||
char tzname[TZ_STRLEN_MAX + 1];
|
char tzname[TZ_STRLEN_MAX + 1];
|
||||||
int rt;
|
int rt;
|
||||||
@ -1755,7 +1755,7 @@ dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec)
|
|||||||
* If attimezone is NULL, the global timezone setting will be used.
|
* If attimezone is NULL, the global timezone setting will be used.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm, fsec_t *fsec, const char **tzn, pg_tz *attimezone)
|
timestamp2tm(Timestamp dt, int *tzp, struct pg_tm *tm, fsec_t *fsec, const char **tzn, pg_tz *attimezone)
|
||||||
{
|
{
|
||||||
Timestamp date;
|
Timestamp date;
|
||||||
Timestamp time;
|
Timestamp time;
|
||||||
@ -1851,7 +1851,7 @@ timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm, fsec_t *fsec, const char
|
|||||||
* Returns -1 on failure (value out of range).
|
* Returns -1 on failure (value out of range).
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result)
|
tm2timestamp(struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *result)
|
||||||
{
|
{
|
||||||
TimeOffset date;
|
TimeOffset date;
|
||||||
TimeOffset time;
|
TimeOffset time;
|
||||||
@ -1899,7 +1899,7 @@ tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result)
|
|||||||
* Convert an interval data type to a tm structure.
|
* Convert an interval data type to a tm structure.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
interval2tm(Interval span, struct pg_tm * tm, fsec_t *fsec)
|
interval2tm(Interval span, struct pg_tm *tm, fsec_t *fsec)
|
||||||
{
|
{
|
||||||
TimeOffset time;
|
TimeOffset time;
|
||||||
TimeOffset tfrac;
|
TimeOffset tfrac;
|
||||||
@ -1927,7 +1927,7 @@ interval2tm(Interval span, struct pg_tm * tm, fsec_t *fsec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
tm2interval(struct pg_tm * tm, fsec_t fsec, Interval *span)
|
tm2interval(struct pg_tm *tm, fsec_t fsec, Interval *span)
|
||||||
{
|
{
|
||||||
double total_months = (double) tm->tm_year * MONTHS_PER_YEAR + tm->tm_mon;
|
double total_months = (double) tm->tm_year * MONTHS_PER_YEAR + tm->tm_mon;
|
||||||
|
|
||||||
@ -1981,7 +1981,7 @@ interval_finite(PG_FUNCTION_ARGS)
|
|||||||
*---------------------------------------------------------*/
|
*---------------------------------------------------------*/
|
||||||
|
|
||||||
void
|
void
|
||||||
GetEpochTime(struct pg_tm * tm)
|
GetEpochTime(struct pg_tm *tm)
|
||||||
{
|
{
|
||||||
struct pg_tm *t0;
|
struct pg_tm *t0;
|
||||||
pg_time_t epoch = 0;
|
pg_time_t epoch = 0;
|
||||||
|
@ -1015,7 +1015,8 @@ tsqueryrecv(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
if (item->type == QI_VAL)
|
if (item->type == QI_VAL)
|
||||||
{
|
{
|
||||||
size_t val_len; /* length after recoding to server encoding */
|
size_t val_len; /* length after recoding to server
|
||||||
|
* encoding */
|
||||||
uint8 weight;
|
uint8 weight;
|
||||||
uint8 prefix;
|
uint8 prefix;
|
||||||
const char *val;
|
const char *val;
|
||||||
|
@ -910,7 +910,7 @@ calc_rank_cd(const float4 *arrdata, TSVector txt, TSQuery query, int method)
|
|||||||
CurExtPos = ((double) (ext.q + ext.p)) / 2.0;
|
CurExtPos = ((double) (ext.q + ext.p)) / 2.0;
|
||||||
if (NExtent > 0 && CurExtPos > PrevExtPos /* prevent division by
|
if (NExtent > 0 && CurExtPos > PrevExtPos /* prevent division by
|
||||||
* zero in a case of
|
* zero in a case of
|
||||||
multiple lexize */ )
|
* multiple lexize */ )
|
||||||
SumDist += 1.0 / (CurExtPos - PrevExtPos);
|
SumDist += 1.0 / (CurExtPos - PrevExtPos);
|
||||||
|
|
||||||
PrevExtPos = CurExtPos;
|
PrevExtPos = CurExtPos;
|
||||||
|
2
src/backend/utils/cache/catcache.c
vendored
2
src/backend/utils/cache/catcache.c
vendored
@ -1571,7 +1571,7 @@ SearchCatCacheList(CatCache *cache,
|
|||||||
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
|
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
|
||||||
nmembers = list_length(ctlist);
|
nmembers = list_length(ctlist);
|
||||||
cl = (CatCList *)
|
cl = (CatCList *)
|
||||||
palloc(offsetof(CatCList, members) +nmembers * sizeof(CatCTup *));
|
palloc(offsetof(CatCList, members) + nmembers * sizeof(CatCTup *));
|
||||||
heap_copytuple_with_tuple(ntp, &cl->tuple);
|
heap_copytuple_with_tuple(ntp, &cl->tuple);
|
||||||
MemoryContextSwitchTo(oldcxt);
|
MemoryContextSwitchTo(oldcxt);
|
||||||
heap_freetuple(ntp);
|
heap_freetuple(ntp);
|
||||||
|
4
src/backend/utils/cache/typcache.c
vendored
4
src/backend/utils/cache/typcache.c
vendored
@ -888,8 +888,8 @@ load_domaintype_info(TypeCacheEntry *typentry)
|
|||||||
static int
|
static int
|
||||||
dcs_cmp(const void *a, const void *b)
|
dcs_cmp(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
const DomainConstraintState *const * ca = (const DomainConstraintState *const *) a;
|
const DomainConstraintState *const *ca = (const DomainConstraintState *const *) a;
|
||||||
const DomainConstraintState *const * cb = (const DomainConstraintState *const *) b;
|
const DomainConstraintState *const *cb = (const DomainConstraintState *const *) b;
|
||||||
|
|
||||||
return strcmp((*ca)->name, (*cb)->name);
|
return strcmp((*ca)->name, (*cb)->name);
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ internal_load_library(const char *libname)
|
|||||||
* File not loaded yet.
|
* File not loaded yet.
|
||||||
*/
|
*/
|
||||||
file_scanner = (DynamicFileList *)
|
file_scanner = (DynamicFileList *)
|
||||||
malloc(offsetof(DynamicFileList, filename) +strlen(libname) + 1);
|
malloc(offsetof(DynamicFileList, filename) + strlen(libname) + 1);
|
||||||
if (file_scanner == NULL)
|
if (file_scanner == NULL)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_OUT_OF_MEMORY),
|
(errcode(ERRCODE_OUT_OF_MEMORY),
|
||||||
|
@ -1828,7 +1828,7 @@ Float8GetDatum(float8 X)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
struct varlena *
|
struct varlena *
|
||||||
pg_detoast_datum(struct varlena * datum)
|
pg_detoast_datum(struct varlena *datum)
|
||||||
{
|
{
|
||||||
if (VARATT_IS_EXTENDED(datum))
|
if (VARATT_IS_EXTENDED(datum))
|
||||||
return heap_tuple_untoast_attr(datum);
|
return heap_tuple_untoast_attr(datum);
|
||||||
@ -1837,7 +1837,7 @@ pg_detoast_datum(struct varlena * datum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct varlena *
|
struct varlena *
|
||||||
pg_detoast_datum_copy(struct varlena * datum)
|
pg_detoast_datum_copy(struct varlena *datum)
|
||||||
{
|
{
|
||||||
if (VARATT_IS_EXTENDED(datum))
|
if (VARATT_IS_EXTENDED(datum))
|
||||||
return heap_tuple_untoast_attr(datum);
|
return heap_tuple_untoast_attr(datum);
|
||||||
@ -1853,14 +1853,14 @@ pg_detoast_datum_copy(struct varlena * datum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct varlena *
|
struct varlena *
|
||||||
pg_detoast_datum_slice(struct varlena * datum, int32 first, int32 count)
|
pg_detoast_datum_slice(struct varlena *datum, int32 first, int32 count)
|
||||||
{
|
{
|
||||||
/* Only get the specified portion from the toast rel */
|
/* Only get the specified portion from the toast rel */
|
||||||
return heap_tuple_untoast_attr_slice(datum, first, count);
|
return heap_tuple_untoast_attr_slice(datum, first, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct varlena *
|
struct varlena *
|
||||||
pg_detoast_datum_packed(struct varlena * datum)
|
pg_detoast_datum_packed(struct varlena *datum)
|
||||||
{
|
{
|
||||||
if (VARATT_IS_COMPRESSED(datum) || VARATT_IS_EXTERNAL(datum))
|
if (VARATT_IS_COMPRESSED(datum) || VARATT_IS_EXTERNAL(datum))
|
||||||
return heap_tuple_untoast_attr(datum);
|
return heap_tuple_untoast_attr(datum);
|
||||||
|
@ -331,7 +331,7 @@ hash_create(const char *tabname, long nelem, HASHCTL *info, int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the hash header, plus a copy of the table name */
|
/* Initialize the hash header, plus a copy of the table name */
|
||||||
hashp = (HTAB *) DynaHashAlloc(sizeof(HTAB) + strlen(tabname) +1);
|
hashp = (HTAB *) DynaHashAlloc(sizeof(HTAB) + strlen(tabname) + 1);
|
||||||
MemSet(hashp, 0, sizeof(HTAB));
|
MemSet(hashp, 0, sizeof(HTAB));
|
||||||
|
|
||||||
hashp->tabname = (char *) (hashp + 1);
|
hashp->tabname = (char *) (hashp + 1);
|
||||||
|
@ -581,7 +581,7 @@ struct mbinterval
|
|||||||
|
|
||||||
/* auxiliary function for binary search in interval table */
|
/* auxiliary function for binary search in interval table */
|
||||||
static int
|
static int
|
||||||
mbbisearch(pg_wchar ucs, const struct mbinterval * table, int max)
|
mbbisearch(pg_wchar ucs, const struct mbinterval *table, int max)
|
||||||
{
|
{
|
||||||
int min = 0;
|
int min = 0;
|
||||||
int mid;
|
int mid;
|
||||||
|
@ -71,7 +71,7 @@ typedef struct
|
|||||||
unsigned short seed[3];
|
unsigned short seed[3];
|
||||||
} BackendRandomShmemStruct;
|
} BackendRandomShmemStruct;
|
||||||
|
|
||||||
static BackendRandomShmemStruct *BackendRandomShmem;
|
static BackendRandomShmemStruct * BackendRandomShmem;
|
||||||
|
|
||||||
Size
|
Size
|
||||||
BackendRandomShmemSize(void)
|
BackendRandomShmemSize(void)
|
||||||
|
@ -136,15 +136,15 @@ static void do_serialize(char **destptr, Size *maxbytes, const char *fmt,...) pg
|
|||||||
|
|
||||||
static void set_config_sourcefile(const char *name, char *sourcefile,
|
static void set_config_sourcefile(const char *name, char *sourcefile,
|
||||||
int sourceline);
|
int sourceline);
|
||||||
static bool call_bool_check_hook(struct config_bool * conf, bool *newval,
|
static bool call_bool_check_hook(struct config_bool *conf, bool *newval,
|
||||||
void **extra, GucSource source, int elevel);
|
void **extra, GucSource source, int elevel);
|
||||||
static bool call_int_check_hook(struct config_int * conf, int *newval,
|
static bool call_int_check_hook(struct config_int *conf, int *newval,
|
||||||
void **extra, GucSource source, int elevel);
|
void **extra, GucSource source, int elevel);
|
||||||
static bool call_real_check_hook(struct config_real * conf, double *newval,
|
static bool call_real_check_hook(struct config_real *conf, double *newval,
|
||||||
void **extra, GucSource source, int elevel);
|
void **extra, GucSource source, int elevel);
|
||||||
static bool call_string_check_hook(struct config_string * conf, char **newval,
|
static bool call_string_check_hook(struct config_string *conf, char **newval,
|
||||||
void **extra, GucSource source, int elevel);
|
void **extra, GucSource source, int elevel);
|
||||||
static bool call_enum_check_hook(struct config_enum * conf, int *newval,
|
static bool call_enum_check_hook(struct config_enum *conf, int *newval,
|
||||||
void **extra, GucSource source, int elevel);
|
void **extra, GucSource source, int elevel);
|
||||||
|
|
||||||
static bool check_log_destination(char **newval, void **extra, GucSource source);
|
static bool check_log_destination(char **newval, void **extra, GucSource source);
|
||||||
@ -3951,17 +3951,17 @@ static int GUCNestLevel = 0; /* 1 when in main transaction */
|
|||||||
static int guc_var_compare(const void *a, const void *b);
|
static int guc_var_compare(const void *a, const void *b);
|
||||||
static int guc_name_compare(const char *namea, const char *nameb);
|
static int guc_name_compare(const char *namea, const char *nameb);
|
||||||
static void InitializeGUCOptionsFromEnvironment(void);
|
static void InitializeGUCOptionsFromEnvironment(void);
|
||||||
static void InitializeOneGUCOption(struct config_generic * gconf);
|
static void InitializeOneGUCOption(struct config_generic *gconf);
|
||||||
static void push_old_value(struct config_generic * gconf, GucAction action);
|
static void push_old_value(struct config_generic *gconf, GucAction action);
|
||||||
static void ReportGUCOption(struct config_generic * record);
|
static void ReportGUCOption(struct config_generic *record);
|
||||||
static void reapply_stacked_values(struct config_generic * variable,
|
static void reapply_stacked_values(struct config_generic *variable,
|
||||||
struct config_string * pHolder,
|
struct config_string *pHolder,
|
||||||
GucStack *stack,
|
GucStack *stack,
|
||||||
const char *curvalue,
|
const char *curvalue,
|
||||||
GucContext curscontext, GucSource cursource);
|
GucContext curscontext, GucSource cursource);
|
||||||
static void ShowGUCConfigOption(const char *name, DestReceiver *dest);
|
static void ShowGUCConfigOption(const char *name, DestReceiver *dest);
|
||||||
static void ShowAllGUCConfig(DestReceiver *dest);
|
static void ShowAllGUCConfig(DestReceiver *dest);
|
||||||
static char *_ShowOption(struct config_generic * record, bool use_units);
|
static char *_ShowOption(struct config_generic *record, bool use_units);
|
||||||
static bool validate_option_array_item(const char *name, const char *value,
|
static bool validate_option_array_item(const char *name, const char *value,
|
||||||
bool skipIfNoPermissions);
|
bool skipIfNoPermissions);
|
||||||
static void write_auto_conf_file(int fd, const char *filename, ConfigVariable *head_p);
|
static void write_auto_conf_file(int fd, const char *filename, ConfigVariable *head_p);
|
||||||
@ -4022,7 +4022,7 @@ guc_strdup(int elevel, const char *src)
|
|||||||
* Detect whether strval is referenced anywhere in a GUC string item
|
* Detect whether strval is referenced anywhere in a GUC string item
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
string_field_used(struct config_string * conf, char *strval)
|
string_field_used(struct config_string *conf, char *strval)
|
||||||
{
|
{
|
||||||
GucStack *stack;
|
GucStack *stack;
|
||||||
|
|
||||||
@ -4045,7 +4045,7 @@ string_field_used(struct config_string * conf, char *strval)
|
|||||||
* states).
|
* states).
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
set_string_field(struct config_string * conf, char **field, char *newval)
|
set_string_field(struct config_string *conf, char **field, char *newval)
|
||||||
{
|
{
|
||||||
char *oldval = *field;
|
char *oldval = *field;
|
||||||
|
|
||||||
@ -4061,7 +4061,7 @@ set_string_field(struct config_string * conf, char **field, char *newval)
|
|||||||
* Detect whether an "extra" struct is referenced anywhere in a GUC item
|
* Detect whether an "extra" struct is referenced anywhere in a GUC item
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
extra_field_used(struct config_generic * gconf, void *extra)
|
extra_field_used(struct config_generic *gconf, void *extra)
|
||||||
{
|
{
|
||||||
GucStack *stack;
|
GucStack *stack;
|
||||||
|
|
||||||
@ -4106,7 +4106,7 @@ extra_field_used(struct config_generic * gconf, void *extra)
|
|||||||
* states).
|
* states).
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
set_extra_field(struct config_generic * gconf, void **field, void *newval)
|
set_extra_field(struct config_generic *gconf, void **field, void *newval)
|
||||||
{
|
{
|
||||||
void *oldval = *field;
|
void *oldval = *field;
|
||||||
|
|
||||||
@ -4126,7 +4126,7 @@ set_extra_field(struct config_generic * gconf, void **field, void *newval)
|
|||||||
* initialized to NULL before this is used, else we'll try to free() them.
|
* initialized to NULL before this is used, else we'll try to free() them.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
set_stack_value(struct config_generic * gconf, config_var_value *val)
|
set_stack_value(struct config_generic *gconf, config_var_value *val)
|
||||||
{
|
{
|
||||||
switch (gconf->vartype)
|
switch (gconf->vartype)
|
||||||
{
|
{
|
||||||
@ -4160,7 +4160,7 @@ set_stack_value(struct config_generic * gconf, config_var_value *val)
|
|||||||
* The "extra" field associated with the stack entry is cleared, too.
|
* The "extra" field associated with the stack entry is cleared, too.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
discard_stack_value(struct config_generic * gconf, config_var_value *val)
|
discard_stack_value(struct config_generic *gconf, config_var_value *val)
|
||||||
{
|
{
|
||||||
switch (gconf->vartype)
|
switch (gconf->vartype)
|
||||||
{
|
{
|
||||||
@ -4283,7 +4283,7 @@ build_guc_variables(void)
|
|||||||
* list is expanded if needed.
|
* list is expanded if needed.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
add_guc_variable(struct config_generic * var, int elevel)
|
add_guc_variable(struct config_generic *var, int elevel)
|
||||||
{
|
{
|
||||||
if (num_guc_variables + 1 >= size_guc_variables)
|
if (num_guc_variables + 1 >= size_guc_variables)
|
||||||
{
|
{
|
||||||
@ -4420,8 +4420,8 @@ find_option(const char *name, bool create_placeholders, int elevel)
|
|||||||
static int
|
static int
|
||||||
guc_var_compare(const void *a, const void *b)
|
guc_var_compare(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
const struct config_generic *confa = *(struct config_generic * const *) a;
|
const struct config_generic *confa = *(struct config_generic *const *) a;
|
||||||
const struct config_generic *confb = *(struct config_generic * const *) b;
|
const struct config_generic *confb = *(struct config_generic *const *) b;
|
||||||
|
|
||||||
return guc_name_compare(confa->name, confb->name);
|
return guc_name_compare(confa->name, confb->name);
|
||||||
}
|
}
|
||||||
@ -4566,7 +4566,7 @@ InitializeGUCOptionsFromEnvironment(void)
|
|||||||
* might fail, but that the hooks might wish to compute an "extra" struct.
|
* might fail, but that the hooks might wish to compute an "extra" struct.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
InitializeOneGUCOption(struct config_generic * gconf)
|
InitializeOneGUCOption(struct config_generic *gconf)
|
||||||
{
|
{
|
||||||
gconf->status = 0;
|
gconf->status = 0;
|
||||||
gconf->source = PGC_S_DEFAULT;
|
gconf->source = PGC_S_DEFAULT;
|
||||||
@ -4961,7 +4961,7 @@ ResetAllOptions(void)
|
|||||||
* Push previous state during transactional assignment to a GUC variable.
|
* Push previous state during transactional assignment to a GUC variable.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
push_old_value(struct config_generic * gconf, GucAction action)
|
push_old_value(struct config_generic *gconf, GucAction action)
|
||||||
{
|
{
|
||||||
GucStack *stack;
|
GucStack *stack;
|
||||||
|
|
||||||
@ -5385,7 +5385,7 @@ BeginReportingGUCOptions(void)
|
|||||||
* ReportGUCOption: if appropriate, transmit option value to frontend
|
* ReportGUCOption: if appropriate, transmit option value to frontend
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
ReportGUCOption(struct config_generic * record)
|
ReportGUCOption(struct config_generic *record)
|
||||||
{
|
{
|
||||||
if (reporting_enabled && (record->flags & GUC_REPORT))
|
if (reporting_enabled && (record->flags & GUC_REPORT))
|
||||||
{
|
{
|
||||||
@ -5614,7 +5614,7 @@ parse_real(const char *value, double *result)
|
|||||||
* allocated for modification.
|
* allocated for modification.
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
config_enum_lookup_by_value(struct config_enum * record, int val)
|
config_enum_lookup_by_value(struct config_enum *record, int val)
|
||||||
{
|
{
|
||||||
const struct config_enum_entry *entry;
|
const struct config_enum_entry *entry;
|
||||||
|
|
||||||
@ -5637,7 +5637,7 @@ config_enum_lookup_by_value(struct config_enum * record, int val)
|
|||||||
* true. If it's not found, return FALSE and retval is set to 0.
|
* true. If it's not found, return FALSE and retval is set to 0.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
config_enum_lookup_by_name(struct config_enum * record, const char *value,
|
config_enum_lookup_by_name(struct config_enum *record, const char *value,
|
||||||
int *retval)
|
int *retval)
|
||||||
{
|
{
|
||||||
const struct config_enum_entry *entry;
|
const struct config_enum_entry *entry;
|
||||||
@ -5663,7 +5663,7 @@ config_enum_lookup_by_name(struct config_enum * record, const char *value,
|
|||||||
* If suffix is non-NULL, it is added to the end of the string.
|
* If suffix is non-NULL, it is added to the end of the string.
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
config_enum_get_options(struct config_enum * record, const char *prefix,
|
config_enum_get_options(struct config_enum *record, const char *prefix,
|
||||||
const char *suffix, const char *separator)
|
const char *suffix, const char *separator)
|
||||||
{
|
{
|
||||||
const struct config_enum_entry *entry;
|
const struct config_enum_entry *entry;
|
||||||
@ -5721,10 +5721,10 @@ config_enum_get_options(struct config_enum * record, const char *prefix,
|
|||||||
* Returns true if OK, false if not (or throws error, if elevel >= ERROR)
|
* Returns true if OK, false if not (or throws error, if elevel >= ERROR)
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
parse_and_validate_value(struct config_generic * record,
|
parse_and_validate_value(struct config_generic *record,
|
||||||
const char *name, const char *value,
|
const char *name, const char *value,
|
||||||
GucSource source, int elevel,
|
GucSource source, int elevel,
|
||||||
union config_var_val * newval, void **newextra)
|
union config_var_val *newval, void **newextra)
|
||||||
{
|
{
|
||||||
switch (record->vartype)
|
switch (record->vartype)
|
||||||
{
|
{
|
||||||
@ -7545,7 +7545,7 @@ init_custom_variable(const char *name,
|
|||||||
* variable into the GUC variable array, replacing any placeholder.
|
* variable into the GUC variable array, replacing any placeholder.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
define_custom_variable(struct config_generic * variable)
|
define_custom_variable(struct config_generic *variable)
|
||||||
{
|
{
|
||||||
const char *name = variable->name;
|
const char *name = variable->name;
|
||||||
const char **nameAddr = &name;
|
const char **nameAddr = &name;
|
||||||
@ -7645,8 +7645,8 @@ define_custom_variable(struct config_generic * variable)
|
|||||||
* fashion implied by the stack entry.
|
* fashion implied by the stack entry.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
reapply_stacked_values(struct config_generic * variable,
|
reapply_stacked_values(struct config_generic *variable,
|
||||||
struct config_string * pHolder,
|
struct config_string *pHolder,
|
||||||
GucStack *stack,
|
GucStack *stack,
|
||||||
const char *curvalue,
|
const char *curvalue,
|
||||||
GucContext curscontext, GucSource cursource)
|
GucContext curscontext, GucSource cursource)
|
||||||
@ -7842,7 +7842,7 @@ DefineCustomEnumVariable(const char *name,
|
|||||||
const char *long_desc,
|
const char *long_desc,
|
||||||
int *valueAddr,
|
int *valueAddr,
|
||||||
int bootValue,
|
int bootValue,
|
||||||
const struct config_enum_entry * options,
|
const struct config_enum_entry *options,
|
||||||
GucContext context,
|
GucContext context,
|
||||||
int flags,
|
int flags,
|
||||||
GucEnumCheckHook check_hook,
|
GucEnumCheckHook check_hook,
|
||||||
@ -8630,7 +8630,7 @@ show_all_file_settings(PG_FUNCTION_ARGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
_ShowOption(struct config_generic * record, bool use_units)
|
_ShowOption(struct config_generic *record, bool use_units)
|
||||||
{
|
{
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
const char *val;
|
const char *val;
|
||||||
@ -8741,7 +8741,7 @@ _ShowOption(struct config_generic * record, bool use_units)
|
|||||||
* variable scontext, integer
|
* variable scontext, integer
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
write_one_nondefault_variable(FILE *fp, struct config_generic * gconf)
|
write_one_nondefault_variable(FILE *fp, struct config_generic *gconf)
|
||||||
{
|
{
|
||||||
if (gconf->source == PGC_S_DEFAULT)
|
if (gconf->source == PGC_S_DEFAULT)
|
||||||
return;
|
return;
|
||||||
@ -8977,7 +8977,7 @@ read_nondefault_variables(void)
|
|||||||
* never sends these, and RestoreGUCState() never changes them.
|
* never sends these, and RestoreGUCState() never changes them.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
can_skip_gucvar(struct config_generic * gconf)
|
can_skip_gucvar(struct config_generic *gconf)
|
||||||
{
|
{
|
||||||
return gconf->context == PGC_POSTMASTER ||
|
return gconf->context == PGC_POSTMASTER ||
|
||||||
gconf->context == PGC_INTERNAL || gconf->source == PGC_S_DEFAULT;
|
gconf->context == PGC_INTERNAL || gconf->source == PGC_S_DEFAULT;
|
||||||
@ -8990,7 +8990,7 @@ can_skip_gucvar(struct config_generic * gconf)
|
|||||||
* It's OK to overestimate, but not to underestimate.
|
* It's OK to overestimate, but not to underestimate.
|
||||||
*/
|
*/
|
||||||
static Size
|
static Size
|
||||||
estimate_variable_size(struct config_generic * gconf)
|
estimate_variable_size(struct config_generic *gconf)
|
||||||
{
|
{
|
||||||
Size size;
|
Size size;
|
||||||
Size valsize = 0;
|
Size valsize = 0;
|
||||||
@ -9162,7 +9162,7 @@ do_serialize_binary(char **destptr, Size *maxbytes, void *val, Size valsize)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
serialize_variable(char **destptr, Size *maxbytes,
|
serialize_variable(char **destptr, Size *maxbytes,
|
||||||
struct config_generic * gconf)
|
struct config_generic *gconf)
|
||||||
{
|
{
|
||||||
if (can_skip_gucvar(gconf))
|
if (can_skip_gucvar(gconf))
|
||||||
return;
|
return;
|
||||||
@ -9783,7 +9783,7 @@ GUC_check_errcode(int sqlerrcode)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
call_bool_check_hook(struct config_bool * conf, bool *newval, void **extra,
|
call_bool_check_hook(struct config_bool *conf, bool *newval, void **extra,
|
||||||
GucSource source, int elevel)
|
GucSource source, int elevel)
|
||||||
{
|
{
|
||||||
/* Quick success if no hook */
|
/* Quick success if no hook */
|
||||||
@ -9817,7 +9817,7 @@ call_bool_check_hook(struct config_bool * conf, bool *newval, void **extra,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
call_int_check_hook(struct config_int * conf, int *newval, void **extra,
|
call_int_check_hook(struct config_int *conf, int *newval, void **extra,
|
||||||
GucSource source, int elevel)
|
GucSource source, int elevel)
|
||||||
{
|
{
|
||||||
/* Quick success if no hook */
|
/* Quick success if no hook */
|
||||||
@ -9851,7 +9851,7 @@ call_int_check_hook(struct config_int * conf, int *newval, void **extra,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
call_real_check_hook(struct config_real * conf, double *newval, void **extra,
|
call_real_check_hook(struct config_real *conf, double *newval, void **extra,
|
||||||
GucSource source, int elevel)
|
GucSource source, int elevel)
|
||||||
{
|
{
|
||||||
/* Quick success if no hook */
|
/* Quick success if no hook */
|
||||||
@ -9885,7 +9885,7 @@ call_real_check_hook(struct config_real * conf, double *newval, void **extra,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
call_string_check_hook(struct config_string * conf, char **newval, void **extra,
|
call_string_check_hook(struct config_string *conf, char **newval, void **extra,
|
||||||
GucSource source, int elevel)
|
GucSource source, int elevel)
|
||||||
{
|
{
|
||||||
/* Quick success if no hook */
|
/* Quick success if no hook */
|
||||||
@ -9919,7 +9919,7 @@ call_string_check_hook(struct config_string * conf, char **newval, void **extra,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
call_enum_check_hook(struct config_enum * conf, int *newval, void **extra,
|
call_enum_check_hook(struct config_enum *conf, int *newval, void **extra,
|
||||||
GucSource source, int elevel)
|
GucSource source, int elevel)
|
||||||
{
|
{
|
||||||
/* Quick success if no hook */
|
/* Quick success if no hook */
|
||||||
|
@ -190,7 +190,7 @@ SlabContextCreate(MemoryContext parent,
|
|||||||
Size freelistSize;
|
Size freelistSize;
|
||||||
SlabContext *slab;
|
SlabContext *slab;
|
||||||
|
|
||||||
StaticAssertStmt(offsetof(SlabChunk, slab) +sizeof(MemoryContext) ==
|
StaticAssertStmt(offsetof(SlabChunk, slab) + sizeof(MemoryContext) ==
|
||||||
MAXALIGN(sizeof(SlabChunk)),
|
MAXALIGN(sizeof(SlabChunk)),
|
||||||
"padding calculation in SlabChunk is wrong");
|
"padding calculation in SlabChunk is wrong");
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ SlabContextCreate(MemoryContext parent,
|
|||||||
/* Do the type-independent part of context creation */
|
/* Do the type-independent part of context creation */
|
||||||
slab = (SlabContext *)
|
slab = (SlabContext *)
|
||||||
MemoryContextCreate(T_SlabContext,
|
MemoryContextCreate(T_SlabContext,
|
||||||
(offsetof(SlabContext, freelist) +freelistSize),
|
(offsetof(SlabContext, freelist) + freelistSize),
|
||||||
&SlabMethods,
|
&SlabMethods,
|
||||||
parent,
|
parent,
|
||||||
name);
|
name);
|
||||||
|
@ -2391,7 +2391,7 @@ inittapes(Tuplesortstate *state)
|
|||||||
* case it's not important to account for tuple space, so we don't care if
|
* case it's not important to account for tuple space, so we don't care if
|
||||||
* LACKMEM becomes inaccurate.)
|
* LACKMEM becomes inaccurate.)
|
||||||
*/
|
*/
|
||||||
tapeSpace = (int64) maxTapes *TAPE_BUFFER_OVERHEAD;
|
tapeSpace = (int64) maxTapes * TAPE_BUFFER_OVERHEAD;
|
||||||
|
|
||||||
if (tapeSpace + GetMemoryChunkSpace(state->memtuples) < state->allowedMem)
|
if (tapeSpace + GetMemoryChunkSpace(state->memtuples) < state->allowedMem)
|
||||||
USEMEM(state, tapeSpace);
|
USEMEM(state, tapeSpace);
|
||||||
|
@ -151,7 +151,7 @@ struct tztry
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void scan_available_timezones(char *tzdir, char *tzdirsub,
|
static void scan_available_timezones(char *tzdir, char *tzdirsub,
|
||||||
struct tztry * tt,
|
struct tztry *tt,
|
||||||
int *bestscore, char *bestzonename);
|
int *bestscore, char *bestzonename);
|
||||||
|
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ static void scan_available_timezones(char *tzdir, char *tzdirsub,
|
|||||||
* Get GMT offset from a system struct tm
|
* Get GMT offset from a system struct tm
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
get_timezone_offset(struct tm * tm)
|
get_timezone_offset(struct tm *tm)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_STRUCT_TM_TM_ZONE)
|
#if defined(HAVE_STRUCT_TM_TM_ZONE)
|
||||||
return tm->tm_gmtoff;
|
return tm->tm_gmtoff;
|
||||||
@ -190,7 +190,7 @@ build_time_t(int year, int month, int day)
|
|||||||
* Does a system tm value match one we computed ourselves?
|
* Does a system tm value match one we computed ourselves?
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
compare_tm(struct tm * s, struct pg_tm * p)
|
compare_tm(struct tm *s, struct pg_tm *p)
|
||||||
{
|
{
|
||||||
if (s->tm_sec != p->tm_sec ||
|
if (s->tm_sec != p->tm_sec ||
|
||||||
s->tm_min != p->tm_min ||
|
s->tm_min != p->tm_min ||
|
||||||
@ -217,7 +217,7 @@ compare_tm(struct tm * s, struct pg_tm * p)
|
|||||||
* test time.
|
* test time.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
score_timezone(const char *tzname, struct tztry * tt)
|
score_timezone(const char *tzname, struct tztry *tt)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
pg_time_t pgtt;
|
pg_time_t pgtt;
|
||||||
@ -506,7 +506,7 @@ identify_system_timezone(void)
|
|||||||
* score. bestzonename must be a buffer of length TZ_STRLEN_MAX + 1.
|
* score. bestzonename must be a buffer of length TZ_STRLEN_MAX + 1.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
scan_available_timezones(char *tzdir, char *tzdirsub, struct tztry * tt,
|
scan_available_timezones(char *tzdir, char *tzdirsub, struct tztry *tt,
|
||||||
int *bestscore, char *bestzonename)
|
int *bestscore, char *bestzonename)
|
||||||
{
|
{
|
||||||
int tzdir_orig_len = strlen(tzdir);
|
int tzdir_orig_len = strlen(tzdir);
|
||||||
|
@ -1382,7 +1382,7 @@ bootstrap_template1(void)
|
|||||||
static void
|
static void
|
||||||
setup_auth(FILE *cmdfd)
|
setup_auth(FILE *cmdfd)
|
||||||
{
|
{
|
||||||
const char *const * line;
|
const char *const *line;
|
||||||
static const char *const pg_authid_setup[] = {
|
static const char *const pg_authid_setup[] = {
|
||||||
/*
|
/*
|
||||||
* The authid table shouldn't be readable except through views, to
|
* The authid table shouldn't be readable except through views, to
|
||||||
@ -1469,7 +1469,7 @@ get_su_pwd(void)
|
|||||||
static void
|
static void
|
||||||
setup_depend(FILE *cmdfd)
|
setup_depend(FILE *cmdfd)
|
||||||
{
|
{
|
||||||
const char *const * line;
|
const char *const *line;
|
||||||
static const char *const pg_depend_setup[] = {
|
static const char *const pg_depend_setup[] = {
|
||||||
/*
|
/*
|
||||||
* Make PIN entries in pg_depend for all objects made so far in the
|
* Make PIN entries in pg_depend for all objects made so far in the
|
||||||
@ -1922,7 +1922,7 @@ vacuum_db(FILE *cmdfd)
|
|||||||
static void
|
static void
|
||||||
make_template0(FILE *cmdfd)
|
make_template0(FILE *cmdfd)
|
||||||
{
|
{
|
||||||
const char *const * line;
|
const char *const *line;
|
||||||
static const char *const template0_setup[] = {
|
static const char *const template0_setup[] = {
|
||||||
"CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;\n\n",
|
"CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;\n\n",
|
||||||
|
|
||||||
@ -1960,7 +1960,7 @@ make_template0(FILE *cmdfd)
|
|||||||
static void
|
static void
|
||||||
make_postgres(FILE *cmdfd)
|
make_postgres(FILE *cmdfd)
|
||||||
{
|
{
|
||||||
const char *const * line;
|
const char *const *line;
|
||||||
static const char *const postgres_setup[] = {
|
static const char *const postgres_setup[] = {
|
||||||
"CREATE DATABASE postgres;\n\n",
|
"CREATE DATABASE postgres;\n\n",
|
||||||
"COMMENT ON DATABASE postgres IS 'default administrative connection database';\n\n",
|
"COMMENT ON DATABASE postgres IS 'default administrative connection database';\n\n",
|
||||||
@ -2030,7 +2030,7 @@ check_ok(void)
|
|||||||
|
|
||||||
/* Hack to suppress a warning about %x from some versions of gcc */
|
/* Hack to suppress a warning about %x from some versions of gcc */
|
||||||
static inline size_t
|
static inline size_t
|
||||||
my_strftime(char *s, size_t max, const char *fmt, const struct tm * tm)
|
my_strftime(char *s, size_t max, const char *fmt, const struct tm *tm)
|
||||||
{
|
{
|
||||||
return strftime(s, max, fmt, tm);
|
return strftime(s, max, fmt, tm);
|
||||||
}
|
}
|
||||||
@ -2305,9 +2305,9 @@ check_authmethod_unspecified(const char **authmethod)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_authmethod_valid(const char *authmethod, const char *const * valid_methods, const char *conntype)
|
check_authmethod_valid(const char *authmethod, const char *const *valid_methods, const char *conntype)
|
||||||
{
|
{
|
||||||
const char *const * p;
|
const char *const *p;
|
||||||
|
|
||||||
for (p = valid_methods; *p; p++)
|
for (p = valid_methods; *p; p++)
|
||||||
{
|
{
|
||||||
|
@ -65,7 +65,7 @@ typedef struct _restoreOptions
|
|||||||
int noTablespace; /* Don't issue tablespace-related commands */
|
int noTablespace; /* Don't issue tablespace-related commands */
|
||||||
int disable_triggers; /* disable triggers during data-only
|
int disable_triggers; /* disable triggers during data-only
|
||||||
* restore */
|
* restore */
|
||||||
int use_setsessauth;/* Use SET SESSION AUTHORIZATION commands
|
int use_setsessauth; /* Use SET SESSION AUTHORIZATION commands
|
||||||
* instead of OWNER TO */
|
* instead of OWNER TO */
|
||||||
char *superuser; /* Username to use as superuser */
|
char *superuser; /* Username to use as superuser */
|
||||||
char *use_role; /* Issue SET ROLE to this */
|
char *use_role; /* Issue SET ROLE to this */
|
||||||
|
@ -4290,7 +4290,7 @@ main(int argc, char **argv)
|
|||||||
/* compute when to stop */
|
/* compute when to stop */
|
||||||
if (duration > 0)
|
if (duration > 0)
|
||||||
end_time = INSTR_TIME_GET_MICROSEC(thread->start_time) +
|
end_time = INSTR_TIME_GET_MICROSEC(thread->start_time) +
|
||||||
(int64) 1000000 *duration;
|
(int64) 1000000 * duration;
|
||||||
|
|
||||||
/* the first thread (i = 0) is executed by main thread */
|
/* the first thread (i = 0) is executed by main thread */
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
@ -4313,7 +4313,7 @@ main(int argc, char **argv)
|
|||||||
/* compute when to stop */
|
/* compute when to stop */
|
||||||
if (duration > 0)
|
if (duration > 0)
|
||||||
end_time = INSTR_TIME_GET_MICROSEC(threads[0].start_time) +
|
end_time = INSTR_TIME_GET_MICROSEC(threads[0].start_time) +
|
||||||
(int64) 1000000 *duration;
|
(int64) 1000000 * duration;
|
||||||
threads[0].thread = INVALID_THREAD;
|
threads[0].thread = INVALID_THREAD;
|
||||||
#endif /* ENABLE_THREAD_SAFETY */
|
#endif /* ENABLE_THREAD_SAFETY */
|
||||||
|
|
||||||
@ -4690,7 +4690,7 @@ threadRun(void *arg)
|
|||||||
*/
|
*/
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
next_report += (int64) progress *1000000;
|
next_report += (int64) progress * 1000000;
|
||||||
} while (now >= next_report);
|
} while (now >= next_report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user