Harmonize parameter names in contrib code.
authorPeter Geoghegan
Thu, 22 Sep 2022 20:59:20 +0000 (13:59 -0700)
committerPeter Geoghegan
Thu, 22 Sep 2022 20:59:20 +0000 (13:59 -0700)
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 
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com

21 files changed:
contrib/amcheck/verify_nbtree.c
contrib/cube/cube.c
contrib/dblink/dblink.c
contrib/fuzzystrmatch/dmetaphone.c
contrib/intarray/_int.h
contrib/intarray/_int_selfuncs.c
contrib/intarray/_int_tool.c
contrib/ltree/ltree.h
contrib/oid2name/oid2name.c
contrib/pgcrypto/mbuf.h
contrib/pgcrypto/pgcrypto.c
contrib/pgcrypto/pgp.h
contrib/pgcrypto/px-crypt.h
contrib/pgcrypto/px.h
contrib/postgres_fdw/deparse.c
contrib/postgres_fdw/postgres_fdw.c
contrib/postgres_fdw/postgres_fdw.h
contrib/seg/seg.c
contrib/seg/segdata.h
contrib/tablefunc/tablefunc.c
contrib/test_decoding/test_decoding.c

index 798adc5bc55c6b23be1b017ed4df40a276fea7f0..9021d156eb71620b2aac2faa3b9585bead7a88f7 100644 (file)
@@ -159,7 +159,7 @@ static void bt_child_highkey_check(BtreeCheckState *state,
                                   Page loaded_child,
                                   uint32 target_level);
 static void bt_downlink_missing_check(BtreeCheckState *state, bool rightsplit,
-                                     BlockNumber targetblock, Page target);
+                                     BlockNumber blkno, Page page);
 static void bt_tuple_present_callback(Relation index, ItemPointer tid,
                                      Datum *values, bool *isnull,
                                      bool tupleIsAlive, void *checkstate);
index 6e01800a4a87aa08ea912b5dde339c9bea95c025..01c6a9c5563ebc806fe788f862407307f5ce6210 100644 (file)
@@ -96,7 +96,7 @@ int32     cube_cmp_v0(NDBOX *a, NDBOX *b);
 bool       cube_contains_v0(NDBOX *a, NDBOX *b);
 bool       cube_overlap_v0(NDBOX *a, NDBOX *b);
 NDBOX     *cube_union_v0(NDBOX *a, NDBOX *b);
-void       rt_cube_size(NDBOX *a, double *sz);
+void       rt_cube_size(NDBOX *a, double *size);
 NDBOX     *g_cube_binary_union(NDBOX *r1, NDBOX *r2, int *sizep);
 bool       g_cube_leaf_consistent(NDBOX *key, NDBOX *query, StrategyNumber strategy);
 bool       g_cube_internal_consistent(NDBOX *key, NDBOX *query, StrategyNumber strategy);
index 41cf45e87833c44b6d41af1215d891a037a05c3d..9eef417c47b74f7f0e588ae77158471884ca3965 100644 (file)
@@ -114,7 +114,7 @@ static void dblink_security_check(PGconn *conn, remoteConn *rconn);
 static void dblink_res_error(PGconn *conn, const char *conname, PGresult *res,
                             bool fail, const char *fmt,...) pg_attribute_printf(5, 6);
 static char *get_connect_string(const char *servername);
-static char *escape_param_str(const char *from);
+static char *escape_param_str(const char *str);
 static void validate_pkattnums(Relation rel,
                               int2vector *pkattnums_arg, int32 pknumatts_arg,
                               int **pkattnums, int *pknumatts);
index 6f4d2b730e92cbd4ad478efc6de7cfc3026b6348..f8f2c2b447d2b1ab1e2c0a32083e96166234e7c3 100644 (file)
@@ -117,7 +117,7 @@ The remaining code is authored by Andrew Dunstan  and
 #include 
 
 /* prototype for the main function we got from the perl module */
