Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0faf7d9

Browse files
Harmonize parameter names in contrib code.
Make sure that function declarations use names that exactly match the corresponding names from function definitions in contrib code. Like other recent commits that cleaned up function parameter names, this commit was written with help from clang-tidy. Author: Peter Geoghegan <pg@bowt.ie> Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com
1 parent 8fb4e00 commit 0faf7d9

File tree

21 files changed

+59
-58
lines changed

21 files changed

+59
-58
lines changed

contrib/amcheck/verify_nbtree.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static void bt_child_highkey_check(BtreeCheckState *state,
159159
Page loaded_child,
160160
uint32 target_level);
161161
static void bt_downlink_missing_check(BtreeCheckState *state, bool rightsplit,
162-
BlockNumber targetblock, Page target);
162+
BlockNumber blkno, Page page);
163163
static void bt_tuple_present_callback(Relation index, ItemPointer tid,
164164
Datum *values, bool *isnull,
165165
bool tupleIsAlive, void *checkstate);

contrib/cube/cube.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ int32 cube_cmp_v0(NDBOX *a, NDBOX *b);
9696
bool cube_contains_v0(NDBOX *a, NDBOX *b);
9797
bool cube_overlap_v0(NDBOX *a, NDBOX *b);
9898
NDBOX *cube_union_v0(NDBOX *a, NDBOX *b);
99-
void rt_cube_size(NDBOX *a, double *sz);
99+
void rt_cube_size(NDBOX *a, double *size);
100100
NDBOX *g_cube_binary_union(NDBOX *r1, NDBOX *r2, int *sizep);
101101
bool g_cube_leaf_consistent(NDBOX *key, NDBOX *query, StrategyNumber strategy);
102102
bool g_cube_internal_consistent(NDBOX *key, NDBOX *query, StrategyNumber strategy);

contrib/dblink/dblink.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ static void dblink_security_check(PGconn *conn, remoteConn *rconn);
114114
static void dblink_res_error(PGconn *conn, const char *conname, PGresult *res,
115115
bool fail, const char *fmt,...) pg_attribute_printf(5, 6);
116116
static char *get_connect_string(const char *servername);
117-
static char *escape_param_str(const char *from);
117+
static char *escape_param_str(const char *str);
118118
static void validate_pkattnums(Relation rel,
119119
int2vector *pkattnums_arg, int32 pknumatts_arg,
120120
int **pkattnums, int *pknumatts);

contrib/fuzzystrmatch/dmetaphone.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ The remaining code is authored by Andrew Dunstan <amdunstan@ncshp.org> and
117117
#include <ctype.h>
118118

119119
/* prototype for the main function we got from the perl module */
120-
static void DoubleMetaphone(char *, char **);
120+
static void DoubleMetaphone(char *str, char **codes);
121121

122122
#ifndef DMETAPHONE_MAIN
123123

contrib/intarray/_int.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ ArrayType *new_intArrayType(int num);
114114
ArrayType *copy_intArrayType(ArrayType *a);
115115
ArrayType *resize_intArrayType(ArrayType *a, int num);
116116
int internal_size(int *a, int len);
117-
ArrayType *_int_unique(ArrayType *a);
117+
ArrayType *_int_unique(ArrayType *r);
118118
int32 intarray_match_first(ArrayType *a, int32 elem);
119119
ArrayType *intarray_add_elem(ArrayType *a, int32 elem);
120120
ArrayType *intarray_concat_arrays(ArrayType *a, ArrayType *b);

contrib/intarray/_int_selfuncs.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ PG_FUNCTION_INFO_V1(_int_contained_joinsel);
3434
PG_FUNCTION_INFO_V1(_int_matchsel);
3535

3636

37-
static Selectivity int_query_opr_selec(ITEM *item, Datum *values, float4 *freqs,
38-
int nmncelems, float4 minfreq);
37+
static Selectivity int_query_opr_selec(ITEM *item, Datum *mcelems, float4 *mcefreqs,
38+
int nmcelems, float4 minfreq);
3939
static int compare_val_int4(const void *a, const void *b);
4040

4141
/*

contrib/intarray/_int_tool.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -382,14 +382,14 @@ intarray_concat_arrays(ArrayType *a, ArrayType *b)
382382
}
383383

384384
ArrayType *
385-
int_to_intset(int32 n)
385+
int_to_intset(int32 elem)
386386
{
387387
ArrayType *result;
388388
int32 *aa;
389389

390390
result = new_intArrayType(1);
391391
aa = ARRPTR(result);
392-
aa[0] = n;
392+
aa[0] = elem;
393393
return result;
394394
}
395395

contrib/ltree/ltree.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ bool ltree_execute(ITEM *curitem, void *checkval,
206206

207207
int ltree_compare(const ltree *a, const ltree *b);
208208
bool inner_isparent(const ltree *c, const ltree *p);
209-
bool compare_subnode(ltree_level *t, char *q, int len,
209+
bool compare_subnode(ltree_level *t, char *qn, int len,
210210
int (*cmpptr) (const char *, const char *, size_t), bool anyend);
211211
ltree *lca_inner(ltree **a, int len);
212212
int ltree_strncasecmp(const char *a, const char *b, size_t s);

contrib/oid2name/oid2name.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ struct options
4848

4949
/* function prototypes */
5050
static void help(const char *progname);
51-
void get_opts(int, char **, struct options *);
51+
void get_opts(int argc, char **argv, struct options *my_opts);
5252
void add_one_elt(char *eltname, eary *eary);
5353
char *get_comma_elts(eary *eary);
54-
PGconn *sql_conn(struct options *);
55-
int sql_exec(PGconn *, const char *sql, bool quiet);
56-
void sql_exec_dumpalldbs(PGconn *, struct options *);
57-
void sql_exec_dumpalltables(PGconn *, struct options *);
58-
void sql_exec_searchtables(PGconn *, struct options *);
59-
void sql_exec_dumpalltbspc(PGconn *, struct options *);
54+
PGconn *sql_conn(struct options *my_opts);
55+
int sql_exec(PGconn *conn, const char *todo, bool quiet);
56+
void sql_exec_dumpalldbs(PGconn *conn, struct options *opts);
57+
void sql_exec_dumpalltables(PGconn *conn, struct options *opts);
58+
void sql_exec_searchtables(PGconn *conn, struct options *opts);
59+
void sql_exec_dumpalltbspc(PGconn *conn, struct options *opts);
6060

6161
/* function to parse command line options and check for some usage errors. */
6262
void

contrib/pgcrypto/mbuf.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -82,33 +82,33 @@ int mbuf_avail(MBuf *mbuf);
8282
int mbuf_size(MBuf *mbuf);
8383
int mbuf_grab(MBuf *mbuf, int len, uint8 **data_p);
8484
int mbuf_steal_data(MBuf *mbuf, uint8 **data_p);
85-
int mbuf_append(MBuf *dst, const uint8 *buf, int cnt);
85+
int mbuf_append(MBuf *dst, const uint8 *buf, int len);
8686
int mbuf_free(MBuf *mbuf);
8787

8888
/*
8989
* Push filter
9090
*/
91-
int pushf_create(PushFilter **res, const PushFilterOps *ops, void *init_arg,
92-
PushFilter *next);
91+
int pushf_create(PushFilter **mp_p, const PushFilterOps *op,
92+
void *init_arg, PushFilter *next);
9393
int pushf_write(PushFilter *mp, const uint8 *data, int len);
9494
void pushf_free_all(PushFilter *mp);
9595
void pushf_free(PushFilter *mp);
9696
int pushf_flush(PushFilter *mp);
9797

98-
int pushf_create_mbuf_writer(PushFilter **mp_p, MBuf *mbuf);
98+
int pushf_create_mbuf_writer(PushFilter **res, MBuf *dst);
9999

100100
/*
101101
* Pull filter
102102
*/
103-
int pullf_create(PullFilter **res, const PullFilterOps *ops,
103+
int pullf_create(PullFilter **pf_p, const PullFilterOps *op,
104104
void *init_arg, PullFilter *src);
105-
int pullf_read(PullFilter *mp, int len, uint8 **data_p);
106-
int pullf_read_max(PullFilter *mp, int len,
105+
int pullf_read(PullFilter *pf, int len, uint8 **data_p);
106+
int pullf_read_max(PullFilter *pf, int len,
107107
uint8 **data_p, uint8 *tmpbuf);
108-
void pullf_free(PullFilter *mp);
108+
void pullf_free(PullFilter *pf);
109109
int pullf_read_fixed(PullFilter *src, int len, uint8 *dst);
110110

111-
int pullf_create_mbuf_reader(PullFilter **pf_p, MBuf *mbuf);
111+
int pullf_create_mbuf_reader(PullFilter **mp_p, MBuf *src);
112112

113113
#define GETBYTE(pf, dst) \
114114
do { \

contrib/pgcrypto/pgcrypto.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ PG_MODULE_MAGIC;
4545
/* private stuff */
4646

4747
typedef int (*PFN) (const char *name, void **res);
48-
static void *find_provider(text *name, PFN pf, const char *desc, int silent);
48+
static void *find_provider(text *name, PFN provider_lookup, const char *desc,
49+
int silent);
4950

5051
/* SQL function: hash(bytea, text) returns bytea */
5152
PG_FUNCTION_INFO_V1(pg_digest);

contrib/pgcrypto/pgp.h

+16-16
Original file line numberDiff line numberDiff line change
@@ -236,17 +236,17 @@ struct PGP_PubKey
236236
int can_encrypt;
237237
};
238238

239-
int pgp_init(PGP_Context **ctx);
239+
int pgp_init(PGP_Context **ctx_p);
240240
int pgp_encrypt(PGP_Context *ctx, MBuf *src, MBuf *dst);
241-
int pgp_decrypt(PGP_Context *ctx, MBuf *src, MBuf *dst);
241+
int pgp_decrypt(PGP_Context *ctx, MBuf *msrc, MBuf *mdst);
242242
int pgp_free(PGP_Context *ctx);
243243

244244
int pgp_get_digest_code(const char *name);
245245
int pgp_get_cipher_code(const char *name);
246246
const char *pgp_get_digest_name(int code);
247247

248248
int pgp_set_cipher_algo(PGP_Context *ctx, const char *name);
249-
int pgp_set_s2k_mode(PGP_Context *ctx, int type);
249+
int pgp_set_s2k_mode(PGP_Context *ctx, int mode);
250250
int pgp_set_s2k_count(PGP_Context *ctx, int count);
251251
int pgp_set_s2k_cipher_algo(PGP_Context *ctx, const char *name);
252252
int pgp_set_s2k_digest_algo(PGP_Context *ctx, const char *name);
@@ -259,22 +259,22 @@ int pgp_set_text_mode(PGP_Context *ctx, int mode);
259259
int pgp_set_unicode_mode(PGP_Context *ctx, int mode);
260260
int pgp_get_unicode_mode(PGP_Context *ctx);
261261

262-
int pgp_set_symkey(PGP_Context *ctx, const uint8 *key, int klen);
262+
int pgp_set_symkey(PGP_Context *ctx, const uint8 *key, int len);
263263
int pgp_set_pubkey(PGP_Context *ctx, MBuf *keypkt,
264-
const uint8 *key, int klen, int pubtype);
264+
const uint8 *key, int key_len, int pubtype);
265265

266266
int pgp_get_keyid(MBuf *pgp_data, char *dst);
267267

268268
/* internal functions */
269269

270-
int pgp_load_digest(int c, PX_MD **res);
271-
int pgp_load_cipher(int c, PX_Cipher **res);
272-
int pgp_get_cipher_key_size(int c);
273-
int pgp_get_cipher_block_size(int c);
270+
int pgp_load_digest(int code, PX_MD **res);
271+
int pgp_load_cipher(int code, PX_Cipher **res);
272+
int pgp_get_cipher_key_size(int code);
273+
int pgp_get_cipher_block_size(int code);
274274

275275
int pgp_s2k_fill(PGP_S2K *s2k, int mode, int digest_algo, int count);
276276
int pgp_s2k_read(PullFilter *src, PGP_S2K *s2k);
277-
int pgp_s2k_process(PGP_S2K *s2k, int cipher, const uint8 *key, int klen);
277+
int pgp_s2k_process(PGP_S2K *s2k, int cipher, const uint8 *key, int key_len);
278278

279279
typedef struct PGP_CFB PGP_CFB;
280280
int pgp_cfb_create(PGP_CFB **ctx_p, int algo,
@@ -316,11 +316,11 @@ int pgp_mpi_write(PushFilter *dst, PGP_MPI *n);
316316
int pgp_mpi_hash(PX_MD *md, PGP_MPI *n);
317317
unsigned pgp_mpi_cksum(unsigned cksum, PGP_MPI *n);
318318

319-
int pgp_elgamal_encrypt(PGP_PubKey *pk, PGP_MPI *m,
320-
PGP_MPI **c1, PGP_MPI **c2);
321-
int pgp_elgamal_decrypt(PGP_PubKey *pk, PGP_MPI *c1, PGP_MPI *c2,
322-
PGP_MPI **m);
323-
int pgp_rsa_encrypt(PGP_PubKey *pk, PGP_MPI *m, PGP_MPI **c);
324-
int pgp_rsa_decrypt(PGP_PubKey *pk, PGP_MPI *c, PGP_MPI **m);
319+
int pgp_elgamal_encrypt(PGP_PubKey *pk, PGP_MPI *_m,
320+
PGP_MPI **c1_p, PGP_MPI **c2_p);
321+
int pgp_elgamal_decrypt(PGP_PubKey *pk, PGP_MPI *_c1, PGP_MPI *_c2,
322+
PGP_MPI **msg_p);
323+
int pgp_rsa_encrypt(PGP_PubKey *pk, PGP_MPI *_m, PGP_MPI **c_p);
324+
int pgp_rsa_decrypt(PGP_PubKey *pk, PGP_MPI *_c, PGP_MPI **m_p);
325325

326326
extern struct PullFilterOps pgp_decrypt_filter;

contrib/pgcrypto/px-crypt.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
/*
4949
* main interface
5050
*/
51-
char *px_crypt(const char *psw, const char *salt, char *buf, unsigned buflen);
52-
int px_gen_salt(const char *salt_type, char *dst, int rounds);
51+
char *px_crypt(const char *psw, const char *salt, char *buf, unsigned len);
52+
int px_gen_salt(const char *salt_type, char *buf, int rounds);
5353

5454
/*
5555
* internal functions
@@ -77,6 +77,6 @@ char *px_crypt_des(const char *key, const char *setting);
7777

7878
/* crypt-md5.c */
7979
char *px_crypt_md5(const char *pw, const char *salt,
80-
char *dst, unsigned dstlen);
80+
char *passwd, unsigned dstlen);
8181

8282
#endif /* _PX_CRYPT_H */

contrib/pgcrypto/px.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ int px_find_combo(const char *name, PX_Combo **res);
176176
void px_THROW_ERROR(int err) pg_attribute_noreturn();
177177
const char *px_strerror(int err);
178178

179-
const char *px_resolve_alias(const PX_Alias *aliases, const char *name);
179+
const char *px_resolve_alias(const PX_Alias *list, const char *name);
180180

181181
void px_set_debug_handler(void (*handler) (const char *));
182182

contrib/postgres_fdw/deparse.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ static void deparseReturningList(StringInfo buf, RangeTblEntry *rte,
149149
static void deparseColumnRef(StringInfo buf, int varno, int varattno,
150150
RangeTblEntry *rte, bool qualify_col);
151151
static void deparseRelation(StringInfo buf, Relation rel);
152-
static void deparseExpr(Expr *expr, deparse_expr_cxt *context);
152+
static void deparseExpr(Expr *node, deparse_expr_cxt *context);
153153
static void deparseVar(Var *node, deparse_expr_cxt *context);
154154
static void deparseConst(Const *node, deparse_expr_cxt *context, int showtype);
155155
static void deparseParam(Param *node, deparse_expr_cxt *context);

contrib/postgres_fdw/postgres_fdw.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ static PgFdwModifyState *create_foreign_modify(EState *estate,
457457
Plan *subplan,
458458
char *query,
459459
List *target_attrs,
460-
int len,
460+
int values_end,
461461
bool has_returning,
462462
List *retrieved_attrs);
463463
static TupleTableSlot **execute_foreign_modify(EState *estate,

contrib/postgres_fdw/postgres_fdw.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ extern EquivalenceMember *find_em_for_rel_target(PlannerInfo *root,
226226
RelOptInfo *rel);
227227
extern List *build_tlist_to_deparse(RelOptInfo *foreignrel);
228228
extern void deparseSelectStmtForRel(StringInfo buf, PlannerInfo *root,
229-
RelOptInfo *foreignrel, List *tlist,
229+
RelOptInfo *rel, List *tlist,
230230
List *remote_conds, List *pathkeys,
231231
bool has_final_sort, bool has_limit,
232232
bool is_subquery,

contrib/seg/seg.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ PG_FUNCTION_INFO_V1(seg_different);
9292
/*
9393
** Auxiliary functions
9494
*/
95-
static int restore(char *s, float val, int n);
95+
static int restore(char *result, float val, int n);
9696

9797

9898
/*****************************************************************************

contrib/seg/segdata.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ typedef struct SEG
1212
} SEG;
1313

1414
/* in seg.c */
15-
extern int significant_digits(const char *str);
15+
extern int significant_digits(const char *s);
1616

1717
/* in segscan.l */
1818
extern int seg_yylex(void);

contrib/tablefunc/tablefunc.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ static Tuplestorestate *get_crosstab_tuplestore(char *sql,
5151
HTAB *crosstab_hash,
5252
TupleDesc tupdesc,
5353
bool randomAccess);
54-
static void validateConnectbyTupleDesc(TupleDesc tupdesc, bool show_branch, bool show_serial);
55-
static bool compatCrosstabTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2);
56-
static void compatConnectbyTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2);
54+
static void validateConnectbyTupleDesc(TupleDesc td, bool show_branch, bool show_serial);
55+
static bool compatCrosstabTupleDescs(TupleDesc ret_tupdesc, TupleDesc sql_tupdesc);
56+
static void compatConnectbyTupleDescs(TupleDesc ret_tupdesc, TupleDesc sql_tupdesc);
5757
static void get_normal_pair(float8 *x1, float8 *x2);
5858
static Tuplestorestate *connectby(char *relname,
5959
char *key_fld,

contrib/test_decoding/test_decoding.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static void pg_output_begin(LogicalDecodingContext *ctx,
6060
static void pg_decode_commit_txn(LogicalDecodingContext *ctx,
6161
ReorderBufferTXN *txn, XLogRecPtr commit_lsn);
6262
static void pg_decode_change(LogicalDecodingContext *ctx,
63-
ReorderBufferTXN *txn, Relation rel,
63+
ReorderBufferTXN *txn, Relation relation,
6464
ReorderBufferChange *change);
6565
static void pg_decode_truncate(LogicalDecodingContext *ctx,
6666
ReorderBufferTXN *txn,
@@ -69,7 +69,7 @@ static void pg_decode_truncate(LogicalDecodingContext *ctx,
6969
static bool pg_decode_filter(LogicalDecodingContext *ctx,
7070
RepOriginId origin_id);
7171
static void pg_decode_message(LogicalDecodingContext *ctx,
72-
ReorderBufferTXN *txn, XLogRecPtr message_lsn,
72+
ReorderBufferTXN *txn, XLogRecPtr lsn,
7373
bool transactional, const char *prefix,
7474
Size sz, const char *message);
7575
static bool pg_decode_filter_prepare(LogicalDecodingContext *ctx,
@@ -109,7 +109,7 @@ static void pg_decode_stream_change(LogicalDecodingContext *ctx,
109109
Relation relation,
110110
ReorderBufferChange *change);
111111
static void pg_decode_stream_message(LogicalDecodingContext *ctx,
112-
ReorderBufferTXN *txn, XLogRecPtr message_lsn,
112+
ReorderBufferTXN *txn, XLogRecPtr lsn,
113113
bool transactional, const char *prefix,
114114
Size sz, const char *message);
115115
static void pg_decode_stream_truncate(LogicalDecodingContext *ctx,

0 commit comments

Comments
 (0)