summaryrefslogtreecommitdiff
path: root/src/interfaces/libpq
diff options
context:
space:
mode:
authorPeter Eisentraut2017-09-07 16:06:23 +0000
committerPeter Eisentraut2017-09-07 17:56:09 +0000
commit1356f78ea93395c107cbc75dc923e29a0efccd8a (patch)
treea06cc9e40efdf8382692fb79b5b22c3920f93b5f /src/interfaces/libpq
parent9d71323daca412e6e175595e1e42809fb5e1172d (diff)
Reduce excessive dereferencing of function pointers
It is equivalent in ANSI C to write (*funcptr) () and funcptr(). These two styles have been applied inconsistently. After discussion, we'll use the more verbose style for plain function pointer variables, to make it clear that it's a variable, and the shorter style when the function pointer is in a struct (s.func() or s->func()), because then it's clear that it's not a plain function name, and otherwise the excessive punctuation makes some of those invocations hard to read. Discussion: https://www.postgresql.org/message-id/f52c16db-14ed-757d-4b48-7ef360b1631d@2ndquadrant.com
Diffstat (limited to 'src/interfaces/libpq')
-rw-r--r--src/interfaces/libpq/fe-connect.c4
-rw-r--r--src/interfaces/libpq/fe-exec.c2
-rw-r--r--src/interfaces/libpq/fe-protocol2.c2
-rw-r--r--src/interfaces/libpq/fe-protocol3.c2
4 files changed, 5 insertions, 5 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index d0e97ecdd46..c580d91135a 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -6297,8 +6297,8 @@ defaultNoticeReceiver(void *arg, const PGresult *res)
{
(void) arg; /* not used */
if (res->noticeHooks.noticeProc != NULL)
- (*res->noticeHooks.noticeProc) (res->noticeHooks.noticeProcArg,
- PQresultErrorMessage(res));
+ res->noticeHooks.noticeProc(res->noticeHooks.noticeProcArg,
+ PQresultErrorMessage(res));
}
/*
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index a97e73cf99d..c24bce62dde 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -860,7 +860,7 @@ pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...)
/*
* Pass to receiver, then free it.
*/
- (*res->noticeHooks.noticeRec) (res->noticeHooks.noticeRecArg, res);
+ res->noticeHooks.noticeRec(res->noticeHooks.noticeRecArg, res);
}
PQclear(res);
}
diff --git a/src/interfaces/libpq/fe-protocol2.c b/src/interfaces/libpq/fe-protocol2.c
index a58f701e18b..83f74f39852 100644
--- a/src/interfaces/libpq/fe-protocol2.c
+++ b/src/interfaces/libpq/fe-protocol2.c
@@ -1055,7 +1055,7 @@ pqGetErrorNotice2(PGconn *conn, bool isError)
if (res)
{
if (res->noticeHooks.noticeRec != NULL)
- (*res->noticeHooks.noticeRec) (res->noticeHooks.noticeRecArg, res);
+ res->noticeHooks.noticeRec(res->noticeHooks.noticeRecArg, res);
PQclear(res);
}
}
diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c
index a484fe80a15..7da5fb28fb2 100644
--- a/src/interfaces/libpq/fe-protocol3.c
+++ b/src/interfaces/libpq/fe-protocol3.c
@@ -960,7 +960,7 @@ pqGetErrorNotice3(PGconn *conn, bool isError)
/* We can cheat a little here and not copy the message. */
res->errMsg = workBuf.data;
if (res->noticeHooks.noticeRec != NULL)
- (*res->noticeHooks.noticeRec) (res->noticeHooks.noticeRecArg, res);
+ res->noticeHooks.noticeRec(res->noticeHooks.noticeRecArg, res);
PQclear(res);
}
}