-static void DoubleMetaphone(char *, char **);
+static void DoubleMetaphone(char *str, char **codes);
 
 #ifndef DMETAPHONE_MAIN
 
index 304c29525c9633775bc76beee1b5d18e25065f16..a52ec38ba4e13d23cbdfac502a34bb2a3515ca5d 100644 (file)
@@ -114,7 +114,7 @@ ArrayType  *new_intArrayType(int num);
 ArrayType  *copy_intArrayType(ArrayType *a);
 ArrayType  *resize_intArrayType(ArrayType *a, int num);
 int            internal_size(int *a, int len);
-ArrayType  *_int_unique(ArrayType *a);
+ArrayType  *_int_unique(ArrayType *r);
 int32      intarray_match_first(ArrayType *a, int32 elem);
 ArrayType  *intarray_add_elem(ArrayType *a, int32 elem);
 ArrayType  *intarray_concat_arrays(ArrayType *a, ArrayType *b);
index 3d8ff6781bc34a893c21d6903d4daaf116196436..6d5f6cc70e85bb0a80495536c80cd6862ed01e0a 100644 (file)
@@ -34,8 +34,8 @@ PG_FUNCTION_INFO_V1(_int_contained_joinsel);
 PG_FUNCTION_INFO_V1(_int_matchsel);
 
 
-static Selectivity int_query_opr_selec(ITEM *item, Datum *values, float4 *freqs,
-                                      int nmncelems, float4 minfreq);
+static Selectivity int_query_opr_selec(ITEM *item, Datum *mcelems, float4 *mcefreqs,
+                                      int nmcelems, float4 minfreq);
 static int compare_val_int4(const void *a, const void *b);
 
 /*
index 8ed4d63fc3c13b28a107091b0d6685b44e323f98..5ab6eb81e8df2c71fcd8eec2a29fe53b8fd369b4 100644 (file)
@@ -382,14 +382,14 @@ intarray_concat_arrays(ArrayType *a, ArrayType *b)
 }
 
 ArrayType *
-int_to_intset(int32 n)
+int_to_intset(int32 elem)
 {
    ArrayType  *result;
    int32      *aa;
 
    result = new_intArrayType(1);
    aa = ARRPTR(result);
-   aa[0] = n;
+   aa[0] = elem;
    return result;
 }
 
index 3dd99ca68487b6e846de71c106a5dc403c418613..40aed0ca0c8a23bf32a00090d55e18699dafabb9 100644 (file)
@@ -206,7 +206,7 @@ bool        ltree_execute(ITEM *curitem, void *checkval,
 
 int            ltree_compare(const ltree *a, const ltree *b);
 bool       inner_isparent(const ltree *c, const ltree *p);
-bool       compare_subnode(ltree_level *t, char *q, int len,
+bool       compare_subnode(ltree_level *t, char *qn, int len,
                            int (*cmpptr) (const char *, const char *, size_t), bool anyend);
 ltree     *lca_inner(ltree **a, int len);
 int            ltree_strncasecmp(const char *a, const char *b, size_t s);
index 32d544483108207e7dfa703f1a07dd4c966cfada..4edf02d9c706b3fe14e21456f3ad1a10b5f0c73a 100644 (file)
@@ -48,15 +48,15 @@ struct options
 
 /* function prototypes */
 static void help(const char *progname);
-void       get_opts(int, char **, struct options *);
+void       get_opts(int argc, char **argv, struct options *my_opts);
 void       add_one_elt(char *eltname, eary *eary);
 char      *get_comma_elts(eary *eary);
-PGconn    *sql_conn(struct options *);
-int            sql_exec(PGconn *, const char *sql, bool quiet);
-void       sql_exec_dumpalldbs(PGconn *, struct options *);
-void       sql_exec_dumpalltables(PGconn *, struct options *);
-void       sql_exec_searchtables(PGconn *, struct options *);
-void       sql_exec_dumpalltbspc(PGconn *, struct options *);
+PGconn    *sql_conn(struct options *my_opts);
+int            sql_exec(PGconn *conn, const char *todo, bool quiet);
+void       sql_exec_dumpalldbs(PGconn *conn, struct options *opts);
+void       sql_exec_dumpalltables(PGconn *conn, struct options *opts);
+void       sql_exec_searchtables(PGconn *conn, struct options *opts);
+void       sql_exec_dumpalltbspc(PGconn *conn, struct options *opts);
 
 /* function to parse command line options and check for some usage errors. */
 void
index adb18430b718a1ed9de8cddca657faaaa6c455ca..97873c931f913397a6da8e03936917a1e9255720 100644 (file)
@@ -82,33 +82,33 @@ int         mbuf_avail(MBuf *mbuf);
 int            mbuf_size(MBuf *mbuf);
 int            mbuf_grab(MBuf *mbuf, int len, uint8 **data_p);
 int            mbuf_steal_data(MBuf *mbuf, uint8 **data_p);
-int            mbuf_append(MBuf *dst, const uint8 *buf, int cnt);
+int            mbuf_append(MBuf *dst, const uint8 *buf, int len);
 int            mbuf_free(MBuf *mbuf);
 
 /*
  * Push filter
  */
-int            pushf_create(PushFilter **res, const PushFilterOps *ops, void *init_arg,
-                        PushFilter *next);
+int            pushf_create(PushFilter **mp_p, const PushFilterOps *op,
+                        void *init_arg, PushFilter *next);
 int            pushf_write(PushFilter *mp, const uint8 *data, int len);
 void       pushf_free_all(PushFilter *mp);
 void       pushf_free(PushFilter *mp);
 int            pushf_flush(PushFilter *mp);
 
-int            pushf_create_mbuf_writer(PushFilter **mp_p, MBuf *mbuf);
+int            pushf_create_mbuf_writer(PushFilter **res, MBuf *dst);
 
 /*
  * Pull filter
  */
-int            pullf_create(PullFilter **res, const PullFilterOps *ops,
+int            pullf_create(PullFilter **pf_p, const PullFilterOps *op,
                         void *init_arg, PullFilter *src);
-int            pullf_read(PullFilter *mp, int len, uint8 **data_p);
-int            pullf_read_max(PullFilter *mp, int len,
+int            pullf_read(PullFilter *pf, int len, uint8 **data_p);
+int            pullf_read_max(PullFilter *pf, int len,
                           uint8 **data_p, uint8 *tmpbuf);
-void       pullf_free(PullFilter *mp);
+void       pullf_free(PullFilter *pf);
 int            pullf_read_fixed(PullFilter *src, int len, uint8 *dst);
 
-int            pullf_create_mbuf_reader(PullFilter **pf_p, MBuf *mbuf);
+int            pullf_create_mbuf_reader(PullFilter **mp_p, MBuf *src);
 
 #define GETBYTE(pf, dst) \
    do { \
index f0ac625040e753c5ce4908d71f40f64714c69698..8f882f4c68454acc45675446a7ad61d920c75c8c 100644 (file)
@@ -45,7 +45,8 @@ PG_MODULE_MAGIC;
 /* private stuff */
 
 typedef int (*PFN) (const char *name, void **res);
-static void *find_provider(text *name, PFN pf, const char *desc, int silent);
+static void *find_provider(text *name, PFN provider_lookup, const char *desc,
+                          int silent);
 
 /* SQL function: hash(bytea, text) returns bytea */
 PG_FUNCTION_INFO_V1(pg_digest);
index 805f01af5b2f24721f4da638ad14d37a81257bf3..cb8b32aba09dc9425dd92aa893792ec9697fa292 100644 (file)
@@ -236,9 +236,9 @@ struct PGP_PubKey
    int         can_encrypt;
 };
 
-int            pgp_init(PGP_Context **ctx);
+int            pgp_init(PGP_Context **ctx_p);
 int            pgp_encrypt(PGP_Context *ctx, MBuf *src, MBuf *dst);
-int            pgp_decrypt(PGP_Context *ctx, MBuf *src, MBuf *dst);
+int            pgp_decrypt(PGP_Context *ctx, MBuf *msrc, MBuf *mdst);
 int            pgp_free(PGP_Context *ctx);
 
 int            pgp_get_digest_code(const char *name);
@@ -246,7 +246,7 @@ int         pgp_get_cipher_code(const char *name);
 const char *pgp_get_digest_name(int code);
 
 int            pgp_set_cipher_algo(PGP_Context *ctx, const char *name);
-int            pgp_set_s2k_mode(PGP_Context *ctx, int type);
+int            pgp_set_s2k_mode(PGP_Context *ctx, int mode);
 int            pgp_set_s2k_count(PGP_Context *ctx, int count);
 int            pgp_set_s2k_cipher_algo(PGP_Context *ctx, const char *name);
 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);
 int            pgp_set_unicode_mode(PGP_Context *ctx, int mode);
 int            pgp_get_unicode_mode(PGP_Context *ctx);
 
-int            pgp_set_symkey(PGP_Context *ctx, const uint8 *key, int klen);
+int            pgp_set_symkey(PGP_Context *ctx, const uint8 *key, int len);
 int            pgp_set_pubkey(PGP_Context *ctx, MBuf *keypkt,
-                          const uint8 *key, int klen, int pubtype);
+                          const uint8 *key, int key_len, int pubtype);
 
 int            pgp_get_keyid(MBuf *pgp_data, char *dst);
 
 /* internal functions */
 
-int            pgp_load_digest(int c, PX_MD **res);
-int            pgp_load_cipher(int c, PX_Cipher **res);
-int            pgp_get_cipher_key_size(int c);
-int            pgp_get_cipher_block_size(int c);
+int            pgp_load_digest(int code, PX_MD **res);
+int            pgp_load_cipher(int code, PX_Cipher **res);
+int            pgp_get_cipher_key_size(int code);
+int            pgp_get_cipher_block_size(int code);
 
 int            pgp_s2k_fill(PGP_S2K *s2k, int mode, int digest_algo, int count);
 int            pgp_s2k_read(PullFilter *src, PGP_S2K *s2k);
-int            pgp_s2k_process(PGP_S2K *s2k, int cipher, const uint8 *key, int klen);
+int            pgp_s2k_process(PGP_S2K *s2k, int cipher, const uint8 *key, int key_len);
 
 typedef struct PGP_CFB PGP_CFB;
 int            pgp_cfb_create(PGP_CFB **ctx_p, int algo,
@@ -316,11 +316,11 @@ int           pgp_mpi_write(PushFilter *dst, PGP_MPI *n);
 int            pgp_mpi_hash(PX_MD *md, PGP_MPI *n);
 unsigned   pgp_mpi_cksum(unsigned cksum, PGP_MPI *n);
 
-int            pgp_elgamal_encrypt(PGP_PubKey *pk, PGP_MPI *m,
-                               PGP_MPI **c1, PGP_MPI **c2);
-int            pgp_elgamal_decrypt(PGP_PubKey *pk, PGP_MPI *c1, PGP_MPI *c2,
-                               PGP_MPI **m);
-int            pgp_rsa_encrypt(PGP_PubKey *pk, PGP_MPI *m, PGP_MPI **c);
-int            pgp_rsa_decrypt(PGP_PubKey *pk, PGP_MPI *c, PGP_MPI **m);
+int            pgp_elgamal_encrypt(PGP_PubKey *pk, PGP_MPI *_m,
+                               PGP_MPI **c1_p, PGP_MPI **c2_p);
+int            pgp_elgamal_decrypt(PGP_PubKey *pk, PGP_MPI *_c1, PGP_MPI *_c2,
+                               PGP_MPI **msg_p);
+int            pgp_rsa_encrypt(PGP_PubKey *pk, PGP_MPI *_m, PGP_MPI **c_p);
+int            pgp_rsa_decrypt(PGP_PubKey *pk, PGP_MPI *_c, PGP_MPI **m_p);
 
 extern struct PullFilterOps pgp_decrypt_filter;
index 08001a81f5e53cde0ed0582cebc911c57f450c77..54de806965530ebd6fccf32052c16ec18a23ac95 100644 (file)
@@ -48,8 +48,8 @@
 /*
  * main interface
  */
-char      *px_crypt(const char *psw, const char *salt, char *buf, unsigned buflen);
-int            px_gen_salt(const char *salt_type, char *dst, int rounds);
+char      *px_crypt(const char *psw, const char *salt, char *buf, unsigned len);
+int            px_gen_salt(const char *salt_type, char *buf, int rounds);
 
 /*
  * internal functions
@@ -77,6 +77,6 @@ char     *px_crypt_des(const char *key, const char *setting);
 
 /* crypt-md5.c */
 char      *px_crypt_md5(const char *pw, const char *salt,
-                        char *dst, unsigned dstlen);
+                        char *passwd, unsigned dstlen);
 
 #endif                         /* _PX_CRYPT_H */
