pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
assorted code cleanup
12+ messages / 6 participants
[nested] [flat]

Commits from this thread:
  2017-09-07 1356f78ea9  Reduce excessive dereferencing of function pointers
* assorted code cleanup
@ 2017-08-17 16:56 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-08-21 05:11 ` Re: assorted code cleanup Michael Paquier <michael.paquier@gmail.com>
  0 siblings, 1 reply; 12+ messages in thread

From: Peter Eisentraut @ 2017-08-17 16:56 UTC (permalink / raw)
  To: pgsql-hackers

Here are a few assorted patches I made while working on the stdbool set,
cleaning up various pieces of dead code and weird styles.

- Drop excessive dereferencing of function pointers
- Remove endof macro
- Remove unnecessary casts
- Remove unnecessary parentheses in return statements
- Remove our own definition of NULL
- fuzzystrmatch: Remove dead code

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments: download all (6 files, .tar.gz)

0001-fuzzystrmatch-Remove-dead-code.patch (text/plain, 2.7K) download From 78ff9b72ec38a6d4072d2462f54aed812e30c107 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter_e@gmx.net> Date: Thu, 17 Aug 2017 12:39:20 -0400 Subject: [PATCH 1/6] fuzzystrmatch: Remove dead code --- contrib/fuzzystrmatch/fuzzystrmatch.c | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/contrib/fuzzystrmatch/fuzzystrmatch.c b/contrib/fuzzystrmatch/fuzzystrmatch.c index ce58a6a7fc..c9928cede8 100644 --- a/contrib/fuzzystrmatch/fuzzystrmatch.c +++ b/contrib/fuzzystrmatch/fuzzystrmatch.c @@ -94,18 +94,6 @@ soundex_code(char letter) ****************************************************************************/ -/************************************************************************** - my constants -- constants I like - - Probably redundant. - -***************************************************************************/ - -#define META_ERROR FALSE -#define META_SUCCESS TRUE -#define META_FAILURE FALSE - - /* I add modifications to the traditional metaphone algorithm that you might find in books. Define this if you want metaphone to behave traditionally */ @@ -116,7 +104,7 @@ soundex_code(char letter) #define TH '0' static char Lookahead(char *word, int how_far); -static int _metaphone(char *word, int max_phonemes, char **phoned_word); +static void _metaphone(char *word, int max_phonemes, char **phoned_word); /* Metachar.h ... little bits about characters for metaphone */ @@ -272,7 +260,6 @@ metaphone(PG_FUNCTION_ARGS) size_t str_i_len = strlen(str_i); int reqlen; char *metaph; - int retval; /* return an empty string if we receive one */ if (!(str_i_len > 0)) @@ -297,16 +284,8 @@ metaphone(PG_FUNCTION_ARGS) errmsg("output cannot be empty string"))); - retval = _metaphone(str_i, reqlen, &metaph); - if (retval == META_SUCCESS) - PG_RETURN_TEXT_P(cstring_to_text(metaph)); - else - { - /* internal error */ - elog(ERROR, "metaphone: failure"); - /* keep the compiler quiet */ - PG_RETURN_NULL(); - } + _metaphone(str_i, reqlen, &metaph); + PG_RETURN_TEXT_P(cstring_to_text(metaph)); } @@ -362,7 +341,7 @@ Lookahead(char *word, int how_far) #define Isbreak(c) (!isalpha((unsigned char) (c))) -static int +static void _metaphone(char *word, /* IN */ int max_phonemes, char **phoned_word) /* OUT */ @@ -404,7 +383,7 @@ _metaphone(char *word, /* IN */ if (Curr_Letter == '\0') { End_Phoned_Word; - return META_SUCCESS; /* For testing */ + return; } } @@ -721,7 +700,7 @@ _metaphone(char *word, /* IN */ End_Phoned_Word; - return (META_SUCCESS); + return; } /* END metaphone */ base-commit: d54285935072175aac1c446e15ec778b08a8fd75 -- 2.14.1
0002-Remove-our-own-definition-of-NULL.patch (text/plain, 1.4K) download From 3709c41faf9da02485d5b20214a0a2c3b1c2f0a5 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter_e@gmx.net> Date: Thu, 17 Aug 2017 12:39:20 -0400 Subject: [PATCH 2/6] Remove our own definition of NULL Surely everyone has that by now. --- src/include/c.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/include/c.h b/src/include/c.h index af799dc1df..c28534bc88 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -27,7 +27,7 @@ * ------- ------------------------------------------------ * 0) pg_config.h and standard system headers * 1) hacks to cope with non-ANSI C compilers - * 2) bool, true, false, TRUE, FALSE, NULL + * 2) bool, true, false, TRUE, FALSE * 3) standard system types * 4) IsValid macros for system types * 5) offsetof, lengthof, endof, alignment @@ -184,7 +184,7 @@ #endif /* ---------------------------------------------------------------- - * Section 2: bool, true, false, TRUE, FALSE, NULL + * Section 2: bool, true, false, TRUE, FALSE * ---------------------------------------------------------------- */ @@ -221,14 +221,6 @@ typedef bool *BoolPtr; #define FALSE 0 #endif -/* - * NULL - * Null pointer. - */ -#ifndef NULL -#define NULL ((void *) 0) -#endif - /* ---------------------------------------------------------------- * Section 3: standard system types -- 2.14.1
0003-Remove-unnecessary-parentheses-in-return-statements.patch (text/plain, 74.8K) download From 336ca45309604bcc13c6905da4b6d68242381f7b Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter_e@gmx.net> Date: Thu, 17 Aug 2017 12:39:20 -0400 Subject: [PATCH 3/6] Remove unnecessary parentheses in return statements The parenthesized style has only been used in a few modules. Change that to use the style that is predominant across the whole tree. --- contrib/btree_gist/btree_utils_num.c | 2 +- contrib/btree_gist/btree_utils_var.c | 4 +- contrib/cube/cube.c | 34 +++---- contrib/dblink/dblink.c | 10 +- contrib/intarray/_int_bool.c | 2 +- contrib/pgcrypto/crypt-des.c | 30 +++--- contrib/pgstattuple/pgstatindex.c | 2 +- contrib/seg/seg.c | 8 +- contrib/spi/refint.c | 2 +- contrib/spi/timetravel.c | 4 +- doc/src/sgml/spi.sgml | 2 +- src/backend/bootstrap/bootscanner.l | 56 +++++------ src/backend/tsearch/spell.c | 10 +- src/backend/utils/adt/inet_cidr_ntop.c | 18 ++-- src/backend/utils/adt/inet_net_pton.c | 44 ++++----- src/backend/utils/adt/tsgistidx.c | 4 +- src/backend/utils/mb/Unicode/convutils.pm | 2 +- .../mb/conversion_procs/euc_tw_and_big5/big5.c | 4 +- src/interfaces/ecpg/compatlib/informix.c | 16 ++-- src/interfaces/ecpg/ecpglib/connect.c | 12 +-- src/interfaces/ecpg/ecpglib/data.c | 48 +++++----- src/interfaces/ecpg/ecpglib/descriptor.c | 44 ++++----- src/interfaces/ecpg/ecpglib/error.c | 16 ++-- src/interfaces/ecpg/ecpglib/execute.c | 102 ++++++++++----------- src/interfaces/ecpg/ecpglib/memory.c | 6 +- src/interfaces/ecpg/ecpglib/misc.c | 24 ++--- src/interfaces/ecpg/ecpglib/prepare.c | 22 ++--- src/interfaces/ecpg/pgtypeslib/common.c | 4 +- src/interfaces/ecpg/pgtypeslib/numeric.c | 14 +-- src/interfaces/ecpg/pgtypeslib/timestamp.c | 10 +- src/interfaces/ecpg/preproc/ecpg.c | 4 +- src/interfaces/ecpg/preproc/ecpg.header | 10 +- src/interfaces/ecpg/preproc/pgc.l | 70 +++++++------- src/interfaces/ecpg/preproc/type.c | 84 ++++++++--------- src/interfaces/ecpg/preproc/variable.c | 36 ++++---- src/test/isolation/specscanner.l | 10 +- 36 files changed, 385 insertions(+), 385 deletions(-) diff --git a/contrib/btree_gist/btree_utils_num.c b/contrib/btree_gist/btree_utils_num.c index bae32c4064..b2295f2c7d 100644 --- a/contrib/btree_gist/btree_utils_num.c +++ b/contrib/btree_gist/btree_utils_num.c @@ -296,7 +296,7 @@ gbt_num_consistent(const GBT_NUMKEY_R *key, retval = false; } - return (retval); + return retval; } diff --git a/contrib/btree_gist/btree_utils_var.c b/contrib/btree_gist/btree_utils_var.c index 2c636ad2fa..ecc87f3bb3 100644 --- a/contrib/btree_gist/btree_utils_var.c +++ b/contrib/btree_gist/btree_utils_var.c @@ -159,7 +159,7 @@ gbt_var_node_cp_len(const GBT_VARKEY *node, const gbtree_vinfo *tinfo) l--; i++; } - return (ml); /* lower == upper */ + return ml; /* lower == upper */ } @@ -299,7 +299,7 @@ gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo) else retval = entry; - return (retval); + return retval; } diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c index 149558c763..0e968d1c76 100644 --- a/contrib/cube/cube.c +++ b/contrib/cube/cube.c @@ -625,7 +625,7 @@ g_cube_leaf_consistent(NDBOX *key, default: retval = FALSE; } - return (retval); + return retval; } bool @@ -652,7 +652,7 @@ g_cube_internal_consistent(NDBOX *key, default: retval = FALSE; } - return (retval); + return retval; } NDBOX * @@ -663,7 +663,7 @@ g_cube_binary_union(NDBOX *r1, NDBOX *r2, int *sizep) retval = cube_union_v0(r1, r2); *sizep = VARSIZE(retval); - return (retval); + return retval; } @@ -729,7 +729,7 @@ cube_union_v0(NDBOX *a, NDBOX *b) SET_POINT_BIT(result); } - return (result); + return result; } Datum @@ -1058,7 +1058,7 @@ cube_contains_v0(NDBOX *a, NDBOX *b) int i; if ((a == NULL) || (b == NULL)) - return (FALSE); + return FALSE; if (DIM(a) < DIM(b)) { @@ -1070,9 +1070,9 @@ cube_contains_v0(NDBOX *a, NDBOX *b) for (i = DIM(a); i < DIM(b); i++) { if (LL_COORD(b, i) != 0) - return (FALSE); + return FALSE; if (UR_COORD(b, i) != 0) - return (FALSE); + return FALSE; } } @@ -1081,13 +1081,13 @@ cube_contains_v0(NDBOX *a, NDBOX *b) { if (Min(LL_COORD(a, i), UR_COORD(a, i)) > Min(LL_COORD(b, i), UR_COORD(b, i))) - return (FALSE); + return FALSE; if (Max(LL_COORD(a, i), UR_COORD(a, i)) < Max(LL_COORD(b, i), UR_COORD(b, i))) - return (FALSE); + return FALSE; } - return (TRUE); + return TRUE; } Datum @@ -1128,7 +1128,7 @@ cube_overlap_v0(NDBOX *a, NDBOX *b) int i; if ((a == NULL) || (b == NULL)) - return (FALSE); + return FALSE; /* swap the box pointers if needed */ if (DIM(a) < DIM(b)) @@ -1143,21 +1143,21 @@ cube_overlap_v0(NDBOX *a, NDBOX *b) for (i = 0; i < DIM(b); i++) { if (Min(LL_COORD(a, i), UR_COORD(a, i)) > Max(LL_COORD(b, i), UR_COORD(b, i))) - return (FALSE); + return FALSE; if (Max(LL_COORD(a, i), UR_COORD(a, i)) < Min(LL_COORD(b, i), UR_COORD(b, i))) - return (FALSE); + return FALSE; } /* compare to zero those dimensions in (a) absent in (b) */ for (i = DIM(b); i < DIM(a); i++) { if (Min(LL_COORD(a, i), UR_COORD(a, i)) > 0) - return (FALSE); + return FALSE; if (Max(LL_COORD(a, i), UR_COORD(a, i)) < 0) - return (FALSE); + return FALSE; } - return (TRUE); + return TRUE; } @@ -1385,7 +1385,7 @@ distance_1D(double a1, double a2, double b1, double b2) return (Min(a1, a2) - Max(b1, b2)); /* the rest are all sorts of intersections */ - return (0.0); + return 0.0; } /* Test if a box is also a point */ diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c index 81136b131c..9f8e08d3d4 100644 --- a/contrib/dblink/dblink.c +++ b/contrib/dblink/dblink.c @@ -2215,7 +2215,7 @@ get_sql_insert(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals } appendStringInfoChar(&buf, ')'); - return (buf.data); + return buf.data; } static char * @@ -2251,7 +2251,7 @@ get_sql_delete(Relation rel, int *pkattnums, int pknumatts, char **tgt_pkattvals appendStringInfoString(&buf, " IS NULL"); } - return (buf.data); + return buf.data; } static char * @@ -2335,7 +2335,7 @@ get_sql_update(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals appendStringInfoString(&buf, " IS NULL"); } - return (buf.data); + return buf.data; } /* @@ -2540,9 +2540,9 @@ getConnectionByName(const char *name) key, HASH_FIND, NULL); if (hentry) - return (hentry->rconn); + return hentry->rconn; - return (NULL); + return NULL; } static HTAB * diff --git a/contrib/intarray/_int_bool.c b/contrib/intarray/_int_bool.c index a18c645606..bad8c36037 100644 --- a/contrib/intarray/_int_bool.c +++ b/contrib/intarray/_int_bool.c @@ -245,7 +245,7 @@ checkcondition_arr(void *checkval, ITEM *item) { StopMiddle = StopLow + (StopHigh - StopLow) / 2; if (*StopMiddle == item->val) - return (true); + return true; else if (*StopMiddle < item->val) StopLow = StopMiddle + 1; else diff --git a/contrib/pgcrypto/crypt-des.c b/contrib/pgcrypto/crypt-des.c index 60bdbb0c91..ee3a0f2169 100644 --- a/contrib/pgcrypto/crypt-des.c +++ b/contrib/pgcrypto/crypt-des.c @@ -206,18 +206,18 @@ static inline int ascii_to_bin(char ch) { if (ch > 'z') - return (0); + return 0; if (ch >= 'a') return (ch - 'a' + 38); if (ch > 'Z') - return (0); + return 0; if (ch >= 'A') return (ch - 'A' + 12); if (ch > '9') - return (0); + return 0; if (ch >= '.') return (ch - '.'); - return (0); + return 0; } static void @@ -420,7 +420,7 @@ des_setkey(const char *key) * (which is weak and has bad parity anyway) in order to simplify the * starting conditions. */ - return (0); + return 0; } old_rawkey0 = rawkey0; old_rawkey1 = rawkey1; @@ -479,7 +479,7 @@ des_setkey(const char *key) | comp_maskr[6][(t1 >> 7) & 0x7f] | comp_maskr[7][t1 & 0x7f]; } - return (0); + return 0; } static int @@ -500,7 +500,7 @@ do_des(uint32 l_in, uint32 r_in, uint32 *l_out, uint32 *r_out, int count) int round; if (count == 0) - return (1); + return 1; else if (count > 0) { /* @@ -613,7 +613,7 @@ do_des(uint32 l_in, uint32 r_in, uint32 *l_out, uint32 *r_out, int count) | fp_maskr[5][(r >> 16) & 0xff] | fp_maskr[6][(r >> 8) & 0xff] | fp_maskr[7][r & 0xff]; - return (0); + return 0; } static int @@ -639,7 +639,7 @@ des_cipher(const char *in, char *out, long salt, int count) retval = do_des(rawl, rawr, &l_out, &r_out, count); if (retval) - return (retval); + return retval; buffer[0] = htonl(l_out); buffer[1] = htonl(r_out); @@ -647,7 +647,7 @@ des_cipher(const char *in, char *out, long salt, int count) /* copy data to avoid assuming output is word-aligned */ memcpy(out, buffer, sizeof(buffer)); - return (retval); + return retval; } char * @@ -680,7 +680,7 @@ px_crypt_des(const char *key, const char *setting) key++; } if (des_setkey((char *) keybuf)) - return (NULL); + return NULL; #ifndef DISABLE_XDES if (*setting == _PASSWORD_EFMT1) @@ -711,7 +711,7 @@ px_crypt_des(const char *key, const char *setting) * Encrypt the key with itself. */ if (des_cipher((char *) keybuf, (char *) keybuf, 0L, 1)) - return (NULL); + return NULL; /* * And XOR with the next 8 characters of the key. @@ -721,7 +721,7 @@ px_crypt_des(const char *key, const char *setting) *q++ ^= *key++ << 1; if (des_setkey((char *) keybuf)) - return (NULL); + return NULL; } StrNCpy(output, setting, 10); @@ -767,7 +767,7 @@ px_crypt_des(const char *key, const char *setting) * Do it. */ if (do_des(0L, 0L, &r0, &r1, count)) - return (NULL); + return NULL; /* * Now encode the result... @@ -790,5 +790,5 @@ px_crypt_des(const char *key, const char *setting) *p++ = _crypt_a64[l & 0x3f]; *p = 0; - return (output); + return output; } diff --git a/contrib/pgstattuple/pgstatindex.c b/contrib/pgstattuple/pgstatindex.c index 9365ba7e02..75317b96a2 100644 --- a/contrib/pgstattuple/pgstatindex.c +++ b/contrib/pgstattuple/pgstatindex.c @@ -568,7 +568,7 @@ pgstatginindex_internal(Oid relid, FunctionCallInfo fcinfo) tuple = heap_form_tuple(tupleDesc, values, nulls); result = HeapTupleGetDatum(tuple); - return (result); + return result; } /* ------------------------------------------------------ diff --git a/contrib/seg/seg.c b/contrib/seg/seg.c index 4fc18130e1..e707b18fc6 100644 --- a/contrib/seg/seg.c +++ b/contrib/seg/seg.c @@ -528,7 +528,7 @@ gseg_binary_union(Datum r1, Datum r2, int *sizep) retval = DirectFunctionCall2(seg_union, r1, r2); *sizep = sizeof(SEG); - return (retval); + return retval; } @@ -1040,7 +1040,7 @@ restore(char *result, float val, int n) /* ... this is not done yet. */ } - return (strlen(result)); + return strlen(result); } @@ -1080,7 +1080,7 @@ significant_digits(char *s) } if (!n) - return (zeroes); + return zeroes; - return (n); + return n; } diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index 46205c7613..70def95ac5 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -636,5 +636,5 @@ find_plan(char *ident, EPlan **eplan, int *nplans) newp->splan = NULL; (*nplans)++; - return (newp); + return newp; } diff --git a/contrib/spi/timetravel.c b/contrib/spi/timetravel.c index f7905e20db..5b17044b81 100644 --- a/contrib/spi/timetravel.c +++ b/contrib/spi/timetravel.c @@ -517,7 +517,7 @@ findTTStatus(char *name) AbsoluteTime currabstime() { - return (GetCurrentAbsoluteTime()); + return GetCurrentAbsoluteTime(); } */ @@ -549,5 +549,5 @@ find_plan(char *ident, EPlan **eplan, int *nplans) newp->splan = NULL; (*nplans)++; - return (newp); + return newp; } diff --git a/doc/src/sgml/spi.sgml b/doc/src/sgml/spi.sgml index 86be87c0fd..b094775cc7 100644 --- a/doc/src/sgml/spi.sgml +++ b/doc/src/sgml/spi.sgml @@ -4399,7 +4399,7 @@ <title>Examples</title> SPI_finish(); pfree(command); - return (proc); + return proc; } </programlisting> diff --git a/src/backend/bootstrap/bootscanner.l b/src/backend/bootstrap/bootscanner.l index 6467882fa3..51c5e5e3cd 100644 --- a/src/backend/bootstrap/bootscanner.l +++ b/src/backend/bootstrap/bootscanner.l @@ -72,25 +72,25 @@ arrayid [A-Za-z0-9_]+\[{D}*\] %% -open { return(OPEN); } +open { return OPEN; } -close { return(XCLOSE); } +close { return XCLOSE; } -create { return(XCREATE); } +create { return XCREATE; } -OID { return(OBJ_ID); } -bootstrap { return(XBOOTSTRAP); } -"shared_relation" { return(XSHARED_RELATION); } -"without_oids" { return(XWITHOUT_OIDS); } -"rowtype_oid" { return(XROWTYPE_OID); } -_null_ { return(NULLVAL); } +OID { return OBJ_ID; } +bootstrap { return XBOOTSTRAP; } +"shared_relation" { return XSHARED_RELATION; } +"without_oids" { return XWITHOUT_OIDS; } +"rowtype_oid" { return XROWTYPE_OID; } +_null_ { return NULLVAL; } -insert { return(INSERT_TUPLE); } +insert { return INSERT_TUPLE; } -"," { return(COMMA); } -"=" { return(EQUALS); } -"(" { return(LPAREN); } -")" { return(RPAREN); } +"," { return COMMA; } +"=" { return EQUALS; } +"(" { return LPAREN; } +")" { return RPAREN; } [\n] { yyline++; } [\t] ; @@ -99,31 +99,31 @@ insert { return(INSERT_TUPLE); } ^\#[^\n]* ; /* drop everything after "#" for comments */ -"declare" { return(XDECLARE); } -"build" { return(XBUILD); } -"indices" { return(INDICES); } -"unique" { return(UNIQUE); } -"index" { return(INDEX); } -"on" { return(ON); } -"using" { return(USING); } -"toast" { return(XTOAST); } -"FORCE" { return(XFORCE); } -"NOT" { return(XNOT); } -"NULL" { return(XNULL); } +"declare" { return XDECLARE; } +"build" { return XBUILD; } +"indices" { return INDICES; } +"unique" { return UNIQUE; } +"index" { return INDEX; } +"on" { return ON; } +"using" { return USING; } +"toast" { return XTOAST; } +"FORCE" { return XFORCE; } +"NOT" { return XNOT; } +"NULL" { return XNULL; } {arrayid} { yylval.str = MapArrayTypeName(yytext); - return(ID); + return ID; } {id} { yylval.str = scanstr(yytext); - return(ID); + return ID; } {sid} { yytext[strlen(yytext)-1] = '\0'; /* strip off quotes */ yylval.str = scanstr(yytext+1); yytext[strlen(yytext)] = '"'; /* restore quotes */ - return(ID); + return ID; } . { diff --git a/src/backend/tsearch/spell.c b/src/backend/tsearch/spell.c index 1020250490..6527c73731 100644 --- a/src/backend/tsearch/spell.c +++ b/src/backend/tsearch/spell.c @@ -195,14 +195,14 @@ static char *VoidString = ""; static int cmpspell(const void *s1, const void *s2) { - return (strcmp((*(SPELL *const *) s1)->word, (*(SPELL *const *) s2)->word)); + return strcmp((*(SPELL *const *) s1)->word, (*(SPELL *const *) s2)->word); } static int cmpspellaffix(const void *s1, const void *s2) { - return (strcmp((*(SPELL *const *) s1)->p.flag, - (*(SPELL *const *) s2)->p.flag)); + return strcmp((*(SPELL *const *) s1)->p.flag, + (*(SPELL *const *) s2)->p.flag); } static int @@ -2240,9 +2240,9 @@ NormalizeSubWord(IspellDict *Conf, char *word, int flag) if (cur == forms) { pfree(forms); - return (NULL); + return NULL; } - return (forms); + return forms; } typedef struct SplitVar diff --git a/src/backend/utils/adt/inet_cidr_ntop.c b/src/backend/utils/adt/inet_cidr_ntop.c index 2973d56658..30b3673789 100644 --- a/src/backend/utils/adt/inet_cidr_ntop.c +++ b/src/backend/utils/adt/inet_cidr_ntop.c @@ -58,12 +58,12 @@ inet_cidr_ntop(int af, const void *src, int bits, char *dst, size_t size) switch (af) { case PGSQL_AF_INET: - return (inet_cidr_ntop_ipv4(src, bits, dst, size)); + return inet_cidr_ntop_ipv4(src, bits, dst, size); case PGSQL_AF_INET6: - return (inet_cidr_ntop_ipv6(src, bits, dst, size)); + return inet_cidr_ntop_ipv6(src, bits, dst, size); default: errno = EAFNOSUPPORT; - return (NULL); + return NULL; } } @@ -92,7 +92,7 @@ inet_cidr_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size) if (bits < 0 || bits > 32) { errno = EINVAL; - return (NULL); + return NULL; } if (bits == 0) @@ -137,11 +137,11 @@ inet_cidr_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size) if (size <= sizeof "/32") goto emsgsize; dst += SPRINTF((dst, "/%u", bits)); - return (odst); + return odst; emsgsize: errno = EMSGSIZE; - return (NULL); + return NULL; } /* @@ -182,7 +182,7 @@ inet_cidr_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size) if (bits < 0 || bits > 128) { errno = EINVAL; - return (NULL); + return NULL; } cp = outbuf; @@ -286,9 +286,9 @@ inet_cidr_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size) goto emsgsize; strcpy(dst, outbuf); - return (dst); + return dst; emsgsize: errno = EMSGSIZE; - return (NULL); + return NULL; } diff --git a/src/backend/utils/adt/inet_net_pton.c b/src/backend/utils/adt/inet_net_pton.c index be788d37cd..6f3ece1209 100644 --- a/src/backend/utils/adt/inet_net_pton.c +++ b/src/backend/utils/adt/inet_net_pton.c @@ -73,7 +73,7 @@ inet_net_pton(int af, const char *src, void *dst, size_t size) inet_cidr_pton_ipv6(src, dst, size); default: errno = EAFNOSUPPORT; - return (-1); + return -1; } } @@ -228,15 +228,15 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size) goto emsgsize; *dst++ = '\0'; } - return (bits); + return bits; enoent: errno = ENOENT; - return (-1); + return -1; emsgsize: errno = EMSGSIZE; - return (-1); + return -1; } /* @@ -338,11 +338,11 @@ inet_net_pton_ipv4(const char *src, u_char *dst) enoent: errno = ENOENT; - return (-1); + return -1; emsgsize: errno = EMSGSIZE; - return (-1); + return -1; } static int @@ -363,19 +363,19 @@ getbits(const char *src, int *bitsp) if (pch != NULL) { if (n++ != 0 && val == 0) /* no leading zeros */ - return (0); + return 0; val *= 10; val += (pch - digits); if (val > 128) /* range */ - return (0); + return 0; continue; } - return (0); + return 0; } if (n == 0) - return (0); + return 0; *bitsp = val; - return (1); + return 1; } static int @@ -397,32 +397,32 @@ getv4(const char *src, u_char *dst, int *bitsp) if (pch != NULL) { if (n++ != 0 && val == 0) /* no leading zeros */ - return (0); + return 0; val *= 10; val += (pch - digits); if (val > 255) /* range */ - return (0); + return 0; continue; } if (ch == '.' || ch == '/') { if (dst - odst > 3) /* too many octets? */ - return (0); + return 0; *dst++ = val; if (ch == '/') - return (getbits(src, bitsp)); + return getbits(src, bitsp); val = 0; n = 0; continue; } - return (0); + return 0; } if (n == 0) - return (0); + return 0; if (dst - odst > 3) /* too many octets? */ - return (0); + return 0; *dst++ = val; - return (1); + return 1; } static int @@ -552,13 +552,13 @@ inet_cidr_pton_ipv6(const char *src, u_char *dst, size_t size) */ memcpy(dst, tmp, NS_IN6ADDRSZ); - return (bits); + return bits; enoent: errno = ENOENT; - return (-1); + return -1; emsgsize: errno = EMSGSIZE; - return (-1); + return -1; } diff --git a/src/backend/utils/adt/tsgistidx.c b/src/backend/utils/adt/tsgistidx.c index 7ce2699b5c..d8b86f6393 100644 --- a/src/backend/utils/adt/tsgistidx.c +++ b/src/backend/utils/adt/tsgistidx.c @@ -317,14 +317,14 @@ checkcondition_arr(void *checkval, QueryOperand *val, ExecPhraseData *data) { StopMiddle = StopLow + (StopHigh - StopLow) / 2; if (*StopMiddle == val->valcrc) - return (true); + return true; else if (*StopMiddle < val->valcrc) StopLow = StopMiddle + 1; else StopHigh = StopMiddle; } - return (false); + return false; } static bool diff --git a/src/backend/utils/mb/Unicode/convutils.pm b/src/backend/utils/mb/Unicode/convutils.pm index 43cadf5303..22d02ca485 100644 --- a/src/backend/utils/mb/Unicode/convutils.pm +++ b/src/backend/utils/mb/Unicode/convutils.pm @@ -812,7 +812,7 @@ sub ucs2utf (((($ucs & 0x3ffff) >> 12) | 0x80) << 16) | (((($ucs & 0x0fc0) >> 6) | 0x80) << 8) | (($ucs & 0x003f) | 0x80); } - return ($utf); + return $utf; } 1; diff --git a/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c b/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c index 1d9b10f8a7..68f76aa8cb 100644 --- a/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c +++ b/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c @@ -361,14 +361,14 @@ CNStoBIG5(unsigned short cns, unsigned char lc) for (i = 0; i < sizeof(b2c3) / (sizeof(unsigned short) * 2); i++) { if (b2c3[i][1] == cns) - return (b2c3[i][0]); + return b2c3[i][0]; } break; case LC_CNS11643_4: for (i = 0; i < sizeof(b1c4) / (sizeof(unsigned short) * 2); i++) { if (b1c4[i][1] == cns) - return (b1c4[i][0]); + return b1c4[i][0]; } default: break; diff --git a/src/interfaces/ecpg/compatlib/informix.c b/src/interfaces/ecpg/compatlib/informix.c index 2508ed9b8f..e9bcb4cde2 100644 --- a/src/interfaces/ecpg/compatlib/informix.c +++ b/src/interfaces/ecpg/compatlib/informix.c @@ -79,7 +79,7 @@ deccall2(decimal *arg1, decimal *arg2, int (*ptr) (numeric *, numeric *)) PGTYPESnumeric_free(a1); PGTYPESnumeric_free(a2); - return (i); + return i; } static int @@ -143,7 +143,7 @@ deccall3(decimal *arg1, decimal *arg2, decimal *result, int (*ptr) (numeric *, n PGTYPESnumeric_free(a1); PGTYPESnumeric_free(a2); - return (i); + return i; } /* we start with the numeric functions */ @@ -166,7 +166,7 @@ decadd(decimal *arg1, decimal *arg2, decimal *sum) int deccmp(decimal *arg1, decimal *arg2) { - return (deccall2(arg1, arg2, PGTYPESnumeric_cmp)); + return deccall2(arg1, arg2, PGTYPESnumeric_cmp); } void @@ -261,7 +261,7 @@ deccvdbl(double dbl, decimal *np) result = PGTYPESnumeric_to_decimal(nres, np); PGTYPESnumeric_free(nres); - return (result); + return result; } int @@ -283,7 +283,7 @@ deccvint(int in, decimal *np) result = PGTYPESnumeric_to_decimal(nres, np); PGTYPESnumeric_free(nres); - return (result); + return result; } int @@ -305,7 +305,7 @@ deccvlong(long lng, decimal *np) result = PGTYPESnumeric_to_decimal(nres, np); PGTYPESnumeric_free(nres); - return (result); + return result; } int @@ -598,7 +598,7 @@ rmdyjul(short mdy[3], date * d) int rdayofweek(date d) { - return (PGTYPESdate_dayofweek(d)); + return PGTYPESdate_dayofweek(d); } /* And the datetime stuff */ @@ -1049,5 +1049,5 @@ rsetnull(int t, char *ptr) int risnull(int t, char *ptr) { - return (ECPGis_noind_null(t, ptr)); + return ECPGis_noind_null(t, ptr); } diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c index 0716abdd7e..71fa275363 100644 --- a/src/interfaces/ecpg/ecpglib/connect.c +++ b/src/interfaces/ecpg/ecpglib/connect.c @@ -67,7 +67,7 @@ ecpg_get_connection_nr(const char *connection_name) ret = con; } - return (ret); + return ret; } struct connection * @@ -106,7 +106,7 @@ ecpg_get_connection(const char *connection_name) #endif } - return (ret); + return ret; } static void @@ -168,7 +168,7 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name) PGresult *results; if (!ecpg_init(con, connection_name, lineno)) - return (false); + return false; ecpg_log("ECPGsetcommit on line %d: action \"%s\"; connection \"%s\"\n", lineno, mode, con->name); @@ -204,7 +204,7 @@ ECPGsetconn(int lineno, const char *connection_name) struct connection *con = ecpg_get_connection(connection_name); if (!ecpg_init(con, connection_name, lineno)) - return (false); + return false; #ifdef ENABLE_THREAD_SAFETY pthread_setspecific(actual_connection_key, con); @@ -675,7 +675,7 @@ ECPGdisconnect(int lineno, const char *connection_name) { ecpg_raise(lineno, ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL); - return (false); + return false; } #ifdef ENABLE_THREAD_SAFETY @@ -702,7 +702,7 @@ ECPGdisconnect(int lineno, const char *connection_name) #ifdef ENABLE_THREAD_SAFETY pthread_mutex_unlock(&connections_mutex); #endif - return (false); + return false; } else ecpg_finish(con); diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c index 5dbfded873..a2f3916f38 100644 --- a/src/interfaces/ecpg/ecpglib/data.c +++ b/src/interfaces/ecpg/ecpglib/data.c @@ -134,7 +134,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, { ecpg_raise(lineno, ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL); - return (false); + return false; } /* @@ -156,7 +156,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, * at least one tuple, but let's play it safe. */ ecpg_raise(lineno, ECPG_NOT_FOUND, ECPG_SQLSTATE_NO_DATA, NULL); - return (false); + return false; } /* We will have to decode the value */ @@ -204,7 +204,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ecpg_raise(lineno, ECPG_MISSING_INDICATOR, ECPG_SQLSTATE_NULL_VALUE_NO_INDICATOR_PARAMETER, NULL); - return (false); + return false; } } break; @@ -212,12 +212,12 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ecpg_raise(lineno, ECPG_UNSUPPORTED, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, ecpg_type_name(ind_type)); - return (false); + return false; break; } if (value_for_indicator == -1) - return (true); + return true; /* let's check if it really is an array if it should be one */ if (isarray == ECPG_ARRAY_ARRAY) @@ -226,7 +226,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, { ecpg_raise(lineno, ECPG_DATA_NOT_ARRAY, ECPG_SQLSTATE_DATATYPE_MISMATCH, NULL); - return (false); + return false; } switch (type) @@ -307,7 +307,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, { ecpg_raise(lineno, ECPG_INT_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); - return (false); + return false; } pval = scan_length; @@ -336,7 +336,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, { ecpg_raise(lineno, ECPG_UINT_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); - return (false); + return false; } pval = scan_length; @@ -364,7 +364,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, if (garbage_left(isarray, scan_length, compat)) { ecpg_raise(lineno, ECPG_INT_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); - return (false); + return false; } pval = scan_length; @@ -376,7 +376,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, if (garbage_left(isarray, scan_length, compat)) { ecpg_raise(lineno, ECPG_UINT_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); - return (false); + return false; } pval = scan_length; @@ -399,7 +399,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, { ecpg_raise(lineno, ECPG_FLOAT_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); - return (false); + return false; } pval = scan_length; @@ -438,7 +438,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ecpg_raise(lineno, ECPG_CONVERT_BOOL, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); - return (false); + return false; break; case ECPGt_char: @@ -581,14 +581,14 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, { ecpg_raise(lineno, ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL); - return (false); + return false; } } else { ecpg_raise(lineno, ECPG_NUMERIC_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); - return (false); + return false; } } else @@ -598,7 +598,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, free(nres); ecpg_raise(lineno, ECPG_NUMERIC_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); - return (false); + return false; } } pval = scan_length; @@ -635,7 +635,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, */ ires = (interval *) ecpg_alloc(sizeof(interval), lineno); if (!ires) - return (false); + return false; ECPGset_noind_null(ECPGt_interval, ires); } @@ -643,7 +643,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, { ecpg_raise(lineno, ECPG_INTERVAL_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); - return (false); + return false; } } else @@ -656,7 +656,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, free(ires); ecpg_raise(lineno, ECPG_INTERVAL_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); - return (false); + return false; } } pval = scan_length; @@ -693,7 +693,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, { ecpg_raise(lineno, ECPG_DATE_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); - return (false); + return false; } } else @@ -705,7 +705,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, { ecpg_raise(lineno, ECPG_DATE_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); - return (false); + return false; } } @@ -741,7 +741,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, { ecpg_raise(lineno, ECPG_TIMESTAMP_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); - return (false); + return false; } } else @@ -753,7 +753,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, { ecpg_raise(lineno, ECPG_TIMESTAMP_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); - return (false); + return false; } } @@ -765,7 +765,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ecpg_raise(lineno, ECPG_UNSUPPORTED, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, ecpg_type_name(type)); - return (false); + return false; break; } if (ECPG_IS_ARRAY(isarray)) @@ -791,5 +791,5 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, } } while (*pval != '\0' && !array_boundary(isarray, *pval)); - return (true); + return true; } diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c b/src/interfaces/ecpg/ecpglib/descriptor.c index 1fa00b892f..bdd25184dc 100644 --- a/src/interfaces/ecpg/ecpglib/descriptor.c +++ b/src/interfaces/ecpg/ecpglib/descriptor.c @@ -150,10 +150,10 @@ get_int_item(int lineno, void *var, enum ECPGttype vartype, int value) break; default: ecpg_raise(lineno, ECPG_VAR_NOT_NUMERIC, ECPG_SQLSTATE_RESTRICTED_DATA_TYPE_ATTRIBUTE_VIOLATION, NULL); - return (false); + return false; } - return (true); + return true; } static bool @@ -195,7 +195,7 @@ set_int_item(int lineno, int *target, const void *var, enum ECPGttype vartype) break; default: ecpg_raise(lineno, ECPG_VAR_NOT_NUMERIC, ECPG_SQLSTATE_RESTRICTED_DATA_TYPE_ATTRIBUTE_VIOLATION, NULL); - return (false); + return false; } return true; @@ -228,17 +228,17 @@ get_char_item(int lineno, void *var, enum ECPGttype vartype, char *value, int va break; default: ecpg_raise(lineno, ECPG_VAR_NOT_CHAR, ECPG_SQLSTATE_RESTRICTED_DATA_TYPE_ATTRIBUTE_VIOLATION, NULL); - return (false); + return false; } - return (true); + return true; } #define RETURN_IF_NO_DATA if (ntuples < 1) \ { \ va_end(args); \ ecpg_raise(lineno, ECPG_NOT_FOUND, ECPG_SQLSTATE_NO_DATA, NULL); \ - return (false); \ + return false; \ } bool @@ -265,7 +265,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) if (!ECPGresult) { va_end(args); - return (false); + return false; } ntuples = PQntuples(ECPGresult); @@ -274,7 +274,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) { ecpg_raise(lineno, ECPG_INVALID_DESCRIPTOR_INDEX, ECPG_SQLSTATE_INVALID_DESCRIPTOR_INDEX, NULL); va_end(args); - return (false); + return false; } ecpg_log("ECPGget_desc: reading items for tuple %d\n", index); @@ -333,7 +333,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) if (!get_char_item(lineno, var, vartype, PQfname(ECPGresult, index), varcharsize)) { va_end(args); - return (false); + return false; } ecpg_log("ECPGget_desc: NAME = %s\n", PQfname(ECPGresult, index)); @@ -343,7 +343,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) if (!get_int_item(lineno, var, vartype, 1)) { va_end(args); - return (false); + return false; } break; @@ -352,7 +352,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) if (!get_int_item(lineno, var, vartype, 0)) { va_end(args); - return (false); + return false; } break; @@ -361,7 +361,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) if (!get_int_item(lineno, var, vartype, (PQfmod(ECPGresult, index) - VARHDRSZ) & 0xffff)) { va_end(args); - return (false); + return false; } ecpg_log("ECPGget_desc: SCALE = %d\n", (PQfmod(ECPGresult, index) - VARHDRSZ) & 0xffff); @@ -371,7 +371,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) if (!get_int_item(lineno, var, vartype, PQfmod(ECPGresult, index) >> 16)) { va_end(args); - return (false); + return false; } ecpg_log("ECPGget_desc: PRECISION = %d\n", PQfmod(ECPGresult, index) >> 16); @@ -381,7 +381,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) if (!get_int_item(lineno, var, vartype, PQfsize(ECPGresult, index))) { va_end(args); - return (false); + return false; } ecpg_log("ECPGget_desc: OCTET_LENGTH = %d\n", PQfsize(ECPGresult, index)); @@ -391,7 +391,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) if (!get_int_item(lineno, var, vartype, PQfmod(ECPGresult, index) - VARHDRSZ)) { va_end(args); - return (false); + return false; } ecpg_log("ECPGget_desc: LENGTH = %d\n", PQfmod(ECPGresult, index) - VARHDRSZ); @@ -401,7 +401,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) if (!get_int_item(lineno, var, vartype, ecpg_dynamic_type(PQftype(ECPGresult, index)))) { va_end(args); - return (false); + return false; } ecpg_log("ECPGget_desc: TYPE = %d\n", ecpg_dynamic_type(PQftype(ECPGresult, index))); @@ -411,7 +411,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) if (!get_int_item(lineno, var, vartype, ecpg_dynamic_type_DDT(PQftype(ECPGresult, index)))) { va_end(args); - return (false); + return false; } ecpg_log("ECPGget_desc: TYPE = %d\n", ecpg_dynamic_type_DDT(PQftype(ECPGresult, index))); @@ -421,7 +421,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) if (!get_int_item(lineno, var, vartype, PQntuples(ECPGresult))) { va_end(args); - return (false); + return false; } ecpg_log("ECPGget_desc: CARDINALITY = %d\n", PQntuples(ECPGresult)); @@ -462,7 +462,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) if (!get_int_item(lineno, var, vartype, PQgetlength(ECPGresult, act_tuple, index))) { va_end(args); - return (false); + return false; } var = (char *) var + offset; ecpg_log("ECPGget_desc: RETURNED[%d] = %d\n", act_tuple, PQgetlength(ECPGresult, act_tuple, index)); @@ -473,7 +473,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) snprintf(type_str, sizeof(type_str), "%d", type); ecpg_raise(lineno, ECPG_UNKNOWN_DESCRIPTOR_ITEM, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, type_str); va_end(args); - return (false); + return false; } type = va_arg(args, enum ECPGdtype); @@ -539,7 +539,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) if (!get_int_item(lineno, data_var.ind_value, data_var.ind_type, -PQgetisnull(ECPGresult, act_tuple, index))) { va_end(args); - return (false); + return false; } data_var.ind_value = (char *) data_var.ind_value + data_var.ind_offset; ecpg_log("ECPGget_desc: INDICATOR[%d] = %d\n", act_tuple, -PQgetisnull(ECPGresult, act_tuple, index)); @@ -547,7 +547,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) } sqlca->sqlerrd[2] = ntuples; va_end(args); - return (true); + return true; } #undef RETURN_IF_NO_DATA diff --git a/src/interfaces/ecpg/ecpglib/error.c b/src/interfaces/ecpg/ecpglib/error.c index 77d6cc2dae..f34ae4afb8 100644 --- a/src/interfaces/ecpg/ecpglib/error.c +++ b/src/interfaces/ecpg/ecpglib/error.c @@ -286,23 +286,23 @@ ecpg_check_PQresult(PGresult *results, int lineno, PGconn *connection, enum COMP { ecpg_log("ecpg_check_PQresult on line %d: no result - %s", lineno, PQerrorMessage(connection)); ecpg_raise_backend(lineno, NULL, connection, compat); - return (false); + return false; } switch (PQresultStatus(results)) { case PGRES_TUPLES_OK: - return (true); + return true; break; case PGRES_EMPTY_QUERY: /* do nothing */ ecpg_raise(lineno, ECPG_EMPTY, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, NULL); PQclear(results); - return (false); + return false; break; case PGRES_COMMAND_OK: - return (true); + return true; break; case PGRES_NONFATAL_ERROR: case PGRES_FATAL_ERROR: @@ -310,23 +310,23 @@ ecpg_check_PQresult(PGresult *results, int lineno, PGconn *connection, enum COMP ecpg_log("ecpg_check_PQresult on line %d: bad response - %s", lineno, PQresultErrorMessage(results)); ecpg_raise_backend(lineno, results, connection, compat); PQclear(results); - return (false); + return false; break; case PGRES_COPY_OUT: - return (true); + return true; break; case PGRES_COPY_IN: ecpg_log("ecpg_check_PQresult on line %d: COPY IN data transfer in progress\n", lineno); PQendcopy(connection); PQclear(results); - return (false); + return false; break; default: ecpg_log("ecpg_check_PQresult on line %d: unknown execution status type\n", lineno); ecpg_raise_backend(lineno, results, connection, compat); PQclear(results); - return (false); + return false; break; } } diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c index 03c55d3593..50f831aa2b 100644 --- a/src/interfaces/ecpg/ecpglib/execute.c +++ b/src/interfaces/ecpg/ecpglib/execute.c @@ -58,7 +58,7 @@ quote_postgres(char *arg, bool quote, int lineno) buffer_len = 2 * length + 1; res = (char *) ecpg_alloc(buffer_len + 3, lineno); if (!res) - return (res); + return res; escaped_len = PQescapeString(res + 1, arg, buffer_len); if (length == escaped_len) { @@ -151,13 +151,13 @@ ecpg_type_infocache_push(struct ECPGtype_information_cache **cache, int oid, enu = (struct ECPGtype_information_cache *) ecpg_alloc(sizeof(struct ECPGtype_information_cache), lineno); if (new_entry == NULL) - return (false); + return false; new_entry->oid = oid; new_entry->isarray = isarray; new_entry->next = *cache; *cache = new_entry; - return (true); + return true; } static enum ARRAY_TYPE @@ -178,89 +178,89 @@ ecpg_is_type_an_array(int type, const struct statement *stmt, const struct varia /* populate cache with well known types to speed things up */ if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), BOOLOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), BYTEAOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), CHAROID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), NAMEOID, not_an_array_in_ecpg, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INT8OID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INT2OID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INT2VECTOROID, ECPG_ARRAY_VECTOR, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INT4OID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), REGPROCOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TEXTOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), OIDOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TIDOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), XIDOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), CIDOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), OIDVECTOROID, ECPG_ARRAY_VECTOR, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), POINTOID, ECPG_ARRAY_VECTOR, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), LSEGOID, ECPG_ARRAY_VECTOR, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), PATHOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), BOXOID, ECPG_ARRAY_VECTOR, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), POLYGONOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), LINEOID, ECPG_ARRAY_VECTOR, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), FLOAT4OID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), FLOAT8OID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), ABSTIMEOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), RELTIMEOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TINTERVALOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), UNKNOWNOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), CIRCLEOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), CASHOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INETOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), CIDROID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), BPCHAROID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), VARCHAROID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), DATEOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TIMEOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TIMESTAMPOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TIMESTAMPTZOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INTERVALOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TIMETZOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), ZPBITOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), VARBITOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), NUMERICOID, ECPG_ARRAY_NONE, stmt->lineno)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; } for (cache_entry = (stmt->connection->cache_head); cache_entry != NULL; cache_entry = cache_entry->next) @@ -271,13 +271,13 @@ ecpg_is_type_an_array(int type, const struct statement *stmt, const struct varia array_query = (char *) ecpg_alloc(strlen("select typlen from pg_type where oid= and typelem<>0") + 11, stmt->lineno); if (array_query == NULL) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; sprintf(array_query, "select typlen from pg_type where oid=%d and typelem<>0", type); query = PQexec(stmt->connection->connection, array_query); ecpg_free(array_query); if (!ecpg_check_PQresult(query, stmt->lineno, stmt->connection->connection, stmt->compat)) - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; else if (PQresultStatus(query) == PGRES_TUPLES_OK) { if (PQntuples(query) == 0) @@ -297,7 +297,7 @@ ecpg_is_type_an_array(int type, const struct statement *stmt, const struct varia PQclear(query); } else - return (ECPG_ARRAY_ERROR); + return ECPG_ARRAY_ERROR; ecpg_type_infocache_push(&(stmt->connection->cache_head), type, isarray, stmt->lineno); ecpg_log("ecpg_is_type_an_array on line %d: type (%d); C (%d); array (%s)\n", stmt->lineno, type, var->type, ECPG_IS_ARRAY(isarray) ? "yes" : "no"); @@ -1486,7 +1486,7 @@ ecpg_process_output(struct statement *stmt, bool clear_result) { ecpg_raise(stmt->lineno, ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL); - return (false); + return false; } var = stmt->outlist; @@ -1654,7 +1654,7 @@ ecpg_process_output(struct statement *stmt, bool clear_result) else if (!INFORMIX_MODE(stmt->compat)) { ecpg_raise(stmt->lineno, ECPG_TOO_FEW_ARGUMENTS, ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_TARGETS, NULL); - return (false); + return false; } } @@ -1830,7 +1830,7 @@ ecpg_do_prologue(int lineno, const int compat, const int force_indicator, { ecpg_raise(lineno, ECPG_INVALID_STMT, ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME, stmt->command); ecpg_do_epilogue(stmt); - return (false); + return false; } } diff --git a/src/interfaces/ecpg/ecpglib/memory.c b/src/interfaces/ecpg/ecpglib/memory.c index a7268bb0f6..dc548a4cda 100644 --- a/src/interfaces/ecpg/ecpglib/memory.c +++ b/src/interfaces/ecpg/ecpglib/memory.c @@ -26,7 +26,7 @@ ecpg_alloc(long size, int lineno) return NULL; } - return (new); + return new; } char * @@ -40,7 +40,7 @@ ecpg_realloc(void *ptr, long size, int lineno) return NULL; } - return (new); + return new; } char * @@ -58,7 +58,7 @@ ecpg_strdup(const char *string, int lineno) return NULL; } - return (new); + return new; } /* keep a list of memory we allocated for the user */ diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c index edd7302d54..2084d7fe60 100644 --- a/src/interfaces/ecpg/ecpglib/misc.c +++ b/src/interfaces/ecpg/ecpglib/misc.c @@ -110,7 +110,7 @@ ecpg_init(const struct connection *con, const char *connection_name, const int l { ecpg_raise(lineno, ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL); - return (false); + return false; } ecpg_init_sqlca(sqlca); @@ -118,10 +118,10 @@ ecpg_init(const struct connection *con, const char *connection_name, const int l { ecpg_raise(lineno, ECPG_NO_CONN, ECPG_SQLSTATE_CONNECTION_DOES_NOT_EXIST, connection_name ? connection_name : ecpg_gettext("NULL")); - return (false); + return false; } - return (true); + return true; } #ifdef ENABLE_THREAD_SAFETY @@ -155,9 +155,9 @@ ECPGget_sqlca(void) ecpg_init_sqlca(sqlca); pthread_setspecific(sqlca_key, sqlca); } - return (sqlca); + return sqlca; #else - return (&sqlca); + return &sqlca; #endif } @@ -167,7 +167,7 @@ ECPGstatus(int lineno, const char *connection_name) struct connection *con = ecpg_get_connection(connection_name); if (!ecpg_init(con, connection_name, lineno)) - return (false); + return false; /* are we connected? */ if (con->connection == NULL) @@ -176,7 +176,7 @@ ECPGstatus(int lineno, const char *connection_name) return false; } - return (true); + return true; } PGTransactionStatusType @@ -202,7 +202,7 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction) struct connection *con = ecpg_get_connection(connection_name); if (!ecpg_init(con, connection_name, lineno)) - return (false); + return false; ecpg_log("ECPGtrans on line %d: action \"%s\"; connection \"%s\"\n", lineno, transaction, con ? con->name : "null"); @@ -419,10 +419,10 @@ ECPGis_noind_null(enum ECPGttype type, void *ptr) break; #endif /* HAVE_LONG_LONG_INT */ case ECPGt_float: - return (_check(ptr, sizeof(float))); + return _check(ptr, sizeof(float)); break; case ECPGt_double: - return (_check(ptr, sizeof(double))); + return _check(ptr, sizeof(double)); break; case ECPGt_varchar: if (*(((struct ECPGgeneric_varchar *) ptr)->arr) == 0x00) @@ -437,10 +437,10 @@ ECPGis_noind_null(enum ECPGttype type, void *ptr) return true; break; case ECPGt_interval: - return (_check(ptr, sizeof(interval))); + return _check(ptr, sizeof(interval)); break; case ECPGt_timestamp: - return (_check(ptr, sizeof(timestamp))); + return _check(ptr, sizeof(timestamp)); break; default: break; diff --git a/src/interfaces/ecpg/ecpglib/prepare.c b/src/interfaces/ecpg/ecpglib/prepare.c index 151aa80dc6..e76b645024 100644 --- a/src/interfaces/ecpg/ecpglib/prepare.c +++ b/src/interfaces/ecpg/ecpglib/prepare.c @@ -42,7 +42,7 @@ isvarchar(unsigned char c) if (c >= 128) return true; - return (false); + return false; } static bool @@ -371,7 +371,7 @@ SearchStmtCache(const char *ecpgQuery) if (entIx >= stmtCacheEntPerBucket) entNo = 0; - return (entNo); + return entNo; } /* @@ -389,14 +389,14 @@ ecpg_freeStmtCacheEntry(int lineno, int compat, int entNo) /* entry # to free */ entry = &stmtCacheEntries[entNo]; if (!entry->stmtID[0]) /* return if the entry isn't in use */ - return (0); + return 0; con = ecpg_get_connection(entry->connection); /* free the 'prepared_statement' list entry */ this = ecpg_find_prepared_statement(entry->stmtID, con, &prev); if (this && !deallocate_one(lineno, compat, con, prev, this)) - return (-1); + return -1; entry->stmtID[0] = '\0'; @@ -407,7 +407,7 @@ ecpg_freeStmtCacheEntry(int lineno, int compat, int entNo) /* entry # to free */ entry->ecpgQuery = 0; } - return (entNo); + return entNo; } /* @@ -450,7 +450,7 @@ AddStmtToCache(int lineno, /* line # of statement */ /* 'entNo' is the entry to use - make sure its free */ if (ecpg_freeStmtCacheEntry(lineno, compat, entNo) < 0) - return (-1); + return -1; /* add the query to the entry */ entry = &stmtCacheEntries[entNo]; @@ -460,7 +460,7 @@ AddStmtToCache(int lineno, /* line # of statement */ entry->execs = 0; memcpy(entry->stmtID, stmtID, sizeof(entry->stmtID)); - return (entNo); + return entNo; } /* handle cache and preparation of statements in auto-prepare mode */ @@ -487,7 +487,7 @@ ecpg_auto_prepare(int lineno, const char *connection_name, const int compat, cha prep = ecpg_find_prepared_statement(stmtID, con, NULL); /* This prepared name doesn't exist on this connection. */ if (!prep && !prepare_common(lineno, con, stmtID, query)) - return (false); + return false; *name = ecpg_strdup(stmtID, lineno); } @@ -501,9 +501,9 @@ ecpg_auto_prepare(int lineno, const char *connection_name, const int compat, cha sprintf(stmtID, "ecpg%d", nextStmtID++); if (!ECPGprepare(lineno, connection_name, 0, stmtID, query)) - return (false); + return false; if (AddStmtToCache(lineno, stmtID, connection_name, compat, query) < 0) - return (false); + return false; *name = ecpg_strdup(stmtID, lineno); } @@ -511,5 +511,5 @@ ecpg_auto_prepare(int lineno, const char *connection_name, const int compat, cha /* increase usage counter */ stmtCacheEntries[entNo].execs++; - return (true); + return true; } diff --git a/src/interfaces/ecpg/pgtypeslib/common.c b/src/interfaces/ecpg/pgtypeslib/common.c index 9084fd06b4..ae29b6c4ab 100644 --- a/src/interfaces/ecpg/pgtypeslib/common.c +++ b/src/interfaces/ecpg/pgtypeslib/common.c @@ -12,7 +12,7 @@ pgtypes_alloc(long size) if (!new) errno = ENOMEM; - return (new); + return new; } char * @@ -22,7 +22,7 @@ pgtypes_strdup(const char *str) if (!new) errno = ENOMEM; - return (new); + return new; } int diff --git a/src/interfaces/ecpg/pgtypeslib/numeric.c b/src/interfaces/ecpg/pgtypeslib/numeric.c index a93d074de2..a8619168ff 100644 --- a/src/interfaces/ecpg/pgtypeslib/numeric.c +++ b/src/interfaces/ecpg/pgtypeslib/numeric.c @@ -40,7 +40,7 @@ apply_typmod(numeric *var, long typmod) /* Do nothing if we have a default typmod (-1) */ if (typmod < (long) (VARHDRSZ)) - return (0); + return 0; typmod -= VARHDRSZ; precision = (typmod >> 16) & 0xffff; @@ -100,7 +100,7 @@ apply_typmod(numeric *var, long typmod) var->rscale = scale; var->dscale = scale; - return (0); + return 0; } #endif @@ -296,7 +296,7 @@ set_var_from_str(char *str, char **ptr, numeric *dest) dest->weight = 0; dest->rscale = dest->dscale; - return (0); + return 0; } @@ -412,16 +412,16 @@ PGTYPESnumeric_from_asc(char *str, char **endptr) char **ptr = (endptr != NULL) ? endptr : &realptr; if (!value) - return (NULL); + return NULL; ret = set_var_from_str(str, ptr, value); if (ret) { PGTYPESnumeric_free(value); - return (NULL); + return NULL; } - return (value); + return value; } char * @@ -445,7 +445,7 @@ PGTYPESnumeric_to_asc(numeric *num, int dscale) /* get_str_from_var may change its argument */ s = get_str_from_var(numcopy, dscale); PGTYPESnumeric_free(numcopy); - return (s); + return s; } /* ---------- diff --git a/src/interfaces/ecpg/pgtypeslib/timestamp.c b/src/interfaces/ecpg/pgtypeslib/timestamp.c index 78931399e6..fa5b32ed9d 100644 --- a/src/interfaces/ecpg/pgtypeslib/timestamp.c +++ b/src/interfaces/ecpg/pgtypeslib/timestamp.c @@ -224,14 +224,14 @@ PGTYPEStimestamp_from_asc(char *str, char **endptr) if (strlen(str) > MAXDATELEN) { errno = PGTYPES_TS_BAD_TIMESTAMP; - return (noresult); + return noresult; } if (ParseDateTime(str, lowstr, field, ftype, &nf, ptr) != 0 || DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, 0) != 0) { errno = PGTYPES_TS_BAD_TIMESTAMP; - return (noresult); + return noresult; } switch (dtype) @@ -240,7 +240,7 @@ PGTYPEStimestamp_from_asc(char *str, char **endptr) if (tm2timestamp(tm, fsec, NULL, &result) != 0) { errno = PGTYPES_TS_BAD_TIMESTAMP; - return (noresult); + return noresult; } break; @@ -258,11 +258,11 @@ PGTYPEStimestamp_from_asc(char *str, char **endptr) case DTK_INVALID: errno = PGTYPES_TS_BAD_TIMESTAMP; - return (noresult); + return noresult; default: errno = PGTYPES_TS_BAD_TIMESTAMP; - return (noresult); + return noresult; } /* AdjustTimestampForTypmod(&result, typmod); */ diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c index bad0a667fc..536185fa1c 100644 --- a/src/interfaces/ecpg/preproc/ecpg.c +++ b/src/interfaces/ecpg/preproc/ecpg.c @@ -137,7 +137,7 @@ main(int argc, char *const argv[]) if (find_my_exec(argv[0], my_exec_path) < 0) { fprintf(stderr, _("%s: could not locate my own executable path\n"), argv[0]); - return (ILLEGAL_OPTION); + return ILLEGAL_OPTION; } if (argc > 1) @@ -266,7 +266,7 @@ main(int argc, char *const argv[]) { fprintf(stderr, _("%s: no input files specified\n"), progname); fprintf(stderr, _("Try \"%s --help\" for more information.\n"), argv[0]); - return (ILLEGAL_OPTION); + return ILLEGAL_OPTION; } else { diff --git a/src/interfaces/ecpg/preproc/ecpg.header b/src/interfaces/ecpg/preproc/ecpg.header index 2562366bbe..e28d7e694d 100644 --- a/src/interfaces/ecpg/preproc/ecpg.header +++ b/src/interfaces/ecpg/preproc/ecpg.header @@ -142,7 +142,7 @@ cat2_str(char *str1, char *str2) strcat(res_str, str2); free(str1); free(str2); - return(res_str); + return res_str; } static char * @@ -162,7 +162,7 @@ cat_str(int count, ...) va_end(args); - return(res_str); + return res_str; } static char * @@ -174,7 +174,7 @@ make2_str(char *str1, char *str2) strcat(res_str, str2); free(str1); free(str2); - return(res_str); + return res_str; } static char * @@ -188,7 +188,7 @@ make3_str(char *str1, char *str2, char *str3) free(str1); free(str2); free(str3); - return(res_str); + return res_str; } /* and the rest */ @@ -233,7 +233,7 @@ create_questionmarks(char *name, bool array) /* removed the trailing " ," */ result[strlen(result)-3] = '\0'; - return(result); + return result; } static char * diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l index 3598a200d0..f08cfedeb0 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -768,7 +768,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ } <SQL>:{identifier}((("->"|\.){identifier})|(\[{array}\]))* { base_yylval.str = mm_strdup(yytext+1); - return(CVARIABLE); + return CVARIABLE; } <SQL>{identifier} { const ScanKeyword *keyword; @@ -832,7 +832,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ else { base_yylval.str = mm_strdup(yytext); - return(CPP_LINE); + return CPP_LINE; } } <C>{cppinclude_next} { @@ -844,12 +844,12 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ else { base_yylval.str = mm_strdup(yytext); - return(CPP_LINE); + return CPP_LINE; } } <C,SQL>{cppline} { base_yylval.str = mm_strdup(yytext); - return(CPP_LINE); + return CPP_LINE; } <C>{identifier} { const ScanKeyword *keyword; @@ -879,38 +879,38 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ } } <C>{xcstop} { mmerror(PARSE_ERROR, ET_ERROR, "nested /* ... */ comments"); } -<C>":" { return(':'); } -<C>";" { return(';'); } -<C>"," { return(','); } -<C>"*" { return('*'); } -<C>"%" { return('%'); } -<C>"/" { return('/'); } -<C>"+" { return('+'); } -<C>"-" { return('-'); } -<C>"(" { parenths_open++; return('('); } -<C>")" { parenths_open--; return(')'); } +<C>":" { return ':'; } +<C>";" { return ';'; } +<C>"," { return ','; } +<C>"*" { return '*'; } +<C>"%" { return '%'; } +<C>"/" { return '/'; } +<C>"+" { return '+'; } +<C>"-" { return '-'; } +<C>"(" { parenths_open++; return '('; } +<C>")" { parenths_open--; return ')'; } <C,xskip>{space} { ECHO; } -<C>\{ { return('{'); } -<C>\} { return('}'); } -<C>\[ { return('['); } -<C>\] { return(']'); } -<C>\= { return('='); } -<C>"->" { return(S_MEMBER); } -<C>">>" { return(S_RSHIFT); } -<C>"<<" { return(S_LSHIFT); } -<C>"||" { return(S_OR); } -<C>"&&" { return(S_AND); } -<C>"++" { return(S_INC); } -<C>"--" { return(S_DEC); } -<C>"==" { return(S_EQUAL); } -<C>"!=" { return(S_NEQUAL); } -<C>"+=" { return(S_ADD); } -<C>"-=" { return(S_SUB); } -<C>"*=" { return(S_MUL); } -<C>"/=" { return(S_DIV); } -<C>"%=" { return(S_MOD); } -<C>"->*" { return(S_MEMPOINT); } -<C>".*" { return(S_DOTPOINT); } +<C>\{ { return '{'; } +<C>\} { return '}'; } +<C>\[ { return '['; } +<C>\] { return ']'; } +<C>\= { return '='; } +<C>"->" { return S_MEMBER; } +<C>">>" { return S_RSHIFT; } +<C>"<<" { return S_LSHIFT; } +<C>"||" { return S_OR; } +<C>"&&" { return S_AND; } +<C>"++" { return S_INC; } +<C>"--" { return S_DEC; } +<C>"==" { return S_EQUAL; } +<C>"!=" { return S_NEQUAL; } +<C>"+=" { return S_ADD; } +<C>"-=" { return S_SUB; } +<C>"*=" { return S_MUL; } +<C>"/=" { return S_DIV; } +<C>"%=" { return S_MOD; } +<C>"->*" { return S_MEMPOINT; } +<C>".*" { return S_DOTPOINT; } <C>{other} { return S_ANYTHING; } <C>{exec_sql}{define}{space}* { BEGIN(def_ident); } <C>{informix_special}{define}{space}* { diff --git a/src/interfaces/ecpg/preproc/type.c b/src/interfaces/ecpg/preproc/type.c index 750cdf9c7c..256a3c395c 100644 --- a/src/interfaces/ecpg/preproc/type.c +++ b/src/interfaces/ecpg/preproc/type.c @@ -69,7 +69,7 @@ ECPGstruct_member_dup(struct ECPGstruct_member *rm) rm = rm->next; } - return (new); + return new; } /* The NAME argument is copied. The type argument is preserved as a pointer. */ @@ -135,78 +135,78 @@ get_type(enum ECPGttype type) switch (type) { case ECPGt_char: - return ("ECPGt_char"); + return "ECPGt_char"; break; case ECPGt_unsigned_char: - return ("ECPGt_unsigned_char"); + return "ECPGt_unsigned_char"; break; case ECPGt_short: - return ("ECPGt_short"); + return "ECPGt_short"; break; case ECPGt_unsigned_short: - return ("ECPGt_unsigned_short"); + return "ECPGt_unsigned_short"; break; case ECPGt_int: - return ("ECPGt_int"); + return "ECPGt_int"; break; case ECPGt_unsigned_int: - return ("ECPGt_unsigned_int"); + return "ECPGt_unsigned_int"; break; case ECPGt_long: - return ("ECPGt_long"); + return "ECPGt_long"; break; case ECPGt_unsigned_long: - return ("ECPGt_unsigned_long"); + return "ECPGt_unsigned_long"; break; case ECPGt_long_long: - return ("ECPGt_long_long"); + return "ECPGt_long_long"; break; case ECPGt_unsigned_long_long: - return ("ECPGt_unsigned_long_long"); + return "ECPGt_unsigned_long_long"; break; case ECPGt_float: - return ("ECPGt_float"); + return "ECPGt_float"; break; case ECPGt_double: - return ("ECPGt_double"); + return "ECPGt_double"; break; case ECPGt_bool: - return ("ECPGt_bool"); + return "ECPGt_bool"; break; case ECPGt_varchar: - return ("ECPGt_varchar"); + return "ECPGt_varchar"; case ECPGt_NO_INDICATOR: /* no indicator */ - return ("ECPGt_NO_INDICATOR"); + return "ECPGt_NO_INDICATOR"; break; case ECPGt_char_variable: /* string that should not be quoted */ - return ("ECPGt_char_variable"); + return "ECPGt_char_variable"; break; case ECPGt_const: /* constant string quoted */ - return ("ECPGt_const"); + return "ECPGt_const"; break; case ECPGt_decimal: - return ("ECPGt_decimal"); + return "ECPGt_decimal"; break; case ECPGt_numeric: - return ("ECPGt_numeric"); + return "ECPGt_numeric"; break; case ECPGt_interval: - return ("ECPGt_interval"); + return "ECPGt_interval"; break; case ECPGt_descriptor: - return ("ECPGt_descriptor"); + return "ECPGt_descriptor"; break; case ECPGt_sqlda: - return ("ECPGt_sqlda"); + return "ECPGt_sqlda"; break; case ECPGt_date: - return ("ECPGt_date"); + return "ECPGt_date"; break; case ECPGt_timestamp: - return ("ECPGt_timestamp"); + return "ECPGt_timestamp"; break; case ECPGt_string: - return ("ECPGt_string"); + return "ECPGt_string"; break; default: mmerror(PARSE_ERROR, ET_ERROR, "unrecognized variable type code %d", type); @@ -674,51 +674,51 @@ get_dtype(enum ECPGdtype type) switch (type) { case ECPGd_count: - return ("ECPGd_countr"); + return "ECPGd_countr"; break; case ECPGd_data: - return ("ECPGd_data"); + return "ECPGd_data"; break; case ECPGd_di_code: - return ("ECPGd_di_code"); + return "ECPGd_di_code"; break; case ECPGd_di_precision: - return ("ECPGd_di_precision"); + return "ECPGd_di_precision"; break; case ECPGd_indicator: - return ("ECPGd_indicator"); + return "ECPGd_indicator"; break; case ECPGd_key_member: - return ("ECPGd_key_member"); + return "ECPGd_key_member"; break; case ECPGd_length: - return ("ECPGd_length"); + return "ECPGd_length"; break; case ECPGd_name: - return ("ECPGd_name"); + return "ECPGd_name"; break; case ECPGd_nullable: - return ("ECPGd_nullable"); + return "ECPGd_nullable"; break; case ECPGd_octet: - return ("ECPGd_octet"); + return "ECPGd_octet"; break; case ECPGd_precision: - return ("ECPGd_precision"); + return "ECPGd_precision"; break; case ECPGd_ret_length: - return ("ECPGd_ret_length"); + return "ECPGd_ret_length"; case ECPGd_ret_octet: - return ("ECPGd_ret_octet"); + return "ECPGd_ret_octet"; break; case ECPGd_scale: - return ("ECPGd_scale"); + return "ECPGd_scale"; break; case ECPGd_type: - return ("ECPGd_type"); + return "ECPGd_type"; break; case ECPGd_cardinality: - return ("ECPGd_cardinality"); + return "ECPGd_cardinality"; default: mmerror(PARSE_ERROR, ET_ERROR, "unrecognized descriptor item code %d", type); } diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c index 31225738e0..39bf3b2474 100644 --- a/src/interfaces/ecpg/preproc/variable.c +++ b/src/interfaces/ecpg/preproc/variable.c @@ -18,7 +18,7 @@ new_variable(const char *name, struct ECPGtype *type, int brace_level) p->next = allvariables; allvariables = p; - return (p); + return p; } static struct variable * @@ -44,12 +44,12 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member *members, int switch (members->type->type) { case ECPGt_array: - return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->counter), members->type->size), brace_level)); + return new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->counter), members->type->size), brace_level); case ECPGt_struct: case ECPGt_union: - return (new_variable(name, ECPGmake_struct_type(members->type->u.members, members->type->type, members->type->type_name, members->type->struct_sizeof), brace_level)); + return new_variable(name, ECPGmake_struct_type(members->type->u.members, members->type->type, members->type->type_name, members->type->struct_sizeof), brace_level); default: - return (new_variable(name, ECPGmake_simple_type(members->type->type, members->type->size, members->type->counter), brace_level)); + return new_variable(name, ECPGmake_simple_type(members->type->type, members->type->size, members->type->counter), brace_level); } } else @@ -91,26 +91,26 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member *members, int switch (members->type->u.element->type) { case ECPGt_array: - return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->u.element->type, members->type->u.element->u.element->size, members->type->u.element->u.element->counter), members->type->u.element->size), brace_level)); + return new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->u.element->type, members->type->u.element->u.element->size, members->type->u.element->u.element->counter), members->type->u.element->size), brace_level); case ECPGt_struct: case ECPGt_union: - return (new_variable(name, ECPGmake_struct_type(members->type->u.element->u.members, members->type->u.element->type, members->type->u.element->type_name, members->type->u.element->struct_sizeof), brace_level)); + return new_variable(name, ECPGmake_struct_type(members->type->u.element->u.members, members->type->u.element->type, members->type->u.element->type_name, members->type->u.element->struct_sizeof), brace_level); default: - return (new_variable(name, ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->counter), brace_level)); + return new_variable(name, ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->counter), brace_level); } break; case '-': if (members->type->type == ECPGt_array) - return (find_struct_member(name, ++end, members->type->u.element->u.members, brace_level)); + return find_struct_member(name, ++end, members->type->u.element->u.members, brace_level); else - return (find_struct_member(name, ++end, members->type->u.members, brace_level)); + return find_struct_member(name, ++end, members->type->u.members, brace_level); break; break; case '.': if (members->type->type == ECPGt_array) - return (find_struct_member(name, end, members->type->u.element->u.members, brace_level)); + return find_struct_member(name, end, members->type->u.element->u.members, brace_level); else - return (find_struct_member(name, end, members->type->u.members, brace_level)); + return find_struct_member(name, end, members->type->u.members, brace_level); break; default: mmfatal(PARSE_ERROR, "incorrectly formed variable \"%s\"", name); @@ -120,7 +120,7 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member *members, int } } - return (NULL); + return NULL; } static struct variable * @@ -185,7 +185,7 @@ find_simple(char *name) return p; } - return (NULL); + return NULL; } /* Note that this function will end the program in case of an unknown */ @@ -236,12 +236,12 @@ find_variable(char *name) switch (p->type->u.element->type) { case ECPGt_array: - return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(p->type->u.element->u.element->type, p->type->u.element->u.element->size, p->type->u.element->u.element->counter), p->type->u.element->size), p->brace_level)); + return new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(p->type->u.element->u.element->type, p->type->u.element->u.element->size, p->type->u.element->u.element->counter), p->type->u.element->size), p->brace_level); case ECPGt_struct: case ECPGt_union: - return (new_variable(name, ECPGmake_struct_type(p->type->u.element->u.members, p->type->u.element->type, p->type->u.element->type_name, p->type->u.element->struct_sizeof), p->brace_level)); + return new_variable(name, ECPGmake_struct_type(p->type->u.element->u.members, p->type->u.element->type, p->type->u.element->type_name, p->type->u.element->struct_sizeof), p->brace_level); default: - return (new_variable(name, ECPGmake_simple_type(p->type->u.element->type, p->type->u.element->size, p->type->u.element->counter), p->brace_level)); + return new_variable(name, ECPGmake_simple_type(p->type->u.element->type, p->type->u.element->size, p->type->u.element->counter), p->brace_level); } } } @@ -254,7 +254,7 @@ find_variable(char *name) if (p == NULL) mmfatal(PARSE_ERROR, "variable \"%s\" is not declared", name); - return (p); + return p; } void @@ -505,7 +505,7 @@ get_typedef(char *name) if (!this) mmfatal(PARSE_ERROR, "unrecognized data type name \"%s\"", name); - return (this); + return this; } void diff --git a/src/test/isolation/specscanner.l b/src/test/isolation/specscanner.l index aed9269c63..a9528bda6b 100644 --- a/src/test/isolation/specscanner.l +++ b/src/test/isolation/specscanner.l @@ -39,11 +39,11 @@ comment ("#"{non_newline}*) %% -permutation { return(PERMUTATION); } -session { return(SESSION); } -setup { return(SETUP); } -step { return(STEP); } -teardown { return(TEARDOWN); } +permutation { return PERMUTATION; } +session { return SESSION; } +setup { return SETUP; } +step { return STEP; } +teardown { return TEARDOWN; } [\n] { yyline++; } {comment} { /* ignore */ } -- 2.14.1
0004-Remove-unnecessary-casts.patch (text/plain, 1.2K) download From 2aec824bd498cbe301b86acc1e686a22210126e6 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter_e@gmx.net> Date: Thu, 17 Aug 2017 12:39:20 -0400 Subject: [PATCH 4/6] Remove unnecessary casts --- contrib/cube/cube.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c index 0e968d1c76..1032b997f9 100644 --- a/contrib/cube/cube.c +++ b/contrib/cube/cube.c @@ -609,18 +609,18 @@ g_cube_leaf_consistent(NDBOX *key, switch (strategy) { case RTOverlapStrategyNumber: - retval = (bool) cube_overlap_v0(key, query); + retval = cube_overlap_v0(key, query); break; case RTSameStrategyNumber: - retval = (bool) (cube_cmp_v0(key, query) == 0); + retval = (cube_cmp_v0(key, query) == 0); break; case RTContainsStrategyNumber: case RTOldContainsStrategyNumber: - retval = (bool) cube_contains_v0(key, query); + retval = cube_contains_v0(key, query); break; case RTContainedByStrategyNumber: case RTOldContainedByStrategyNumber: - retval = (bool) cube_contains_v0(query, key); + retval = cube_contains_v0(query, key); break; default: retval = FALSE; -- 2.14.1
0005-Remove-endof-macro.patch (text/plain, 1.5K) download From 509af15852c5bb05d23a3ea8159aadf2272516ad Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter_e@gmx.net> Date: Thu, 17 Aug 2017 12:39:20 -0400 Subject: [PATCH 5/6] Remove endof macro It has not been used in a long time, and it doesn't seem safe anyway, so drop it. --- src/include/c.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/include/c.h b/src/include/c.h index c28534bc88..fd0a6ad0c3 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -30,7 +30,7 @@ * 2) bool, true, false, TRUE, FALSE * 3) standard system types * 4) IsValid macros for system types - * 5) offsetof, lengthof, endof, alignment + * 5) offsetof, lengthof, alignment * 6) assertions * 7) widely useful macros * 8) random stuff @@ -533,7 +533,7 @@ typedef NameData *Name; /* ---------------------------------------------------------------- - * Section 5: offsetof, lengthof, endof, alignment + * Section 5: offsetof, lengthof, alignment * ---------------------------------------------------------------- */ /* @@ -553,12 +553,6 @@ typedef NameData *Name; */ #define lengthof(array) (sizeof (array) / sizeof ((array)[0])) -/* - * endof - * Address of the element one past the last in an array. - */ -#define endof(array) (&(array)[lengthof(array)]) - /* ---------------- * Alignment macros: align a length or address appropriately for a given type. * The fooALIGN() macros round up to a multiple of the required alignment, -- 2.14.1
0006-Drop-excessive-dereferencing-of-function-pointers.patch (text/plain, 67.8K) download From aa8b02ac5b8dce5893bf22d808698edb4790cd6f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter_e@gmx.net> Date: Thu, 17 Aug 2017 12:39:20 -0400 Subject: [PATCH 6/6] Drop excessive dereferencing of function pointers Remove the excessive punctuation when calling a function through a function pointer. This style was inconsistently applied and seems harder to read. --- contrib/btree_gist/btree_utils_num.c | 34 ++++++++++++------------ contrib/btree_gist/btree_utils_var.c | 44 ++++++++++++++++---------------- contrib/ltree/lquery_op.c | 4 +-- contrib/ltree/ltxtquery_op.c | 2 +- contrib/sepgsql/hooks.c | 6 ++--- contrib/sepgsql/label.c | 8 +++--- src/backend/access/transam/xact.c | 4 +-- src/backend/catalog/objectaccess.c | 10 ++++---- src/backend/commands/analyze.c | 8 +++--- src/backend/commands/explain.c | 4 +-- src/backend/commands/portalcmds.c | 2 +- src/backend/commands/seclabel.c | 2 +- src/backend/commands/user.c | 4 +-- src/backend/executor/execCurrent.c | 2 +- src/backend/executor/execExprInterp.c | 18 ++++++------- src/backend/executor/execMain.c | 16 ++++++------ src/backend/executor/execParallel.c | 2 +- src/backend/executor/execTuples.c | 6 ++--- src/backend/executor/execUtils.c | 2 +- src/backend/executor/functions.c | 2 +- src/backend/libpq/auth.c | 2 +- src/backend/libpq/ifaddr.c | 2 +- src/backend/nodes/params.c | 6 ++--- src/backend/optimizer/path/allpaths.c | 2 +- src/backend/optimizer/plan/planmain.c | 4 +-- src/backend/optimizer/plan/planner.c | 12 ++++----- src/backend/optimizer/prep/prepunion.c | 2 +- src/backend/optimizer/util/plancat.c | 2 +- src/backend/parser/analyze.c | 4 +-- src/backend/parser/parse_coerce.c | 2 +- src/backend/parser/parse_expr.c | 10 ++++---- src/backend/parser/parse_target.c | 4 +-- src/backend/rewrite/rewriteManip.c | 2 +- src/backend/rewrite/rowsecurity.c | 4 +-- src/backend/storage/file/fd.c | 4 +-- src/backend/storage/ipc/ipc.c | 12 ++++----- src/backend/storage/smgr/smgr.c | 44 ++++++++++++++++---------------- src/backend/tcop/postgres.c | 8 +++--- src/backend/tcop/pquery.c | 8 +++--- src/backend/tcop/utility.c | 2 +- src/backend/utils/adt/array_typanalyze.c | 2 +- src/backend/utils/adt/expandeddatum.c | 4 +-- src/backend/utils/adt/json.c | 36 +++++++++++++------------- src/backend/utils/adt/jsonfuncs.c | 2 +- src/backend/utils/adt/selfuncs.c | 12 ++++----- src/backend/utils/cache/catcache.c | 4 +-- src/backend/utils/cache/inval.c | 8 +++--- src/backend/utils/error/elog.c | 6 ++--- src/backend/utils/fmgr/dfmgr.c | 6 ++--- src/backend/utils/fmgr/fmgr.c | 30 +++++++++++----------- src/include/utils/selfuncs.h | 2 +- 51 files changed, 214 insertions(+), 214 deletions(-) diff --git a/contrib/btree_gist/btree_utils_num.c b/contrib/btree_gist/btree_utils_num.c index b2295f2c7d..c2faf8b25a 100644 --- a/contrib/btree_gist/btree_utils_num.c +++ b/contrib/btree_gist/btree_utils_num.c @@ -184,10 +184,10 @@ gbt_num_union(GBT_NUMKEY *out, const GistEntryVector *entryvec, const gbtree_nin c.lower = &cur[0]; c.upper = &cur[tinfo->size]; /* if out->lower > cur->lower, adopt cur as lower */ - if ((*tinfo->f_gt) (o.lower, c.lower, flinfo)) + if (tinfo->f_gt(o.lower, c.lower, flinfo)) memcpy((void *) o.lower, (void *) c.lower, tinfo->size); /* if out->upper < cur->upper, adopt cur as upper */ - if ((*tinfo->f_lt) (o.upper, c.upper, flinfo)) + if (tinfo->f_lt(o.upper, c.upper, flinfo)) memcpy((void *) o.upper, (void *) c.upper, tinfo->size); } @@ -211,8 +211,8 @@ gbt_num_same(const GBT_NUMKEY *a, const GBT_NUMKEY *b, const gbtree_ninfo *tinfo b2.lower = &(((GBT_NUMKEY *) b)[0]); b2.upper = &(((GBT_NUMKEY *) b)[tinfo->size]); - return ((*tinfo->f_eq) (b1.lower, b2.lower, flinfo) && - (*tinfo->f_eq) (b1.upper, b2.upper, flinfo)); + return (tinfo->f_eq(b1.lower, b2.lower, flinfo) && + tinfo->f_eq(b1.upper, b2.upper, flinfo)); } @@ -236,9 +236,9 @@ gbt_num_bin_union(Datum *u, GBT_NUMKEY *e, const gbtree_ninfo *tinfo, FmgrInfo * ur.lower = &(((GBT_NUMKEY *) DatumGetPointer(*u))[0]); ur.upper = &(((GBT_NUMKEY *) DatumGetPointer(*u))[tinfo->size]); - if ((*tinfo->f_gt) ((void *) ur.lower, (void *) rd.lower, flinfo)) + if (tinfo->f_gt((void *) ur.lower, (void *) rd.lower, flinfo)) memcpy((void *) ur.lower, (void *) rd.lower, tinfo->size); - if ((*tinfo->f_lt) ((void *) ur.upper, (void *) rd.upper, flinfo)) + if (tinfo->f_lt((void *) ur.upper, (void *) rd.upper, flinfo)) memcpy((void *) ur.upper, (void *) rd.upper, tinfo->size); } } @@ -264,33 +264,33 @@ gbt_num_consistent(const GBT_NUMKEY_R *key, switch (*strategy) { case BTLessEqualStrategyNumber: - retval = (*tinfo->f_ge) (query, key->lower, flinfo); + retval = tinfo->f_ge(query, key->lower, flinfo); break; case BTLessStrategyNumber: if (is_leaf) - retval = (*tinfo->f_gt) (query, key->lower, flinfo); + retval = tinfo->f_gt(query, key->lower, flinfo); else - retval = (*tinfo->f_ge) (query, key->lower, flinfo); + retval = tinfo->f_ge(query, key->lower, flinfo); break; case BTEqualStrategyNumber: if (is_leaf) - retval = (*tinfo->f_eq) (query, key->lower, flinfo); + retval = tinfo->f_eq(query, key->lower, flinfo); else - retval = ((*tinfo->f_le) (key->lower, query, flinfo) && - (*tinfo->f_le) (query, key->upper, flinfo)); + retval = (tinfo->f_le(key->lower, query, flinfo) && + tinfo->f_le(query, key->upper, flinfo)); break; case BTGreaterStrategyNumber: if (is_leaf) - retval = (*tinfo->f_lt) (query, key->upper, flinfo); + retval = tinfo->f_lt(query, key->upper, flinfo); else - retval = (*tinfo->f_le) (query, key->upper, flinfo); + retval = tinfo->f_le(query, key->upper, flinfo); break; case BTGreaterEqualStrategyNumber: - retval = (*tinfo->f_le) (query, key->upper, flinfo); + retval = tinfo->f_le(query, key->upper, flinfo); break; case BtreeGistNotEqualStrategyNumber: - retval = (!((*tinfo->f_eq) (query, key->lower, flinfo) && - (*tinfo->f_eq) (query, key->upper, flinfo))); + retval = (!(tinfo->f_eq(query, key->lower, flinfo) && + tinfo->f_eq(query, key->upper, flinfo))); break; default: retval = false; diff --git a/contrib/btree_gist/btree_utils_var.c b/contrib/btree_gist/btree_utils_var.c index ecc87f3bb3..586de63a4d 100644 --- a/contrib/btree_gist/btree_utils_var.c +++ b/contrib/btree_gist/btree_utils_var.c @@ -109,7 +109,7 @@ gbt_var_leaf2node(GBT_VARKEY *leaf, const gbtree_vinfo *tinfo, FmgrInfo *flinfo) GBT_VARKEY *out = leaf; if (tinfo->f_l2n) - out = (*tinfo->f_l2n) (leaf, flinfo); + out = tinfo->f_l2n(leaf, flinfo); return out; } @@ -255,13 +255,13 @@ gbt_var_bin_union(Datum *u, GBT_VARKEY *e, Oid collation, nr.lower = ro.lower; nr.upper = ro.upper; - if ((*tinfo->f_cmp) (ro.lower, eo.lower, collation, flinfo) > 0) + if (tinfo->f_cmp(ro.lower, eo.lower, collation, flinfo) > 0) { nr.lower = eo.lower; update = true; } - if ((*tinfo->f_cmp) (ro.upper, eo.upper, collation, flinfo) < 0) + if (tinfo->f_cmp(ro.upper, eo.upper, collation, flinfo) < 0) { nr.upper = eo.upper; update = true; @@ -371,8 +371,8 @@ gbt_var_same(Datum d1, Datum d2, Oid collation, r1 = gbt_var_key_readable(t1); r2 = gbt_var_key_readable(t2); - return ((*tinfo->f_cmp) (r1.lower, r2.lower, collation, flinfo) == 0 && - (*tinfo->f_cmp) (r1.upper, r2.upper, collation, flinfo) == 0); + return (tinfo->f_cmp(r1.lower, r2.lower, collation, flinfo) == 0 && + tinfo->f_cmp(r1.upper, r2.upper, collation, flinfo) == 0); } @@ -400,9 +400,9 @@ gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n, if ((VARSIZE(ok.lower) - VARHDRSZ) == 0 && (VARSIZE(ok.upper) - VARHDRSZ) == 0) *res = 0.0; - else if (!(((*tinfo->f_cmp) (nk.lower, ok.lower, collation, flinfo) >= 0 || + else if (!((tinfo->f_cmp(nk.lower, ok.lower, collation, flinfo) >= 0 || gbt_bytea_pf_match(ok.lower, nk.lower, tinfo)) && - ((*tinfo->f_cmp) (nk.upper, ok.upper, collation, flinfo) <= 0 || + (tinfo->f_cmp(nk.upper, ok.upper, collation, flinfo) <= 0 || gbt_bytea_pf_match(ok.upper, nk.upper, tinfo)))) { Datum d = PointerGetDatum(0); @@ -449,9 +449,9 @@ gbt_vsrt_cmp(const void *a, const void *b, void *arg) const gbt_vsrt_arg *varg = (const gbt_vsrt_arg *) arg; int res; - res = (*varg->tinfo->f_cmp) (ar.lower, br.lower, varg->collation, varg->flinfo); + res = varg->tinfo->f_cmp(ar.lower, br.lower, varg->collation, varg->flinfo); if (res == 0) - return (*varg->tinfo->f_cmp) (ar.upper, br.upper, varg->collation, varg->flinfo); + return varg->tinfo->f_cmp(ar.upper, br.upper, varg->collation, varg->flinfo); return res; } @@ -567,44 +567,44 @@ gbt_var_consistent(GBT_VARKEY_R *key, { case BTLessEqualStrategyNumber: if (is_leaf) - retval = (*tinfo->f_ge) (query, key->lower, collation, flinfo); + retval = tinfo->f_ge(query, key->lower, collation, flinfo); else - retval = (*tinfo->f_cmp) (query, key->lower, collation, flinfo) >= 0 + retval = tinfo->f_cmp(query, key->lower, collation, flinfo) >= 0 || gbt_var_node_pf_match(key, query, tinfo); break; case BTLessStrategyNumber: if (is_leaf) - retval = (*tinfo->f_gt) (query, key->lower, collation, flinfo); + retval = tinfo->f_gt(query, key->lower, collation, flinfo); else - retval = (*tinfo->f_cmp) (query, key->lower, collation, flinfo) >= 0 + retval = tinfo->f_cmp(query, key->lower, collation, flinfo) >= 0 || gbt_var_node_pf_match(key, query, tinfo); break; case BTEqualStrategyNumber: if (is_leaf) - retval = (*tinfo->f_eq) (query, key->lower, collation, flinfo); + retval = tinfo->f_eq(query, key->lower, collation, flinfo); else retval = - ((*tinfo->f_cmp) (key->lower, query, collation, flinfo) <= 0 && - (*tinfo->f_cmp) (query, key->upper, collation, flinfo) <= 0) || + (tinfo->f_cmp(key->lower, query, collation, flinfo) <= 0 && + tinfo->f_cmp(query, key->upper, collation, flinfo) <= 0) || gbt_var_node_pf_match(key, query, tinfo); break; case BTGreaterStrategyNumber: if (is_leaf) - retval = (*tinfo->f_lt) (query, key->upper, collation, flinfo); + retval = tinfo->f_lt(query, key->upper, collation, flinfo); else - retval = (*tinfo->f_cmp) (query, key->upper, collation, flinfo) <= 0 + retval = tinfo->f_cmp(query, key->upper, collation, flinfo) <= 0 || gbt_var_node_pf_match(key, query, tinfo); break; case BTGreaterEqualStrategyNumber: if (is_leaf) - retval = (*tinfo->f_le) (query, key->upper, collation, flinfo); + retval = tinfo->f_le(query, key->upper, collation, flinfo); else - retval = (*tinfo->f_cmp) (query, key->upper, collation, flinfo) <= 0 + retval = tinfo->f_cmp(query, key->upper, collation, flinfo) <= 0 || gbt_var_node_pf_match(key, query, tinfo); break; case BtreeGistNotEqualStrategyNumber: - retval = !((*tinfo->f_eq) (query, key->lower, collation, flinfo) && - (*tinfo->f_eq) (query, key->upper, collation, flinfo)); + retval = !(tinfo->f_eq(query, key->lower, collation, flinfo) && + tinfo->f_eq(query, key->upper, collation, flinfo)); break; default: retval = FALSE; diff --git a/contrib/ltree/lquery_op.c b/contrib/ltree/lquery_op.c index 229ddd0ae3..9b69a288b2 100644 --- a/contrib/ltree/lquery_op.c +++ b/contrib/ltree/lquery_op.c @@ -70,7 +70,7 @@ bool lent == lenq || (lent > lenq && anyend) ) && - (*cmpptr) (qn, tn, lenq) == 0) + cmpptr(qn, tn, lenq) == 0) { isok = true; @@ -123,7 +123,7 @@ checkLevel(lquery_level *curq, ltree_level *curt) curvar->len == curt->len || (curt->len > curvar->len && (curvar->flag & LVAR_ANYEND)) ) && - (*cmpptr) (curvar->name, curt->name, curvar->len) == 0) + cmpptr(curvar->name, curt->name, curvar->len) == 0) { return true; diff --git a/contrib/ltree/ltxtquery_op.c b/contrib/ltree/ltxtquery_op.c index 1428c8b478..222a093f8a 100644 --- a/contrib/ltree/ltxtquery_op.c +++ b/contrib/ltree/ltxtquery_op.c @@ -73,7 +73,7 @@ checkcondition_str(void *checkval, ITEM *val) val->length == level->len || (level->len > val->length && (val->flag & LVAR_ANYEND)) ) && - (*cmpptr) (op, level->name, val->length) == 0) + cmpptr(op, level->name, val->length) == 0) return true; tlen--; diff --git a/contrib/sepgsql/hooks.c b/contrib/sepgsql/hooks.c index 5daa60c412..b99e995d46 100644 --- a/contrib/sepgsql/hooks.c +++ b/contrib/sepgsql/hooks.c @@ -92,7 +92,7 @@ sepgsql_object_access(ObjectAccessType access, void *arg) { if (next_object_access_hook) - (*next_object_access_hook) (access, classId, objectId, subId, arg); + next_object_access_hook(access, classId, objectId, subId, arg); switch (access) { @@ -282,7 +282,7 @@ sepgsql_exec_check_perms(List *rangeTabls, bool abort) * least, we don't need to check any more. */ if (next_exec_check_perms_hook && - !(*next_exec_check_perms_hook) (rangeTabls, abort)) + !next_exec_check_perms_hook(rangeTabls, abort)) return false; if (!sepgsql_dml_privileges(rangeTabls, abort)) @@ -365,7 +365,7 @@ sepgsql_utility_command(PlannedStmt *pstmt, } if (next_ProcessUtility_hook) - (*next_ProcessUtility_hook) (pstmt, queryString, + next_ProcessUtility_hook(pstmt, queryString, context, params, queryEnv, dest, completionTag); else diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index cbb9249be7..2a71badf0b 100644 --- a/contrib/sepgsql/label.c +++ b/contrib/sepgsql/label.c @@ -248,7 +248,7 @@ static void sepgsql_client_auth(Port *port, int status) { if (next_client_auth_hook) - (*next_client_auth_hook) (port, status); + next_client_auth_hook(port, status); /* * In the case when authentication failed, the supplied socket shall be @@ -288,7 +288,7 @@ sepgsql_needs_fmgr_hook(Oid functionId) ObjectAddress object; if (next_needs_fmgr_hook && - (*next_needs_fmgr_hook) (functionId)) + next_needs_fmgr_hook(functionId)) return true; /* @@ -389,7 +389,7 @@ sepgsql_fmgr_hook(FmgrHookEventType event, client_label_func = stack->new_label; } if (next_fmgr_hook) - (*next_fmgr_hook) (event, flinfo, &stack->next_private); + next_fmgr_hook(event, flinfo, &stack->next_private); break; case FHET_END: @@ -397,7 +397,7 @@ sepgsql_fmgr_hook(FmgrHookEventType event, stack = (void *) DatumGetPointer(*private); if (next_fmgr_hook) - (*next_fmgr_hook) (event, flinfo, &stack->next_private); + next_fmgr_hook(event, flinfo, &stack->next_private); if (stack->new_label) { diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 5e7e812200..a66749fb29 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -3344,7 +3344,7 @@ CallXactCallbacks(XactEvent event) XactCallbackItem *item; for (item = Xact_callbacks; item; item = item->next) - (*item->callback) (event, item->arg); + item->callback(event, item->arg); } @@ -3401,7 +3401,7 @@ CallSubXactCallbacks(SubXactEvent event, SubXactCallbackItem *item; for (item = SubXact_callbacks; item; item = item->next) - (*item->callback) (event, mySubid, parentSubid, item->arg); + item->callback(event, mySubid, parentSubid, item->arg); } diff --git a/src/backend/catalog/objectaccess.c b/src/backend/catalog/objectaccess.c index 9d5eb7b9da..ef304ac9b6 100644 --- a/src/backend/catalog/objectaccess.c +++ b/src/backend/catalog/objectaccess.c @@ -37,7 +37,7 @@ RunObjectPostCreateHook(Oid classId, Oid objectId, int subId, memset(&pc_arg, 0, sizeof(ObjectAccessPostCreate)); pc_arg.is_internal = is_internal; - (*object_access_hook) (OAT_POST_CREATE, + object_access_hook(OAT_POST_CREATE, classId, objectId, subId, (void *) &pc_arg); } @@ -59,7 +59,7 @@ RunObjectDropHook(Oid classId, Oid objectId, int subId, memset(&drop_arg, 0, sizeof(ObjectAccessDrop)); drop_arg.dropflags = dropflags; - (*object_access_hook) (OAT_DROP, + object_access_hook(OAT_DROP, classId, objectId, subId, (void *) &drop_arg); } @@ -82,7 +82,7 @@ RunObjectPostAlterHook(Oid classId, Oid objectId, int subId, pa_arg.auxiliary_id = auxiliaryId; pa_arg.is_internal = is_internal; - (*object_access_hook) (OAT_POST_ALTER, + object_access_hook(OAT_POST_ALTER, classId, objectId, subId, (void *) &pa_arg); } @@ -104,7 +104,7 @@ RunNamespaceSearchHook(Oid objectId, bool ereport_on_violation) ns_arg.ereport_on_violation = ereport_on_violation; ns_arg.result = true; - (*object_access_hook) (OAT_NAMESPACE_SEARCH, + object_access_hook(OAT_NAMESPACE_SEARCH, NamespaceRelationId, objectId, 0, (void *) &ns_arg); @@ -122,7 +122,7 @@ RunFunctionExecuteHook(Oid objectId) /* caller should check, but just in case... */ Assert(object_access_hook != NULL); - (*object_access_hook) (OAT_FUNCTION_EXECUTE, + object_access_hook(OAT_FUNCTION_EXECUTE, ProcedureRelationId, objectId, 0, NULL); } diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 2b638271b3..5fffb25c57 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -499,7 +499,7 @@ do_analyze_rel(Relation onerel, int options, VacuumParams *params, rows, targrows, &totalrows, &totaldeadrows); else - numrows = (*acquirefunc) (onerel, elevel, + numrows = acquirefunc(onerel, elevel, rows, targrows, &totalrows, &totaldeadrows); @@ -526,7 +526,7 @@ do_analyze_rel(Relation onerel, int options, VacuumParams *params, stats->rows = rows; stats->tupDesc = onerel->rd_att; - (*stats->compute_stats) (stats, + stats->compute_stats(stats, std_fetch_func, numrows, totalrows); @@ -830,7 +830,7 @@ compute_index_stats(Relation onerel, double totalrows, stats->exprvals = exprvals + i; stats->exprnulls = exprnulls + i; stats->rowstride = attr_cnt; - (*stats->compute_stats) (stats, + stats->compute_stats(stats, ind_fetch_func, numindexrows, totalindexrows); @@ -1430,7 +1430,7 @@ acquire_inherited_sample_rows(Relation onerel, int elevel, tdrows; /* Fetch a random sample of the child's rows */ - childrows = (*acquirefunc) (childrel, elevel, + childrows = acquirefunc(childrel, elevel, rows + numrows, childtargrows, &trows, &tdrows); diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 7648201218..bb0a49cb88 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -353,7 +353,7 @@ ExplainOneQuery(Query *query, int cursorOptions, /* if an advisor plugin is present, let it manage things */ if (ExplainOneQuery_hook) - (*ExplainOneQuery_hook) (query, cursorOptions, into, es, + ExplainOneQuery_hook(query, cursorOptions, into, es, queryString, params); else { @@ -2441,7 +2441,7 @@ explain_get_index_name(Oid indexId) const char *result; if (explain_get_index_name_hook) - result = (*explain_get_index_name_hook) (indexId); + result = explain_get_index_name_hook(indexId); else result = NULL; if (result == NULL) diff --git a/src/backend/commands/portalcmds.c b/src/backend/commands/portalcmds.c index 46369cf3db..b36473fba4 100644 --- a/src/backend/commands/portalcmds.c +++ b/src/backend/commands/portalcmds.c @@ -397,7 +397,7 @@ PersistHoldablePortal(Portal portal) /* Fetch the result set into the tuplestore */ ExecutorRun(queryDesc, ForwardScanDirection, 0L, false); - (*queryDesc->dest->rDestroy) (queryDesc->dest); + queryDesc->dest->rDestroy(queryDesc->dest); queryDesc->dest = NULL; /* diff --git a/src/backend/commands/seclabel.c b/src/backend/commands/seclabel.c index 5f16d6cf1c..b0b06fc91f 100644 --- a/src/backend/commands/seclabel.c +++ b/src/backend/commands/seclabel.c @@ -122,7 +122,7 @@ ExecSecLabelStmt(SecLabelStmt *stmt) } /* Provider gets control here, may throw ERROR to veto new label. */ - (*provider->hook) (&address, stmt->label); + provider->hook(&address, stmt->label); /* Apply new label. */ SetSecurityLabel(&address, provider->provider_name, stmt->label); diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c index f2941352d7..e34b736f1e 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -359,7 +359,7 @@ CreateRole(ParseState *pstate, CreateRoleStmt *stmt) * Call the password checking hook if there is one defined */ if (check_password_hook && password) - (*check_password_hook) (stmt->role, + check_password_hook(stmt->role, password, get_password_type(password), validUntil_datum, @@ -744,7 +744,7 @@ AlterRole(AlterRoleStmt *stmt) * Call the password checking hook if there is one defined */ if (check_password_hook && password) - (*check_password_hook) (rolename, + check_password_hook(rolename, password, get_password_type(password), validUntil_datum, diff --git a/src/backend/executor/execCurrent.c b/src/backend/executor/execCurrent.c index f00fce5913..f42df3916e 100644 --- a/src/backend/executor/execCurrent.c +++ b/src/backend/executor/execCurrent.c @@ -220,7 +220,7 @@ fetch_cursor_param_value(ExprContext *econtext, int paramId) /* give hook a chance in case parameter is dynamic */ if (!OidIsValid(prm->ptype) && paramInfo->paramFetch != NULL) - (*paramInfo->paramFetch) (paramInfo, paramId); + paramInfo->paramFetch(paramInfo, paramId); if (OidIsValid(prm->ptype) && !prm->isnull) { diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c index f2a52f6213..2dd110b310 100644 --- a/src/backend/executor/execExprInterp.c +++ b/src/backend/executor/execExprInterp.c @@ -647,7 +647,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) FunctionCallInfo fcinfo = op->d.func.fcinfo_data; fcinfo->isnull = false; - *op->resvalue = (op->d.func.fn_addr) (fcinfo); + *op->resvalue = op->d.func.fn_addr(fcinfo); *op->resnull = fcinfo->isnull; EEO_NEXT(); @@ -669,7 +669,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) } } fcinfo->isnull = false; - *op->resvalue = (op->d.func.fn_addr) (fcinfo); + *op->resvalue = op->d.func.fn_addr(fcinfo); *op->resnull = fcinfo->isnull; strictfail: @@ -684,7 +684,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) pgstat_init_function_usage(fcinfo, &fcusage); fcinfo->isnull = false; - *op->resvalue = (op->d.func.fn_addr) (fcinfo); + *op->resvalue = op->d.func.fn_addr(fcinfo); *op->resnull = fcinfo->isnull; pgstat_end_function_usage(&fcusage, true); @@ -712,7 +712,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) pgstat_init_function_usage(fcinfo, &fcusage); fcinfo->isnull = false; - *op->resvalue = (op->d.func.fn_addr) (fcinfo); + *op->resvalue = op->d.func.fn_addr(fcinfo); *op->resnull = fcinfo->isnull; pgstat_end_function_usage(&fcusage, true); @@ -1170,7 +1170,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) Datum eqresult; fcinfo->isnull = false; - eqresult = (op->d.func.fn_addr) (fcinfo); + eqresult = op->d.func.fn_addr(fcinfo); /* Must invert result of "="; safe to do even if null */ *op->resvalue = BoolGetDatum(!DatumGetBool(eqresult)); *op->resnull = fcinfo->isnull; @@ -1192,7 +1192,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) Datum result; fcinfo->isnull = false; - result = (op->d.func.fn_addr) (fcinfo); + result = op->d.func.fn_addr(fcinfo); /* if the arguments are equal return null */ if (!fcinfo->isnull && DatumGetBool(result)) @@ -1279,7 +1279,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) /* Apply comparison function */ fcinfo->isnull = false; - *op->resvalue = (op->d.rowcompare_step.fn_addr) (fcinfo); + *op->resvalue = op->d.rowcompare_step.fn_addr(fcinfo); /* force NULL result if NULL function result */ if (fcinfo->isnull) @@ -1878,7 +1878,7 @@ ExecEvalParamExtern(ExprState *state, ExprEvalStep *op, ExprContext *econtext) /* give hook a chance in case parameter is dynamic */ if (!OidIsValid(prm->ptype) && paramInfo->paramFetch != NULL) - (*paramInfo->paramFetch) (paramInfo, paramId); + paramInfo->paramFetch(paramInfo, paramId); if (likely(OidIsValid(prm->ptype))) { @@ -3000,7 +3000,7 @@ ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op) else { fcinfo->isnull = false; - thisresult = (op->d.scalararrayop.fn_addr) (fcinfo); + thisresult = op->d.scalararrayop.fn_addr(fcinfo); } /* Combine results per OR or AND semantics */ diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 6671a25ffb..42b033d031 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -146,7 +146,7 @@ void ExecutorStart(QueryDesc *queryDesc, int eflags) { if (ExecutorStart_hook) - (*ExecutorStart_hook) (queryDesc, eflags); + ExecutorStart_hook(queryDesc, eflags); else standard_ExecutorStart(queryDesc, eflags); } @@ -300,7 +300,7 @@ ExecutorRun(QueryDesc *queryDesc, bool execute_once) { if (ExecutorRun_hook) - (*ExecutorRun_hook) (queryDesc, direction, count, execute_once); + ExecutorRun_hook(queryDesc, direction, count, execute_once); else standard_ExecutorRun(queryDesc, direction, count, execute_once); } @@ -348,7 +348,7 @@ standard_ExecutorRun(QueryDesc *queryDesc, queryDesc->plannedstmt->hasReturning); if (sendTuples) - (*dest->rStartup) (dest, operation, queryDesc->tupDesc); + dest->rStartup(dest, operation, queryDesc->tupDesc); /* * run plan @@ -374,7 +374,7 @@ standard_ExecutorRun(QueryDesc *queryDesc, * shutdown tuple receiver, if we started it */ if (sendTuples) - (*dest->rShutdown) (dest); + dest->rShutdown(dest); if (queryDesc->totaltime) InstrStopNode(queryDesc->totaltime, estate->es_processed); @@ -400,7 +400,7 @@ void ExecutorFinish(QueryDesc *queryDesc) { if (ExecutorFinish_hook) - (*ExecutorFinish_hook) (queryDesc); + ExecutorFinish_hook(queryDesc); else standard_ExecutorFinish(queryDesc); } @@ -460,7 +460,7 @@ void ExecutorEnd(QueryDesc *queryDesc) { if (ExecutorEnd_hook) - (*ExecutorEnd_hook) (queryDesc); + ExecutorEnd_hook(queryDesc); else standard_ExecutorEnd(queryDesc); } @@ -587,7 +587,7 @@ ExecCheckRTPerms(List *rangeTable, bool ereport_on_violation) } if (ExecutorCheckPerms_hook) - result = (*ExecutorCheckPerms_hook) (rangeTable, + result = ExecutorCheckPerms_hook(rangeTable, ereport_on_violation); return result; } @@ -1725,7 +1725,7 @@ ExecutePlan(EState *estate, * has closed and no more tuples can be sent. If that's the case, * end the loop. */ - if (!((*dest->receiveSlot) (slot, dest))) + if (!dest->receiveSlot(slot, dest)) break; } diff --git a/src/backend/executor/execParallel.c b/src/backend/executor/execParallel.c index ce47f1d4a8..40a860ab1f 100644 --- a/src/backend/executor/execParallel.c +++ b/src/backend/executor/execParallel.c @@ -889,5 +889,5 @@ ParallelQueryMain(dsm_segment *seg, shm_toc *toc) /* Cleanup. */ dsa_detach(area); FreeQueryDesc(queryDesc); - (*receiver->rDestroy) (receiver); + receiver->rDestroy(receiver); } diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c index 7ae70a877a..4955290e09 100644 --- a/src/backend/executor/execTuples.c +++ b/src/backend/executor/execTuples.c @@ -1238,7 +1238,7 @@ begin_tup_output_tupdesc(DestReceiver *dest, TupleDesc tupdesc) tstate->slot = MakeSingleTupleTableSlot(tupdesc); tstate->dest = dest; - (*tstate->dest->rStartup) (tstate->dest, (int) CMD_SELECT, tupdesc); + tstate->dest->rStartup(tstate->dest, (int) CMD_SELECT, tupdesc); return tstate; } @@ -1263,7 +1263,7 @@ do_tup_output(TupOutputState *tstate, Datum *values, bool *isnull) ExecStoreVirtualTuple(slot); /* send the tuple to the receiver */ - (void) (*tstate->dest->receiveSlot) (slot, tstate->dest); + (void) tstate->dest->receiveSlot(slot, tstate->dest); /* clean up */ ExecClearTuple(slot); @@ -1307,7 +1307,7 @@ do_text_output_multiline(TupOutputState *tstate, const char *txt) void end_tup_output(TupOutputState *tstate) { - (*tstate->dest->rShutdown) (tstate->dest); + tstate->dest->rShutdown(tstate->dest); /* note that destroying the dest is not ours to do */ ExecDropSingleTupleTableSlot(tstate->slot); pfree(tstate); diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c index 25772fc603..9d2ba5232d 100644 --- a/src/backend/executor/execUtils.c +++ b/src/backend/executor/execUtils.c @@ -808,7 +808,7 @@ ShutdownExprContext(ExprContext *econtext, bool isCommit) { econtext->ecxt_callbacks = ecxt_callback->next; if (isCommit) - (*ecxt_callback->function) (ecxt_callback->arg); + ecxt_callback->function(ecxt_callback->arg); pfree(ecxt_callback); } diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c index 3630f5d966..8f48a83ad2 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -886,7 +886,7 @@ postquel_end(execution_state *es) ExecutorEnd(es->qd); } - (*es->qd->dest->rDestroy) (es->qd->dest); + es->qd->dest->rDestroy(es->qd->dest); FreeQueryDesc(es->qd); es->qd = NULL; diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c index cb30fc7b71..4f1756f90f 100644 --- a/src/backend/libpq/auth.c +++ b/src/backend/libpq/auth.c @@ -593,7 +593,7 @@ ClientAuthentication(Port *port) } if (ClientAuthentication_hook) - (*ClientAuthentication_hook) (port, status); + ClientAuthentication_hook(port, status); if (status == STATUS_OK) sendAuthRequest(port, AUTH_REQ_OK, NULL, 0); diff --git a/src/backend/libpq/ifaddr.c b/src/backend/libpq/ifaddr.c index 53bf6bcd80..09a684daa9 100644 --- a/src/backend/libpq/ifaddr.c +++ b/src/backend/libpq/ifaddr.c @@ -225,7 +225,7 @@ run_ifaddr_callback(PgIfAddrCallback callback, void *cb_data, mask = (struct sockaddr *) &fullmask; } - (*callback) (addr, mask, cb_data); + callback(addr, mask, cb_data); } #ifdef WIN32 diff --git a/src/backend/nodes/params.c b/src/backend/nodes/params.c index 110732081b..51429af1e3 100644 --- a/src/backend/nodes/params.c +++ b/src/backend/nodes/params.c @@ -73,7 +73,7 @@ copyParamList(ParamListInfo from) /* give hook a chance in case parameter is dynamic */ if (!OidIsValid(oprm->ptype) && from->paramFetch != NULL) - (*from->paramFetch) (from, i + 1); + from->paramFetch(from, i + 1); /* flat-copy the parameter info */ *nprm = *oprm; @@ -115,7 +115,7 @@ EstimateParamListSpace(ParamListInfo paramLI) { /* give hook a chance in case parameter is dynamic */ if (!OidIsValid(prm->ptype) && paramLI->paramFetch != NULL) - (*paramLI->paramFetch) (paramLI, i + 1); + paramLI->paramFetch(paramLI, i + 1); typeOid = prm->ptype; } @@ -184,7 +184,7 @@ SerializeParamList(ParamListInfo paramLI, char **start_address) { /* give hook a chance in case parameter is dynamic */ if (!OidIsValid(prm->ptype) && paramLI->paramFetch != NULL) - (*paramLI->paramFetch) (paramLI, i + 1); + paramLI->paramFetch(paramLI, i + 1); typeOid = prm->ptype; } diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c index 2d7e1d84d0..d75df4b4c2 100644 --- a/src/backend/optimizer/path/allpaths.c +++ b/src/backend/optimizer/path/allpaths.c @@ -494,7 +494,7 @@ set_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, * add_path(), or delete or modify paths added by the core code. */ if (set_rel_pathlist_hook) - (*set_rel_pathlist_hook) (root, rel, rti, rte); + set_rel_pathlist_hook(root, rel, rti, rte); /* Now find the cheapest of the paths for this rel */ set_cheapest(rel); diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c index f4e0a6ea3d..04aec4115a 100644 --- a/src/backend/optimizer/plan/planmain.c +++ b/src/backend/optimizer/plan/planmain.c @@ -93,7 +93,7 @@ query_planner(PlannerInfo *root, List *tlist, * like "SELECT 2+2 ORDER BY 1". */ root->canon_pathkeys = NIL; - (*qp_callback) (root, qp_extra); + qp_callback(root, qp_extra); return final_rel; } @@ -174,7 +174,7 @@ query_planner(PlannerInfo *root, List *tlist, * generate pathkeys in canonical form; so compute query_pathkeys and * other pathkeys fields in PlannerInfo. */ - (*qp_callback) (root, qp_extra); + qp_callback(root, qp_extra); /* * Examine any "placeholder" expressions generated during subquery pullup. diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index 407df9ae79..84ce98980f 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -205,7 +205,7 @@ planner(Query *parse, int cursorOptions, ParamListInfo boundParams) PlannedStmt *result; if (planner_hook) - result = (*planner_hook) (parse, cursorOptions, boundParams); + result = planner_hook(parse, cursorOptions, boundParams); else result = standard_planner(parse, cursorOptions, boundParams); return result; @@ -2057,7 +2057,7 @@ grouping_planner(PlannerInfo *root, bool inheritance_update, /* Let extensions possibly add some more paths */ if (create_upper_paths_hook) - (*create_upper_paths_hook) (root, UPPERREL_FINAL, + create_upper_paths_hook(root, UPPERREL_FINAL, current_rel, final_rel); /* Note: currently, we leave it to callers to do set_cheapest() */ @@ -4113,7 +4113,7 @@ create_grouping_paths(PlannerInfo *root, /* Let extensions possibly add some more paths */ if (create_upper_paths_hook) - (*create_upper_paths_hook) (root, UPPERREL_GROUP_AGG, + create_upper_paths_hook(root, UPPERREL_GROUP_AGG, input_rel, grouped_rel); /* Now choose the best path(s) */ @@ -4549,7 +4549,7 @@ create_window_paths(PlannerInfo *root, /* Let extensions possibly add some more paths */ if (create_upper_paths_hook) - (*create_upper_paths_hook) (root, UPPERREL_WINDOW, + create_upper_paths_hook(root, UPPERREL_WINDOW, input_rel, window_rel); /* Now choose the best path(s) */ @@ -4853,7 +4853,7 @@ create_distinct_paths(PlannerInfo *root, /* Let extensions possibly add some more paths */ if (create_upper_paths_hook) - (*create_upper_paths_hook) (root, UPPERREL_DISTINCT, + create_upper_paths_hook(root, UPPERREL_DISTINCT, input_rel, distinct_rel); /* Now choose the best path(s) */ @@ -4995,7 +4995,7 @@ create_ordered_paths(PlannerInfo *root, /* Let extensions possibly add some more paths */ if (create_upper_paths_hook) - (*create_upper_paths_hook) (root, UPPERREL_ORDERED, + create_upper_paths_hook(root, UPPERREL_ORDERED, input_rel, ordered_rel); /* diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c index f43c3f3007..7841df52db 100644 --- a/src/backend/optimizer/prep/prepunion.c +++ b/src/backend/optimizer/prep/prepunion.c @@ -213,7 +213,7 @@ plan_set_operations(PlannerInfo *root) /* Let extensions possibly add some more paths */ if (create_upper_paths_hook) - (*create_upper_paths_hook) (root, UPPERREL_SETOP, + create_upper_paths_hook(root, UPPERREL_SETOP, NULL, setop_rel); /* Select cheapest path */ diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index dc0b0b0706..f28abddeab 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -428,7 +428,7 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent, * removing an index, or adding a hypothetical index to the indexlist. */ if (get_relation_info_hook) - (*get_relation_info_hook) (root, relationObjectId, inhparent, rel); + get_relation_info_hook(root, relationObjectId, inhparent, rel); } /* diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index 4fb793cfbf..36d68d16ac 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -112,7 +112,7 @@ parse_analyze(RawStmt *parseTree, const char *sourceText, query = transformTopLevelStmt(pstate, parseTree); if (post_parse_analyze_hook) - (*post_parse_analyze_hook) (pstate, query); + post_parse_analyze_hook(pstate, query); free_parsestate(pstate); @@ -145,7 +145,7 @@ parse_analyze_varparams(RawStmt *parseTree, const char *sourceText, check_variable_parameters(pstate, query); if (post_parse_analyze_hook) - (*post_parse_analyze_hook) (pstate, query); + post_parse_analyze_hook(pstate, query); free_parsestate(pstate); diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c index 0bc7dba6a0..d3b76637e5 100644 --- a/src/backend/parser/parse_coerce.c +++ b/src/backend/parser/parse_coerce.c @@ -369,7 +369,7 @@ coerce_type(ParseState *pstate, Node *node, * transformed node (very possibly the same Param node), or return * NULL to indicate we should proceed with normal coercion. */ - result = (*pstate->p_coerce_param_hook) (pstate, + result = pstate->p_coerce_param_hook(pstate, (Param *) node, targetTypeId, targetTypeMod, diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c index 6d8cb07766..1aaa5244e6 100644 --- a/src/backend/parser/parse_expr.c +++ b/src/backend/parser/parse_expr.c @@ -527,7 +527,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref) */ if (pstate->p_pre_columnref_hook != NULL) { - node = (*pstate->p_pre_columnref_hook) (pstate, cref); + node = pstate->p_pre_columnref_hook(pstate, cref); if (node != NULL) return node; } @@ -758,7 +758,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref) { Node *hookresult; - hookresult = (*pstate->p_post_columnref_hook) (pstate, cref, node); + hookresult = pstate->p_post_columnref_hook(pstate, cref, node); if (node == NULL) node = hookresult; else if (hookresult != NULL) @@ -813,7 +813,7 @@ transformParamRef(ParseState *pstate, ParamRef *pref) * call it. If not, or if the hook returns NULL, throw a generic error. */ if (pstate->p_paramref_hook != NULL) - result = (*pstate->p_paramref_hook) (pstate, pref); + result = pstate->p_paramref_hook(pstate, pref); else result = NULL; @@ -2585,9 +2585,9 @@ transformCurrentOfExpr(ParseState *pstate, CurrentOfExpr *cexpr) /* See if there is a translation available from a parser hook */ if (pstate->p_pre_columnref_hook != NULL) - node = (*pstate->p_pre_columnref_hook) (pstate, cref); + node = pstate->p_pre_columnref_hook(pstate, cref); if (node == NULL && pstate->p_post_columnref_hook != NULL) - node = (*pstate->p_post_columnref_hook) (pstate, cref, NULL); + node = pstate->p_post_columnref_hook(pstate, cref, NULL); /* * XXX Should we throw an error if we get a translation that isn't a diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c index 0a70539fb1..2286ee8c89 100644 --- a/src/backend/parser/parse_target.c +++ b/src/backend/parser/parse_target.c @@ -1106,7 +1106,7 @@ ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref, { Node *node; - node = (*pstate->p_pre_columnref_hook) (pstate, cref); + node = pstate->p_pre_columnref_hook(pstate, cref); if (node != NULL) return ExpandRowReference(pstate, node, make_target_entry); } @@ -1161,7 +1161,7 @@ ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref, { Node *node; - node = (*pstate->p_post_columnref_hook) (pstate, cref, + node = pstate->p_post_columnref_hook(pstate, cref, (Node *) rte); if (node != NULL) { diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c index ba706b25b4..5c17213720 100644 --- a/src/backend/rewrite/rewriteManip.c +++ b/src/backend/rewrite/rewriteManip.c @@ -1143,7 +1143,7 @@ replace_rte_variables_mutator(Node *node, /* Found a matching variable, make the substitution */ Node *newnode; - newnode = (*context->callback) (var, context); + newnode = context->callback(var, context); /* Detect if we are adding a sublink to query */ if (!context->inserted_sublink) context->inserted_sublink = checkExprHasSubLink(newnode); diff --git a/src/backend/rewrite/rowsecurity.c b/src/backend/rewrite/rowsecurity.c index 9e7e54db67..53cb36c051 100644 --- a/src/backend/rewrite/rowsecurity.c +++ b/src/backend/rewrite/rowsecurity.c @@ -462,7 +462,7 @@ get_policies_for_relation(Relation relation, CmdType cmd, Oid user_id, if (row_security_policy_hook_restrictive) { List *hook_policies = - (*row_security_policy_hook_restrictive) (cmd, relation); + row_security_policy_hook_restrictive(cmd, relation); /* * As with built-in restrictive policies, we sort any hook-provided @@ -484,7 +484,7 @@ get_policies_for_relation(Relation relation, CmdType cmd, Oid user_id, if (row_security_policy_hook_permissive) { List *hook_policies = - (*row_security_policy_hook_permissive) (cmd, relation); + row_security_policy_hook_permissive(cmd, relation); foreach(item, hook_policies) { diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index 83b061a036..c2a92f69f0 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -3048,7 +3048,7 @@ walkdir(const char *path, } if (S_ISREG(fst.st_mode)) - (*action) (subpath, false, elevel); + action(subpath, false, elevel); else if (S_ISDIR(fst.st_mode)) walkdir(subpath, action, false, elevel); } @@ -3060,7 +3060,7 @@ walkdir(const char *path, * file fsyncs don't guarantee that the directory entry for the file is * synced. */ - (*action) (path, true, elevel); + action(path, true, elevel); } diff --git a/src/backend/storage/ipc/ipc.c b/src/backend/storage/ipc/ipc.c index 90dee4f51a..dfb47e7c39 100644 --- a/src/backend/storage/ipc/ipc.c +++ b/src/backend/storage/ipc/ipc.c @@ -197,8 +197,8 @@ proc_exit_prepare(int code) * possible. */ while (--on_proc_exit_index >= 0) - (*on_proc_exit_list[on_proc_exit_index].function) (code, - on_proc_exit_list[on_proc_exit_index].arg); + on_proc_exit_list[on_proc_exit_index].function(code, + on_proc_exit_list[on_proc_exit_index].arg); on_proc_exit_index = 0; } @@ -225,8 +225,8 @@ shmem_exit(int code) elog(DEBUG3, "shmem_exit(%d): %d before_shmem_exit callbacks to make", code, before_shmem_exit_index); while (--before_shmem_exit_index >= 0) - (*before_shmem_exit_list[before_shmem_exit_index].function) (code, - before_shmem_exit_list[before_shmem_exit_index].arg); + before_shmem_exit_list[before_shmem_exit_index].function(code, + before_shmem_exit_list[before_shmem_exit_index].arg); before_shmem_exit_index = 0; /* @@ -258,8 +258,8 @@ shmem_exit(int code) elog(DEBUG3, "shmem_exit(%d): %d on_shmem_exit callbacks to make", code, on_shmem_exit_index); while (--on_shmem_exit_index >= 0) - (*on_shmem_exit_list[on_shmem_exit_index].function) (code, - on_shmem_exit_list[on_shmem_exit_index].arg); + on_shmem_exit_list[on_shmem_exit_index].function(code, + on_shmem_exit_list[on_shmem_exit_index].arg); on_shmem_exit_index = 0; } diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c index 0ca095c4d6..5d5b7dd95e 100644 --- a/src/backend/storage/smgr/smgr.c +++ b/src/backend/storage/smgr/smgr.c @@ -106,7 +106,7 @@ smgrinit(void) for (i = 0; i < NSmgr; i++) { if (smgrsw[i].smgr_init) - (*(smgrsw[i].smgr_init)) (); + smgrsw[i].smgr_init(); } /* register the shutdown proc */ @@ -124,7 +124,7 @@ smgrshutdown(int code, Datum arg) for (i = 0; i < NSmgr; i++) { if (smgrsw[i].smgr_shutdown) - (*(smgrsw[i].smgr_shutdown)) (); + smgrsw[i].smgr_shutdown(); } } @@ -286,7 +286,7 @@ remove_from_unowned_list(SMgrRelation reln) bool smgrexists(SMgrRelation reln, ForkNumber forknum) { - return (*(smgrsw[reln->smgr_which].smgr_exists)) (reln, forknum); + return smgrsw[reln->smgr_which].smgr_exists(reln, forknum); } /* @@ -299,7 +299,7 @@ smgrclose(SMgrRelation reln) ForkNumber forknum; for (forknum = 0; forknum <= MAX_FORKNUM; forknum++) - (*(smgrsw[reln->smgr_which].smgr_close)) (reln, forknum); + smgrsw[reln->smgr_which].smgr_close(reln, forknum); owner = reln->smgr_owner; @@ -395,7 +395,7 @@ smgrcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo) reln->smgr_rnode.node.dbNode, isRedo); - (*(smgrsw[reln->smgr_which].smgr_create)) (reln, forknum, isRedo); + smgrsw[reln->smgr_which].smgr_create(reln, forknum, isRedo); } /* @@ -419,7 +419,7 @@ smgrdounlink(SMgrRelation reln, bool isRedo) /* Close the forks at smgr level */ for (forknum = 0; forknum <= MAX_FORKNUM; forknum++) - (*(smgrsw[which].smgr_close)) (reln, forknum); + smgrsw[which].smgr_close(reln, forknum); /* * Get rid of any remaining buffers for the relation. bufmgr will just @@ -451,7 +451,7 @@ smgrdounlink(SMgrRelation reln, bool isRedo) * ERROR, because we've already decided to commit or abort the current * xact. */ - (*(smgrsw[which].smgr_unlink)) (rnode, InvalidForkNumber, isRedo); + smgrsw[which].smgr_unlink(rnode, InvalidForkNumber, isRedo); } /* @@ -491,7 +491,7 @@ smgrdounlinkall(SMgrRelation *rels, int nrels, bool isRedo) /* Close the forks at smgr level */ for (forknum = 0; forknum <= MAX_FORKNUM; forknum++) - (*(smgrsw[which].smgr_close)) (rels[i], forknum); + smgrsw[which].smgr_close(rels[i], forknum); } /* @@ -529,7 +529,7 @@ smgrdounlinkall(SMgrRelation *rels, int nrels, bool isRedo) int which = rels[i]->smgr_which; for (forknum = 0; forknum <= MAX_FORKNUM; forknum++) - (*(smgrsw[which].smgr_unlink)) (rnodes[i], forknum, isRedo); + smgrsw[which].smgr_unlink(rnodes[i], forknum, isRedo); } pfree(rnodes); @@ -552,7 +552,7 @@ smgrdounlinkfork(SMgrRelation reln, ForkNumber forknum, bool isRedo) int which = reln->smgr_which; /* Close the fork at smgr level */ - (*(smgrsw[which].smgr_close)) (reln, forknum); + smgrsw[which].smgr_close(reln, forknum); /* * Get rid of any remaining buffers for the fork. bufmgr will just drop @@ -584,7 +584,7 @@ smgrdounlinkfork(SMgrRelation reln, ForkNumber forknum, bool isRedo) * ERROR, because we've already decided to commit or abort the current * xact. */ - (*(smgrsw[which].smgr_unlink)) (rnode, forknum, isRedo); + smgrsw[which].smgr_unlink(rnode, forknum, isRedo); } /* @@ -600,7 +600,7 @@ void smgrextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, char *buffer, bool skipFsync) { - (*(smgrsw[reln->smgr_which].smgr_extend)) (reln, forknum, blocknum, + smgrsw[reln->smgr_which].smgr_extend(reln, forknum, blocknum, buffer, skipFsync); } @@ -610,7 +610,7 @@ smgrextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, void smgrprefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum) { - (*(smgrsw[reln->smgr_which].smgr_prefetch)) (reln, forknum, blocknum); + smgrsw[reln->smgr_which].smgr_prefetch(reln, forknum, blocknum); } /* @@ -625,7 +625,7 @@ void smgrread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, char *buffer) { - (*(smgrsw[reln->smgr_which].smgr_read)) (reln, forknum, blocknum, buffer); + smgrsw[reln->smgr_which].smgr_read(reln, forknum, blocknum, buffer); } /* @@ -647,7 +647,7 @@ void smgrwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, char *buffer, bool skipFsync) { - (*(smgrsw[reln->smgr_which].smgr_write)) (reln, forknum, blocknum, + smgrsw[reln->smgr_which].smgr_write(reln, forknum, blocknum, buffer, skipFsync); } @@ -660,7 +660,7 @@ void smgrwriteback(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, BlockNumber nblocks) { - (*(smgrsw[reln->smgr_which].smgr_writeback)) (reln, forknum, blocknum, + smgrsw[reln->smgr_which].smgr_writeback(reln, forknum, blocknum, nblocks); } @@ -671,7 +671,7 @@ smgrwriteback(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, BlockNumber smgrnblocks(SMgrRelation reln, ForkNumber forknum) { - return (*(smgrsw[reln->smgr_which].smgr_nblocks)) (reln, forknum); + return smgrsw[reln->smgr_which].smgr_nblocks(reln, forknum); } /* @@ -704,7 +704,7 @@ smgrtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks) /* * Do the truncation. */ - (*(smgrsw[reln->smgr_which].smgr_truncate)) (reln, forknum, nblocks); + smgrsw[reln->smgr_which].smgr_truncate(reln, forknum, nblocks); } /* @@ -733,7 +733,7 @@ smgrtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks) void smgrimmedsync(SMgrRelation reln, ForkNumber forknum) { - (*(smgrsw[reln->smgr_which].smgr_immedsync)) (reln, forknum); + smgrsw[reln->smgr_which].smgr_immedsync(reln, forknum); } @@ -748,7 +748,7 @@ smgrpreckpt(void) for (i = 0; i < NSmgr; i++) { if (smgrsw[i].smgr_pre_ckpt) - (*(smgrsw[i].smgr_pre_ckpt)) (); + smgrsw[i].smgr_pre_ckpt(); } } @@ -763,7 +763,7 @@ smgrsync(void) for (i = 0; i < NSmgr; i++) { if (smgrsw[i].smgr_sync) - (*(smgrsw[i].smgr_sync)) (); + smgrsw[i].smgr_sync(); } } @@ -778,7 +778,7 @@ smgrpostckpt(void) for (i = 0; i < NSmgr; i++) { if (smgrsw[i].smgr_post_ckpt) - (*(smgrsw[i].smgr_post_ckpt)) (); + smgrsw[i].smgr_post_ckpt(); } } diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index b8d860ebdb..2bf85a8e2d 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -695,12 +695,12 @@ pg_analyze_and_rewrite_params(RawStmt *parsetree, pstate = make_parsestate(NULL); pstate->p_sourcetext = query_string; pstate->p_queryEnv = queryEnv; - (*parserSetup) (pstate, parserSetupArg); + parserSetup(pstate, parserSetupArg); query = transformTopLevelStmt(pstate, parsetree); if (post_parse_analyze_hook) - (*post_parse_analyze_hook) (pstate, query); + post_parse_analyze_hook(pstate, query); free_parsestate(pstate); @@ -1104,7 +1104,7 @@ exec_simple_query(const char *query_string) receiver, completionTag); - (*receiver->rDestroy) (receiver); + receiver->rDestroy(receiver); PortalDrop(portal, false); @@ -1989,7 +1989,7 @@ exec_execute_message(const char *portal_name, long max_rows) receiver, completionTag); - (*receiver->rDestroy) (receiver); + receiver->rDestroy(receiver); if (completed) { diff --git a/src/backend/tcop/pquery.c b/src/backend/tcop/pquery.c index 7e820d05dd..cc462efc37 100644 --- a/src/backend/tcop/pquery.c +++ b/src/backend/tcop/pquery.c @@ -1049,7 +1049,7 @@ FillPortalStore(Portal portal, bool isTopLevel) if (completionTag[0] != '\0') portal->commandTag = pstrdup(completionTag); - (*treceiver->rDestroy) (treceiver); + treceiver->rDestroy(treceiver); } /* @@ -1073,7 +1073,7 @@ RunFromStore(Portal portal, ScanDirection direction, uint64 count, slot = MakeSingleTupleTableSlot(portal->tupDesc); - (*dest->rStartup) (dest, CMD_SELECT, portal->tupDesc); + dest->rStartup(dest, CMD_SELECT, portal->tupDesc); if (ScanDirectionIsNoMovement(direction)) { @@ -1103,7 +1103,7 @@ RunFromStore(Portal portal, ScanDirection direction, uint64 count, * has closed and no more tuples can be sent. If that's the case, * end the loop. */ - if (!((*dest->receiveSlot) (slot, dest))) + if (!dest->receiveSlot(slot, dest)) break; ExecClearTuple(slot); @@ -1119,7 +1119,7 @@ RunFromStore(Portal portal, ScanDirection direction, uint64 count, } } - (*dest->rShutdown) (dest); + dest->rShutdown(dest); ExecDropSingleTupleTableSlot(slot); diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index 775477c6cf..2c00cc74e4 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -350,7 +350,7 @@ ProcessUtility(PlannedStmt *pstmt, * call standard_ProcessUtility(). */ if (ProcessUtility_hook) - (*ProcessUtility_hook) (pstmt, queryString, + ProcessUtility_hook(pstmt, queryString, context, params, queryEnv, dest, completionTag); else diff --git a/src/backend/utils/adt/array_typanalyze.c b/src/backend/utils/adt/array_typanalyze.c index 78153d232f..470ef0c4b0 100644 --- a/src/backend/utils/adt/array_typanalyze.c +++ b/src/backend/utils/adt/array_typanalyze.c @@ -247,7 +247,7 @@ compute_array_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, * temporarily install that. */ stats->extra_data = extra_data->std_extra_data; - (*extra_data->std_compute_stats) (stats, fetchfunc, samplerows, totalrows); + extra_data->std_compute_stats(stats, fetchfunc, samplerows, totalrows); stats->extra_data = extra_data; /* diff --git a/src/backend/utils/adt/expandeddatum.c b/src/backend/utils/adt/expandeddatum.c index 3d77686af7..49854b39f4 100644 --- a/src/backend/utils/adt/expandeddatum.c +++ b/src/backend/utils/adt/expandeddatum.c @@ -74,14 +74,14 @@ EOH_init_header(ExpandedObjectHeader *eohptr, Size EOH_get_flat_size(ExpandedObjectHeader *eohptr) { - return (*eohptr->eoh_methods->get_flat_size) (eohptr); + return eohptr->eoh_methods->get_flat_size(eohptr); } void EOH_flatten_into(ExpandedObjectHeader *eohptr, void *result, Size allocated_size) { - (*eohptr->eoh_methods->flatten_into) (eohptr, result, allocated_size); + eohptr->eoh_methods->flatten_into(eohptr, result, allocated_size); } /* diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c index 4dd7d977e8..c90f37171a 100644 --- a/src/backend/utils/adt/json.c +++ b/src/backend/utils/adt/json.c @@ -434,8 +434,8 @@ parse_scalar(JsonLexContext *lex, JsonSemAction *sem) report_parse_error(JSON_PARSE_VALUE, lex); } - if (sfunc != NULL) - (*sfunc) (sem->semstate, val, tok); + if (sfunc) + sfunc(sem->semstate, val, tok); } static void @@ -465,8 +465,8 @@ parse_object_field(JsonLexContext *lex, JsonSemAction *sem) tok = lex_peek(lex); isnull = tok == JSON_TOKEN_NULL; - if (ostart != NULL) - (*ostart) (sem->semstate, fname, isnull); + if (ostart) + ostart(sem->semstate, fname, isnull); switch (tok) { @@ -480,8 +480,8 @@ parse_object_field(JsonLexContext *lex, JsonSemAction *sem) parse_scalar(lex, sem); } - if (oend != NULL) - (*oend) (sem->semstate, fname, isnull); + if (oend) + oend(sem->semstate, fname, isnull); } static void @@ -497,8 +497,8 @@ parse_object(JsonLexContext *lex, JsonSemAction *sem) check_stack_depth(); - if (ostart != NULL) - (*ostart) (sem->semstate); + if (ostart) + ostart(sem->semstate); /* * Data inside an object is at a higher nesting level than the object @@ -530,8 +530,8 @@ parse_object(JsonLexContext *lex, JsonSemAction *sem) lex->lex_level--; - if (oend != NULL) - (*oend) (sem->semstate); + if (oend) + oend(sem->semstate); } static void @@ -545,8 +545,8 @@ parse_array_element(JsonLexContext *lex, JsonSemAction *sem) isnull = tok == JSON_TOKEN_NULL; - if (astart != NULL) - (*astart) (sem->semstate, isnull); + if (astart) + astart(sem->semstate, isnull); /* an array element is any object, array or scalar */ switch (tok) @@ -561,8 +561,8 @@ parse_array_element(JsonLexContext *lex, JsonSemAction *sem) parse_scalar(lex, sem); } - if (aend != NULL) - (*aend) (sem->semstate, isnull); + if (aend) + aend(sem->semstate, isnull); } static void @@ -577,8 +577,8 @@ parse_array(JsonLexContext *lex, JsonSemAction *sem) check_stack_depth(); - if (astart != NULL) - (*astart) (sem->semstate); + if (astart) + astart(sem->semstate); /* * Data inside an array is at a higher nesting level than the array @@ -602,8 +602,8 @@ parse_array(JsonLexContext *lex, JsonSemAction *sem) lex->lex_level--; - if (aend != NULL) - (*aend) (sem->semstate); + if (aend) + aend(sem->semstate); } /* diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c index 4779e74895..bc2e55c01b 100644 --- a/src/backend/utils/adt/jsonfuncs.c +++ b/src/backend/utils/adt/jsonfuncs.c @@ -4860,7 +4860,7 @@ iterate_string_values_scalar(void *state, char *token, JsonTokenType tokentype) IterateJsonStringValuesState *_state = (IterateJsonStringValuesState *) state; if (tokentype == JSON_TOKEN_STRING) - (*_state->action) (_state->action_state, token, strlen(token)); + _state->action(_state->action_state, token, strlen(token)); } /* diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 23e5526a8e..e8f4656c26 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -4713,7 +4713,7 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid, * decisions about what to do with partial indexes. */ if (get_index_stats_hook && - (*get_index_stats_hook) (root, index->indexoid, + get_index_stats_hook(root, index->indexoid, pos + 1, vardata)) { /* @@ -4788,7 +4788,7 @@ examine_simple_variable(PlannerInfo *root, Var *var, Assert(IsA(rte, RangeTblEntry)); if (get_relation_stats_hook && - (*get_relation_stats_hook) (root, rte, var->varattno, vardata)) + get_relation_stats_hook(root, rte, var->varattno, vardata)) { /* * The hook took control of acquiring a stats tuple. If it did supply @@ -6912,7 +6912,7 @@ btcostestimate(PlannerInfo *root, IndexPath *path, double loop_count, colnum = index->indexkeys[0]; if (get_relation_stats_hook && - (*get_relation_stats_hook) (root, rte, colnum, &vardata)) + get_relation_stats_hook(root, rte, colnum, &vardata)) { /* * The hook took control of acquiring a stats tuple. If it did @@ -6938,7 +6938,7 @@ btcostestimate(PlannerInfo *root, IndexPath *path, double loop_count, colnum = 1; if (get_index_stats_hook && - (*get_index_stats_hook) (root, relid, colnum, &vardata)) + get_index_stats_hook(root, relid, colnum, &vardata)) { /* * The hook took control of acquiring a stats tuple. If it did @@ -7845,7 +7845,7 @@ brincostestimate(PlannerInfo *root, IndexPath *path, double loop_count, { /* Simple variable -- look to stats for the underlying table */ if (get_relation_stats_hook && - (*get_relation_stats_hook) (root, rte, attnum, &vardata)) + get_relation_stats_hook(root, rte, attnum, &vardata)) { /* * The hook took control of acquiring a stats tuple. If it @@ -7876,7 +7876,7 @@ brincostestimate(PlannerInfo *root, IndexPath *path, double loop_count, attnum = qinfo->indexcol + 1; if (get_index_stats_hook && - (*get_index_stats_hook) (root, index->indexoid, attnum, &vardata)) + get_index_stats_hook(root, index->indexoid, attnum, &vardata)) { /* * The hook took control of acquiring a stats tuple. If it diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c index f894053d80..9521509bd0 100644 --- a/src/backend/utils/cache/catcache.c +++ b/src/backend/utils/cache/catcache.c @@ -1822,7 +1822,7 @@ PrepareToInvalidateCacheTuple(Relation relation, hashvalue = CatalogCacheComputeTupleHashValue(ccp, tuple); dbid = ccp->cc_relisshared ? (Oid) 0 : MyDatabaseId; - (*function) (ccp->id, hashvalue, dbid); + function(ccp->id, hashvalue, dbid); if (newtuple) { @@ -1831,7 +1831,7 @@ PrepareToInvalidateCacheTuple(Relation relation, newhashvalue = CatalogCacheComputeTupleHashValue(ccp, newtuple); if (newhashvalue != hashvalue) - (*function) (ccp->id, newhashvalue, dbid); + function(ccp->id, newhashvalue, dbid); } } } diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c index d0e54b8535..0e61b4b79f 100644 --- a/src/backend/utils/cache/inval.c +++ b/src/backend/utils/cache/inval.c @@ -590,7 +590,7 @@ LocalExecuteInvalidationMessage(SharedInvalidationMessage *msg) { struct RELCACHECALLBACK *ccitem = relcache_callback_list + i; - (*ccitem->function) (ccitem->arg, msg->rc.relId); + ccitem->function(ccitem->arg, msg->rc.relId); } } } @@ -650,14 +650,14 @@ InvalidateSystemCaches(void) { struct SYSCACHECALLBACK *ccitem = syscache_callback_list + i; - (*ccitem->function) (ccitem->arg, ccitem->id, 0); + ccitem->function(ccitem->arg, ccitem->id, 0); } for (i = 0; i < relcache_callback_count; i++) { struct RELCACHECALLBACK *ccitem = relcache_callback_list + i; - (*ccitem->function) (ccitem->arg, InvalidOid); + ccitem->function(ccitem->arg, InvalidOid); } } @@ -1460,7 +1460,7 @@ CallSyscacheCallbacks(int cacheid, uint32 hashvalue) struct SYSCACHECALLBACK *ccitem = syscache_callback_list + i; Assert(ccitem->id == cacheid); - (*ccitem->function) (ccitem->arg, cacheid, hashvalue); + ccitem->function(ccitem->arg, cacheid, hashvalue); i = ccitem->link - 1; } } diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 918db0a8f2..f6354a5e6c 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -435,7 +435,7 @@ errfinish(int dummy,...) for (econtext = error_context_stack; econtext != NULL; econtext = econtext->previous) - (*econtext->callback) (econtext->arg); + econtext->callback(econtext->arg); /* * If ERROR (not more nor less) we pass it off to the current handler. @@ -1472,7 +1472,7 @@ EmitErrorReport(void) * detail, detail_log, hint and context text elements. */ if (edata->output_to_server && emit_log_hook) - (*emit_log_hook) (edata); + emit_log_hook(edata); /* Send to server log, if enabled */ if (edata->output_to_server) @@ -1837,7 +1837,7 @@ GetErrorContextStack(void) for (econtext = error_context_stack; econtext != NULL; econtext = econtext->previous) - (*econtext->callback) (econtext->arg); + econtext->callback(econtext->arg); /* * Clean ourselves off the stack, any allocations done should have been diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c index 1239f95ddc..ca2186e4ed 100644 --- a/src/backend/utils/fmgr/dfmgr.c +++ b/src/backend/utils/fmgr/dfmgr.c @@ -245,7 +245,7 @@ internal_load_library(const char *libname) pg_dlsym(file_scanner->handle, PG_MAGIC_FUNCTION_NAME_STRING); if (magic_func) { - const Pg_magic_struct *magic_data_ptr = (*magic_func) (); + const Pg_magic_struct *magic_data_ptr = magic_func(); if (magic_data_ptr->len != magic_data.len || memcmp(magic_data_ptr, &magic_data, magic_data.len) != 0) @@ -278,7 +278,7 @@ internal_load_library(const char *libname) */ PG_init = (PG_init_t) pg_dlsym(file_scanner->handle, "_PG_init"); if (PG_init) - (*PG_init) (); + PG_init(); /* OK to link it into list */ if (file_list == NULL) @@ -438,7 +438,7 @@ internal_unload_library(const char *libname) */ PG_fini = (PG_fini_t) pg_dlsym(file_scanner->handle, "_PG_fini"); if (PG_fini) - (*PG_fini) (); + PG_fini(); clear_external_function_hash(file_scanner->handle); pg_dlclose(file_scanner->handle); diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c index a7b07827e0..2e50a6425f 100644 --- a/src/backend/utils/fmgr/fmgr.c +++ b/src/backend/utils/fmgr/fmgr.c @@ -403,7 +403,7 @@ fetch_finfo_record(void *filehandle, const char *funcname) } /* Found, so call it */ - inforec = (*infofunc) (); + inforec = infofunc(); /* Validate result as best we can */ if (inforec == NULL) @@ -643,7 +643,7 @@ fmgr_security_definer(PG_FUNCTION_ARGS) /* function manager hook */ if (fmgr_hook) - (*fmgr_hook) (FHET_START, &fcache->flinfo, &fcache->arg); + fmgr_hook(FHET_START, &fcache->flinfo, &fcache->arg); /* * We don't need to restore GUC or userid settings on error, because the @@ -674,7 +674,7 @@ fmgr_security_definer(PG_FUNCTION_ARGS) { fcinfo->flinfo = save_flinfo; if (fmgr_hook) - (*fmgr_hook) (FHET_ABORT, &fcache->flinfo, &fcache->arg); + fmgr_hook(FHET_ABORT, &fcache->flinfo, &fcache->arg); PG_RE_THROW(); } PG_END_TRY(); @@ -686,7 +686,7 @@ fmgr_security_definer(PG_FUNCTION_ARGS) if (OidIsValid(fcache->userid)) SetUserIdAndSecContext(save_userid, save_sec_context); if (fmgr_hook) - (*fmgr_hook) (FHET_END, &fcache->flinfo, &fcache->arg); + fmgr_hook(FHET_END, &fcache->flinfo, &fcache->arg); return result; } @@ -714,7 +714,7 @@ DirectFunctionCall1Coll(PGFunction func, Oid collation, Datum arg1) fcinfo.arg[0] = arg1; fcinfo.argnull[0] = false; - result = (*func) (&fcinfo); + result = func(&fcinfo); /* Check for null result, since caller is clearly not expecting one */ if (fcinfo.isnull) @@ -736,7 +736,7 @@ DirectFunctionCall2Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2) fcinfo.argnull[0] = false; fcinfo.argnull[1] = false; - result = (*func) (&fcinfo); + result = func(&fcinfo); /* Check for null result, since caller is clearly not expecting one */ if (fcinfo.isnull) @@ -761,7 +761,7 @@ DirectFunctionCall3Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, fcinfo.argnull[1] = false; fcinfo.argnull[2] = false; - result = (*func) (&fcinfo); + result = func(&fcinfo); /* Check for null result, since caller is clearly not expecting one */ if (fcinfo.isnull) @@ -788,7 +788,7 @@ DirectFunctionCall4Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, fcinfo.argnull[2] = false; fcinfo.argnull[3] = false; - result = (*func) (&fcinfo); + result = func(&fcinfo); /* Check for null result, since caller is clearly not expecting one */ if (fcinfo.isnull) @@ -817,7 +817,7 @@ DirectFunctionCall5Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, fcinfo.argnull[3] = false; fcinfo.argnull[4] = false; - result = (*func) (&fcinfo); + result = func(&fcinfo); /* Check for null result, since caller is clearly not expecting one */ if (fcinfo.isnull) @@ -849,7 +849,7 @@ DirectFunctionCall6Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, fcinfo.argnull[4] = false; fcinfo.argnull[5] = false; - result = (*func) (&fcinfo); + result = func(&fcinfo); /* Check for null result, since caller is clearly not expecting one */ if (fcinfo.isnull) @@ -883,7 +883,7 @@ DirectFunctionCall7Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, fcinfo.argnull[5] = false; fcinfo.argnull[6] = false; - result = (*func) (&fcinfo); + result = func(&fcinfo); /* Check for null result, since caller is clearly not expecting one */ if (fcinfo.isnull) @@ -919,7 +919,7 @@ DirectFunctionCall8Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, fcinfo.argnull[6] = false; fcinfo.argnull[7] = false; - result = (*func) (&fcinfo); + result = func(&fcinfo); /* Check for null result, since caller is clearly not expecting one */ if (fcinfo.isnull) @@ -958,7 +958,7 @@ DirectFunctionCall9Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, fcinfo.argnull[7] = false; fcinfo.argnull[8] = false; - result = (*func) (&fcinfo); + result = func(&fcinfo); /* Check for null result, since caller is clearly not expecting one */ if (fcinfo.isnull) @@ -987,7 +987,7 @@ CallerFInfoFunctionCall1(PGFunction func, FmgrInfo *flinfo, Oid collation, Datum fcinfo.arg[0] = arg1; fcinfo.argnull[0] = false; - result = (*func) (&fcinfo); + result = func(&fcinfo); /* Check for null result, since caller is clearly not expecting one */ if (fcinfo.isnull) @@ -1009,7 +1009,7 @@ CallerFInfoFunctionCall2(PGFunction func, FmgrInfo *flinfo, Oid collation, Datum fcinfo.argnull[0] = false; fcinfo.argnull[1] = false; - result = (*func) (&fcinfo); + result = func(&fcinfo); /* Check for null result, since caller is clearly not expecting one */ if (fcinfo.isnull) diff --git a/src/include/utils/selfuncs.h b/src/include/utils/selfuncs.h index dc6069d435..199a6317f5 100644 --- a/src/include/utils/selfuncs.h +++ b/src/include/utils/selfuncs.h @@ -81,7 +81,7 @@ typedef struct VariableStatData #define ReleaseVariableStats(vardata) \ do { \ if (HeapTupleIsValid((vardata).statsTuple)) \ - (* (vardata).freefunc) ((vardata).statsTuple); \ + (vardata).freefunc((vardata).statsTuple); \ } while(0) -- 2.14.1
^ permalink raw reply [nested|flat] 12+ messages in thread

* Re: assorted code cleanup
  2017-08-17 16:56 assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
@ 2017-08-21 05:11 ` Michael Paquier <michael.paquier@gmail.com>
  2017-08-21 07:59   ` Re: assorted code cleanup Michael Meskes <meskes@postgresql.org>
  2017-08-25 16:52   ` Re: assorted code cleanup Robert Haas <robertmhaas@gmail.com>
  2017-09-05 19:12   ` Re: assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 3 replies; 12+ messages in thread

From: Michael Paquier @ 2017-08-21 05:11 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: pgsql-hackers

On Fri, Aug 18, 2017 at 1:56 AM, Peter Eisentraut
<peter.eisentraut@2ndquadrant.com> wrote:
> Here are a few assorted patches I made while working on the stdbool set,
> cleaning up various pieces of dead code and weird styles.
>
> - Drop excessive dereferencing of function pointers

-           (*next_ProcessUtility_hook) (pstmt, queryString,
+           next_ProcessUtility_hook(pstmt, queryString,
                                         context, params, queryEnv,
                                         dest, completionTag);
But this... Personally I like the current grammar which allows one to
make the difference between a function call with something declared
locally and something that may be going to a custom code path. So I
think that you had better not update the system hooks that external
modules can use via shared_preload_libraries.

> - Remove endof macro

Its last use is 1aa58d3a from 2009.

> - Remove unnecessary casts

Those are also quite old things:
src/include/access/attnum.h:    ((bool) ((attributeNumber) !=
InvalidAttrNumber))
src/include/access/attnum.h:    ((bool) ((attributeNumber) > 0))
src/backend/utils/hash/dynahash.c:      *foundPtr = (bool) (currBucket != NULL);
[... etc ...]

> - Remove unnecessary parentheses in return statements

So you would still keep parenthesis like here for simple expressions:
contrib/bloom/blutils.c:    return (x - 1);
No objections.

Here are some more:
contrib/intarray/_int_bool.c:       return (calcnot) ?
contrib/ltree/ltxtquery_op.c:       return (calcnot) ?

And there are many "(0)" "S_ANYTHING" in src/interfaces/ecpg/test/ and
src/interfaces/ecpg/preproc/.

src/port/ stuff is better left off, good you did not touch it.

> - Remove our own definition of NULL

Fine. c.h uses once NULL before enforcing its definition.

> - fuzzystrmatch: Remove dead code

Those are remnants of a323ede, which missed to removed everything.
Looks good to me.
-- 
Michael


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: assorted code cleanup
  2017-08-17 16:56 assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-08-21 05:11 ` Re: assorted code cleanup Michael Paquier <michael.paquier@gmail.com>
