1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +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:
Tom Lane
2017-06-21 14:39:04 -04:00
parent 8ff6d4ec78
commit e3860ffa4d
379 changed files with 1725 additions and 1707 deletions

View File

@ -908,7 +908,7 @@ mp_int_sqr(mp_int a, mp_int c)
CHECK(a != NULL && c != NULL);
/* 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)
{
@ -1613,8 +1613,8 @@ mp_int_gcd(mp_int a, mp_int b, mp_int c)
CLEANUP:
mp_int_clear(&v);
V: mp_int_clear(&u);
U: mp_int_clear(&t);
V: mp_int_clear(&u);
U: mp_int_clear(&t);
return res;
}
@ -3512,7 +3512,7 @@ s_outlen(mp_int z, mp_size r)
double raw;
bits = mp_int_count_bits(z);
raw = (double) bits *s_log2[r];
raw = (double) bits * s_log2[r];
return (int) (raw + 0.999999);
}

View File

@ -61,6 +61,7 @@ typedef struct mpz
mp_size used;
mp_sign sign;
} mpz_t ,
*mp_int;
#define MP_DIGITS(Z) ((Z)->digits)
@ -117,9 +118,9 @@ mp_result mp_int_mul_value(mp_int a, int value, mp_int c);
mp_result mp_int_mul_pow2(mp_int a, int p2, mp_int c);
mp_result mp_int_sqr(mp_int a, mp_int c); /* c = a * a */
mp_result mp_int_div(mp_int a, mp_int b, /* q = a / b */
mp_result mp_int_div(mp_int a, mp_int b, /* q = a / b */
mp_int q, mp_int r); /* r = a % b */
mp_result mp_int_div_value(mp_int a, int value, /* q = a / value */
mp_result mp_int_div_value(mp_int a, int value, /* q = a / value */
mp_int q, int *r); /* r = a % value */
mp_result mp_int_div_pow2(mp_int a, int p2, /* q = a / 2^p2 */
mp_int q, mp_int r); /* r = q % 2^p2 */

View File

@ -318,7 +318,7 @@ rj_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv)
}
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);
return 0;

View File

@ -51,7 +51,7 @@ struct PushFilterOps
* copied (in-place) returns 0 on error
*/
int (*push) (PushFilter *next, void *priv,
const uint8 *src, int len);
const uint8 *src, int len);
int (*flush) (PushFilter *next, void *priv);
void (*free) (void *priv);
};
@ -69,7 +69,7 @@ struct PullFilterOps
* use buf as work area if NULL in-place copy
*/
int (*pull) (void *priv, PullFilter *src, int len,
uint8 **data_p, uint8 *buf, int buflen);
uint8 **data_p, uint8 *buf, int buflen);
void (*free) (void *priv);
};

View File

@ -460,7 +460,7 @@ mdcbuf_init(void **priv_p, void *arg, PullFilter *src)
}
static int
mdcbuf_finish(struct MDCBufData * st)
mdcbuf_finish(struct MDCBufData *st)
{
uint8 hash[20];
int res;
@ -485,7 +485,7 @@ mdcbuf_finish(struct MDCBufData * st)
}
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;
@ -495,14 +495,14 @@ mdcbuf_load_data(struct MDCBufData * st, uint8 *src, int len)
}
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);
st->mdc_avail += len;
}
static int
mdcbuf_refill(struct MDCBufData * st, PullFilter *src)
mdcbuf_refill(struct MDCBufData *st, PullFilter *src)
{
uint8 *data;
int res;

View File

@ -132,7 +132,7 @@ struct debug_expect
};
static void
fill_expect(struct debug_expect * ex, int text_mode)
fill_expect(struct debug_expect *ex, int text_mode)
{
ex->debug = 0;
ex->expect = 0;
@ -157,7 +157,7 @@ fill_expect(struct debug_expect * ex, int text_mode)
} while (0)
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(s2k_mode);
@ -179,7 +179,7 @@ show_debug(const char *msg)
static int
set_arg(PGP_Context *ctx, char *key, char *val,
struct debug_expect * ex)
struct debug_expect *ex)
{
int res = 0;
@ -317,7 +317,7 @@ downcase_convert(const uint8 *s, int len)
static int
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 *key,
@ -362,7 +362,7 @@ create_mbuf_from_vardata(text *data)
static void
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);

View File

@ -74,7 +74,7 @@ struct px_crypt_algo
char *id;
unsigned id_len;
char *(*crypt) (const char *psw, const char *salt,
char *buf, unsigned len);
char *buf, unsigned len);
};
static const struct px_crypt_algo
@ -115,7 +115,7 @@ struct generator
{
char *name;
char *(*gen) (unsigned long count, const char *input, int size,
char *output, int output_size);
char *output, int output_size);
int input_len;
int def_rounds;
int min_rounds;

View File

@ -169,11 +169,11 @@ struct px_cipher
struct px_combo
{
int (*init) (PX_Combo *cx, const uint8 *key, unsigned klen,
const uint8 *iv, unsigned ivlen);
const uint8 *iv, unsigned ivlen);
int (*encrypt) (PX_Combo *cx, const uint8 *data, unsigned dlen,
uint8 *res, unsigned *rlen);
uint8 *res, unsigned *rlen);
int (*decrypt) (PX_Combo *cx, const uint8 *data, unsigned dlen,
uint8 *res, unsigned *rlen);
uint8 *res, unsigned *rlen);
unsigned (*encrypt_len) (PX_Combo *cx, unsigned dlen);
unsigned (*decrypt_len) (PX_Combo *cx, unsigned dlen);
void (*free) (PX_Combo *cx);

View File

@ -44,8 +44,7 @@ typedef struct _rijndael_ctx
/* These are all based on 32 bit unsigned values and will therefore */
/* require endian conversions for big-endian architectures */
rijndael_ctx *
rijndael_set_key(rijndael_ctx *, const u4byte *, const u4byte, int);
rijndael_ctx *rijndael_set_key(rijndael_ctx *, const u4byte *, const u4byte, int);
void rijndael_encrypt(rijndael_ctx *, const u4byte *, u4byte *);
void rijndael_decrypt(rijndael_ctx *, const u4byte *, u4byte *);

View File

@ -81,7 +81,7 @@ do { \
static void sha1_step(struct sha1_ctxt *);
static void
sha1_step(struct sha1_ctxt * ctxt)
sha1_step(struct sha1_ctxt *ctxt)
{
uint32 a,
b,
@ -226,7 +226,7 @@ sha1_step(struct sha1_ctxt * ctxt)
/*------------------------------------------------------------*/
void
sha1_init(struct sha1_ctxt * ctxt)
sha1_init(struct sha1_ctxt *ctxt)
{
memset(ctxt, 0, sizeof(struct sha1_ctxt));
H(0) = 0x67452301;
@ -237,7 +237,7 @@ sha1_init(struct sha1_ctxt * ctxt)
}
void
sha1_pad(struct sha1_ctxt * ctxt)
sha1_pad(struct sha1_ctxt *ctxt)
{
size_t padlen; /* pad length in bytes */
size_t padstart;
@ -280,7 +280,7 @@ sha1_pad(struct sha1_ctxt * ctxt)
}
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;
size_t gaplen;
@ -308,7 +308,7 @@ sha1_loop(struct sha1_ctxt * ctxt, const uint8 *input0, size_t len)
}
void
sha1_result(struct sha1_ctxt * ctxt, uint8 *digest0)
sha1_result(struct sha1_ctxt *ctxt, uint8 *digest0)
{
uint8 *digest;