index 4ef40f3f1c53fb3409343ac40718da03fdbd8dfe..471bb4ec7274c216977854dd386a990f44b46ea6 100644 (file)
@@ -176,7 +176,7 @@ int         px_find_combo(const char *name, PX_Combo **res);
 void       px_THROW_ERROR(int err) pg_attribute_noreturn();
 const char *px_strerror(int err);
 
-const char *px_resolve_alias(const PX_Alias *aliases, const char *name);
+const char *px_resolve_alias(const PX_Alias *list, const char *name);
 
 void       px_set_debug_handler(void (*handler) (const char *));
 
index a9766f97346a21ca42cc25229a9c36048a48880b..09f37fb77a8c2d81a565381c68d8f8b08376d12f 100644 (file)
@@ -149,7 +149,7 @@ static void deparseReturningList(StringInfo buf, RangeTblEntry *rte,
 static void deparseColumnRef(StringInfo buf, int varno, int varattno,
                             RangeTblEntry *rte, bool qualify_col);
 static void deparseRelation(StringInfo buf, Relation rel);
-static void deparseExpr(Expr *expr, deparse_expr_cxt *context);
+static void deparseExpr(Expr *node, deparse_expr_cxt *context);
 static void deparseVar(Var *node, deparse_expr_cxt *context);
 static void deparseConst(Const *node, deparse_expr_cxt *context, int showtype);
 static void deparseParam(Param *node, deparse_expr_cxt *context);
index b76818f7fdb3eade77939da86519f8c9101e5c38..dd858aba034431d4fa6eab5bf4b891df801084c8 100644 (file)
@@ -457,7 +457,7 @@ static PgFdwModifyState *create_foreign_modify(EState *estate,
                                               Plan *subplan,
                                               char *query,
                                               List *target_attrs,
-                                              int len,
+                                              int values_end,
                                               bool has_returning,
                                               List *retrieved_attrs);
 static TupleTableSlot **execute_foreign_modify(EState *estate,
index 21f2b20ce8d23f9ee6887eae7fa581ccc54bce56..a11d45bedfc537b050df0ae89f3e7729863cc39c 100644 (file)
@@ -226,7 +226,7 @@ extern EquivalenceMember *find_em_for_rel_target(PlannerInfo *root,
                                                 RelOptInfo *rel);
 extern List *build_tlist_to_deparse(RelOptInfo *foreignrel);
 extern void deparseSelectStmtForRel(StringInfo buf, PlannerInfo *root,
-                                   RelOptInfo *foreignrel, List *tlist,
+                                   RelOptInfo *rel, List *tlist,
                                    List *remote_conds, List *pathkeys,
                                    bool has_final_sort, bool has_limit,
                                    bool is_subquery,
index 4a8e2be3290b0ef9ea32a5a2002fe65073e4f212..cb677e0ae51cf242e003825bea590dbc1b87a209 100644 (file)
@@ -92,7 +92,7 @@ PG_FUNCTION_INFO_V1(seg_different);
 /*
 ** Auxiliary functions
 */
-static int restore(char *s, float val, int n);
+static int restore(char *result, float val, int n);
 
 
 /*****************************************************************************
index 9488bf3a81a9474d0cd4c9c8bf5df08c8aaa8e3e..f4eafc865d94df3a6f864f4efe69307cafa92601 100644 (file)
@@ -12,7 +12,7 @@ typedef struct SEG
 } SEG;
 
 /* in seg.c */
-extern int significant_digits(const char *str);
+extern int significant_digits(const char *s);
 
 /* in segscan.l */
 extern int seg_yylex(void);
index e308228bde5e1595174bb89deaa0740c74fbd150..b967e6d4beb5db33b4ee350f3e5e33b61a3a662f 100644 (file)
@@ -51,9 +51,9 @@ static Tuplestorestate *get_crosstab_tuplestore(char *sql,
                                                HTAB *crosstab_hash,
                                                TupleDesc tupdesc,
                                                bool randomAccess);
-static void validateConnectbyTupleDesc(TupleDesc tupdesc, bool show_branch, bool show_serial);
-static bool compatCrosstabTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2);
-static void compatConnectbyTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2);
+static void validateConnectbyTupleDesc(TupleDesc td, bool show_branch, bool show_serial);
+static bool compatCrosstabTupleDescs(TupleDesc ret_tupdesc, TupleDesc sql_tupdesc);
+static void compatConnectbyTupleDescs(TupleDesc ret_tupdesc, TupleDesc sql_tupdesc);
 static void get_normal_pair(float8 *x1, float8 *x2);
 static Tuplestorestate *connectby(char *relname,
                                  char *key_fld,
index 3f90ffa32de56ef3f72a9ce4d603ddaef115300c..e0fd6f176593948d646391cccf570443ef9b6cc0 100644 (file)
@@ -60,7 +60,7 @@ static void pg_output_begin(LogicalDecodingContext *ctx,
 static void pg_decode_commit_txn(LogicalDecodingContext *ctx,
                                 ReorderBufferTXN *txn, XLogRecPtr commit_lsn);
 static void pg_decode_change(LogicalDecodingContext *ctx,
-                            ReorderBufferTXN *txn, Relation rel,
+                            ReorderBufferTXN *txn, Relation relation,
                             ReorderBufferChange *change);
 static void pg_decode_truncate(LogicalDecodingContext *ctx,
                               ReorderBufferTXN *txn,
@@ -69,7 +69,7 @@ static void pg_decode_truncate(LogicalDecodingContext *ctx,
 static bool pg_decode_filter(LogicalDecodingContext *ctx,
                             RepOriginId origin_id);
 static void pg_decode_message(LogicalDecodingContext *ctx,
-                             ReorderBufferTXN *txn, XLogRecPtr message_lsn,
+                             ReorderBufferTXN *txn, XLogRecPtr lsn,
                              bool transactional, const char *prefix,
                              Size sz, const char *message);
 static bool pg_decode_filter_prepare(LogicalDecodingContext *ctx,
@@ -109,7 +109,7 @@ static void pg_decode_stream_change(LogicalDecodingContext *ctx,
                                    Relation relation,
                                    ReorderBufferChange *change);
 static void pg_decode_stream_message(LogicalDecodingContext *ctx,
-                                    ReorderBufferTXN *txn, XLogRecPtr message_lsn,
+                                    ReorderBufferTXN *txn, XLogRecPtr lsn,
                                     bool transactional, const char *prefix,
                                     Size sz, const char *message);
 static void pg_decode_stream_truncate(LogicalDecodingContext *ctx,