@ 2017-08-21 07:59   ` Michael Meskes <meskes@postgresql.org>
  2 siblings, 0 replies; 12+ messages in thread

From: Michael Meskes @ 2017-08-21 07:59 UTC (permalink / raw)
  To: pgsql-hackers

> And there are many "(0)" "S_ANYTHING" in src/interfaces/ecpg/test/ and
> src/interfaces/ecpg/preproc/.

I might have missed something here, but where/why is S_ANYTHING a problem?

Michael
-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: assorted code cleanup
  2017-08-17 16:56 assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-08-21 05:11 ` Re: assorted code cleanup Michael Paquier <michael.paquier@gmail.com>
@ 2017-08-25 16:52   ` Robert Haas <robertmhaas@gmail.com>
  2017-08-29 07:32     ` Re: assorted code cleanup Ryan Murphy <ryanfmurphy@gmail.com>
  2 siblings, 1 reply; 12+ messages in thread

From: Robert Haas @ 2017-08-25 16:52 UTC (permalink / raw)
  To: Michael Paquier <michael.paquier@gmail.com>; +Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers

On Mon, Aug 21, 2017 at 1:11 AM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On Fri, Aug 18, 2017 at 1:56 AM, Peter Eisentraut
> <peter.eisentraut@2ndquadrant.com> wrote:
>> Here are a few assorted patches I made while working on the stdbool set,
>> cleaning up various pieces of dead code and weird styles.
>>
>> - Drop excessive dereferencing of function pointers
>
> -           (*next_ProcessUtility_hook) (pstmt, queryString,
> +           next_ProcessUtility_hook(pstmt, queryString,
>                                          context, params, queryEnv,
>                                          dest, completionTag);
> But this... Personally I like the current grammar which allows one to
> make the difference between a function call with something declared
> locally and something that may be going to a custom code path.

+1.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: assorted code cleanup
  2017-08-17 16:56 assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-08-21 05:11 ` Re: assorted code cleanup Michael Paquier <michael.paquier@gmail.com>
  2017-08-25 16:52   ` Re: assorted code cleanup Robert Haas <robertmhaas@gmail.com>
@ 2017-08-29 07:32     ` Ryan Murphy <ryanfmurphy@gmail.com>
  2017-09-05 19:08       ` Re: assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 1 reply; 12+ messages in thread

From: Ryan Murphy @ 2017-08-29 07:32 UTC (permalink / raw)
  To: pgsql-hackers; +Cc: Peter Eisentraut <peter_e@gmx.net>

The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       tested, passed
Spec compliant:           tested, passed
Documentation:            tested, passed

I've reviewed the code changes, and it's pretty clear to me that they clean things up a bit while not changing any behavior.  They simplify things in a way that make the code more comprehensible.  I've run all the tests and they behave the same way as they did before the patch.  I also trying manually playing around the the function in question, `metaphone`, and it seems to behave the same as before.

I think it's ready to commit!

The new status of this patch is: Ready for Committer

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: assorted code cleanup
  2017-08-17 16:56 assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-08-21 05:11 ` Re: assorted code cleanup Michael Paquier <michael.paquier@gmail.com>
  2017-08-25 16:52   ` Re: assorted code cleanup Robert Haas <robertmhaas@gmail.com>
  2017-08-29 07:32     ` Re: assorted code cleanup Ryan Murphy <ryanfmurphy@gmail.com>
@ 2017-09-05 19:08       ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 0 replies; 12+ messages in thread

From: Peter Eisentraut @ 2017-09-05 19:08 UTC (permalink / raw)
  To: Ryan Murphy <ryanfmurphy@gmail.com>; pgsql-hackers

On 8/29/17 03:32, Ryan Murphy wrote:
> The following review has been posted through the commitfest application:
> make installcheck-world:  tested, passed
> Implements feature:       tested, passed
> Spec compliant:           tested, passed
> Documentation:            tested, passed
> 
> I've reviewed the code changes, and it's pretty clear to me that they clean things up a bit while not changing any behavior.  They simplify things in a way that make the code more comprehensible.  I've run all the tests and they behave the same way as they did before the patch.  I also trying manually playing around the the function in question, `metaphone`, and it seems to behave the same as before.
> 
> I think it's ready to commit!
> 
> The new status of this patch is: Ready for Committer

Pushed, except the one with the function pointers, which some people
didn't like.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: assorted code cleanup
  2017-08-17 16:56 assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-08-21 05:11 ` Re: assorted code cleanup Michael Paquier <michael.paquier@gmail.com>
@ 2017-09-05 19:12   ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-09-05 19:32     ` Re: assorted code cleanup Tom Lane <tgl@sss.pgh.pa.us>
  2017-09-06 06:01     ` Re: assorted code cleanup Michael Paquier <michael.paquier@gmail.com>
  2 siblings, 2 replies; 12+ messages in thread

From: Peter Eisentraut @ 2017-09-05 19:12 UTC (permalink / raw)
  To: Michael Paquier <michael.paquier@gmail.com>; +Cc: pgsql-hackers

On 8/21/17 01:11, Michael Paquier wrote:
>> - Drop excessive dereferencing of function pointers
> 
> -           (*next_ProcessUtility_hook) (pstmt, queryString,
> +           next_ProcessUtility_hook(pstmt, queryString,
>                                          context, params, queryEnv,
>                                          dest, completionTag);
> But this... Personally I like the current grammar which allows one to
> make the difference between a function call with something declared
> locally and something that may be going to a custom code path. So I
> think that you had better not update the system hooks that external
> modules can use via shared_preload_libraries.

Do you mean specifically the hook variables, or any function pointers?
I can see your point in the above case, but for example here

-       if ((*tinfo->f_lt) (o.upper, c.upper, flinfo))
+       if (tinfo->f_lt(o.upper, c.upper, flinfo))

I think there is no loss of clarity and the extra punctuation makes it
more complicated to read.

>> - Remove unnecessary parentheses in return statements
> 
> So you would still keep parenthesis like here for simple expressions:
> contrib/bloom/blutils.c:    return (x - 1);
> No objections.
> 
> Here are some more:
> contrib/intarray/_int_bool.c:       return (calcnot) ?
> contrib/ltree/ltxtquery_op.c:       return (calcnot) ?
> 
> And there are many "(0)" "S_ANYTHING" in src/interfaces/ecpg/test/ and
> src/interfaces/ecpg/preproc/.

Thanks, I included these.

>> - Remove our own definition of NULL
> 
> Fine. c.h uses once NULL before enforcing its definition.

Actually, that would have worked fine, because the earlier use is a
macro definition, so NULL would not have been needed until it is used.

>> - fuzzystrmatch: Remove dead code
> 
> Those are remnants of a323ede, which missed to removed everything.

Good reference, makes sense.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: assorted code cleanup
  2017-08-17 16:56 assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-08-21 05:11 ` Re: assorted code cleanup Michael Paquier <michael.paquier@gmail.com>
  2017-09-05 19:12   ` Re: assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
@ 2017-09-05 19:32     ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-09-07 18:00       ` Re: assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  1 sibling, 1 reply; 12+ messages in thread

From: Tom Lane @ 2017-09-05 19:32 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: Michael Paquier <michael.paquier@gmail.com>; pgsql-hackers

Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> Do you mean specifically the hook variables, or any function pointers?
> I can see your point in the above case, but for example here

> -       if ((*tinfo->f_lt) (o.upper, c.upper, flinfo))
> +       if (tinfo->f_lt(o.upper, c.upper, flinfo))

> I think there is no loss of clarity and the extra punctuation makes it
> more complicated to read.

At one time there were C compilers that only accepted the former syntax.
But we have already occurrences of the latter in our tree, and no one
has complained, so I think that's a dead issue by now.

I do agree with the idea that we should use the * notation in cases where
the reader might otherwise think that a plain function was being invoked,
ie I don't like

	some_function_pointer(args);

Even if the compiler isn't confused, readers might be.  But in the case of

	structname->pointerfield(args);

it's impossible to read that as a plain function call, so I'm okay with
dropping the extra punctuation there.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: assorted code cleanup
  2017-08-17 16:56 assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-08-21 05:11 ` Re: assorted code cleanup Michael Paquier <michael.paquier@gmail.com>
  2017-09-05 19:12   ` Re: assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-09-05 19:32     ` Re: assorted code cleanup Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-09-07 18:00       ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-09-07 18:53         ` Re: assorted code cleanup Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 12+ messages in thread

From: Peter Eisentraut @ 2017-09-07 18:00 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Michael Paquier <michael.paquier@gmail.com>; pgsql-hackers

On 9/5/17 15:32, Tom Lane wrote:
> At one time there were C compilers that only accepted the former syntax.

Correct.  Explanation here: http://c-faq.com/ptrs/funccall.html

> I do agree with the idea that we should use the * notation in cases where
> the reader might otherwise think that a plain function was being invoked,
> ie I don't like
> 
> 	some_function_pointer(args);
> 
> Even if the compiler isn't confused, readers might be.  But in the case of
> 
> 	structname->pointerfield(args);
> 
> it's impossible to read that as a plain function call, so I'm okay with
> dropping the extra punctuation there.

Committed that way.  Thanks.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: assorted code cleanup
  2017-08-17 16:56 assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-08-21 05:11 ` Re: assorted code cleanup Michael Paquier <michael.paquier@gmail.com>
  2017-09-05 19:12   ` Re: assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-09-05 19:32     ` Re: assorted code cleanup Tom Lane <tgl@sss.pgh.pa.us>
  2017-09-07 18:00       ` Re: assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
@ 2017-09-07 18:53         ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-09-11 18:48           ` Re: assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 1 reply; 12+ messages in thread

From: Tom Lane @ 2017-09-07 18:53 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: Michael Paquier <michael.paquier@gmail.com>; pgsql-hackers

Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 9/5/17 15:32, Tom Lane wrote:
>> I do agree with the idea that we should use the * notation in cases where
>> the reader might otherwise think that a plain function was being invoked,
>> ie I don't like
>> some_function_pointer(args);
>> Even if the compiler isn't confused, readers might be.  But in the case of
>> structname->pointerfield(args);
>> it's impossible to read that as a plain function call, so I'm okay with
>> dropping the extra punctuation there.

> Committed that way.  Thanks.

Is it worth memorializing this in the docs somewhere, perhaps
"53.4. Miscellaneous Coding Conventions" ?

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: assorted code cleanup
  2017-08-17 16:56 assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-08-21 05:11 ` Re: assorted code cleanup Michael Paquier <michael.paquier@gmail.com>
  2017-09-05 19:12   ` Re: assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-09-05 19:32     ` Re: assorted code cleanup Tom Lane <tgl@sss.pgh.pa.us>
  2017-09-07 18:00       ` Re: assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-09-07 18:53         ` Re: assorted code cleanup Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-09-11 18:48           ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 0 replies; 12+ messages in thread

From: Peter Eisentraut @ 2017-09-11 18:48 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Michael Paquier <michael.paquier@gmail.com>; pgsql-hackers

On 9/7/17 14:53, Tom Lane wrote:
> Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
>> On 9/5/17 15:32, Tom Lane wrote:
>>> I do agree with the idea that we should use the * notation in cases where
>>> the reader might otherwise think that a plain function was being invoked,
>>> ie I don't like
>>> some_function_pointer(args);
>>> Even if the compiler isn't confused, readers might be.  But in the case of
>>> structname->pointerfield(args);
>>> it's impossible to read that as a plain function call, so I'm okay with
>>> dropping the extra punctuation there.
> 
>> Committed that way.  Thanks.
> 
> Is it worth memorializing this in the docs somewhere, perhaps
> "53.4. Miscellaneous Coding Conventions" ?

done

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: assorted code cleanup
  2017-08-17 16:56 assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-08-21 05:11 ` Re: assorted code cleanup Michael Paquier <michael.paquier@gmail.com>
  2017-09-05 19:12   ` Re: assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
@ 2017-09-06 06:01     ` Michael Paquier <michael.paquier@gmail.com>
  1 sibling, 0 replies; 12+ messages in thread

From: Michael Paquier @ 2017-09-06 06:01 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: pgsql-hackers

On Wed, Sep 6, 2017 at 4:12 AM, Peter Eisentraut
<peter.eisentraut@2ndquadrant.com> wrote:
> On 8/21/17 01:11, Michael Paquier wrote:
>>> - Drop excessive dereferencing of function pointers
>>
>> -           (*next_ProcessUtility_hook) (pstmt, queryString,
>> +           next_ProcessUtility_hook(pstmt, queryString,
>>                                          context, params, queryEnv,
>>                                          dest, completionTag);
>> But this... Personally I like the current grammar which allows one to
>> make the difference between a function call with something declared
>> locally and something that may be going to a custom code path. So I
>> think that you had better not update the system hooks that external
>> modules can use via shared_preload_libraries.
>
> Do you mean specifically the hook variables, or any function pointers?
> I can see your point in the above case, but for example here
>
> -       if ((*tinfo->f_lt) (o.upper, c.upper, flinfo))
> +       if (tinfo->f_lt(o.upper, c.upper, flinfo))
>
> I think there is no loss of clarity and the extra punctuation makes it
> more complicated to read.

I am referring only to hook variables here. For functions only used
internally by the backend, I agree that using a direct point to those
functions makes things better, because it is more easily possible to
make a difference with the hook paths. Keeping a different grammar for
local code and hook code allows readers to make a clearer difference
that both things have different concepts.
-- 
Michael


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 12+ messages in thread


end of thread, other threads:[~2017-09-11 18:48 UTC | newest]

Thread overview: 12+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-08-17 16:56 assorted code cleanup Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2017-08-21 05:11 ` Michael Paquier <michael.paquier@gmail.com>
2017-08-21 07:59   ` Michael Meskes <meskes@postgresql.org>
2017-08-25 16:52   ` Robert Haas <robertmhaas@gmail.com>
2017-08-29 07:32     ` Ryan Murphy <ryanfmurphy@gmail.com>
2017-09-05 19:08       ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2017-09-05 19:12   ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2017-09-05 19:32     ` Tom Lane <tgl@sss.pgh.pa.us>
2017-09-07 18:00       ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2017-09-07 18:53         ` Tom Lane <tgl@sss.pgh.pa.us>
2017-09-11 18:48           ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2017-09-06 06:01     ` Michael Paquier <michael.paquier@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox