]> granicus.if.org Git - postgresql/commitdiff
dblink: Small code rearrangement for clarity
authorPeter Eisentraut <peter_e@gmx.net>
Wed, 5 Apr 2017 13:03:11 +0000 (09:03 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Wed, 5 Apr 2017 13:03:11 +0000 (09:03 -0400)
suggested by Tom Lane

contrib/dblink/dblink.c

index 1d5555afb6f12a7308d8e4ec9725514be3a23b93..44b67daedba699a82de7f23f3670b78f9e852d4c 100644 (file)
@@ -360,7 +360,7 @@ Datum
 dblink_open(PG_FUNCTION_ARGS)
 {
        PGresult   *res = NULL;
-       PGconn     *conn = NULL;
+       PGconn     *conn;
        char       *curname = NULL;
        char       *sql = NULL;
        char       *conname = NULL;
@@ -408,8 +408,8 @@ dblink_open(PG_FUNCTION_ARGS)
 
        if (!rconn || !rconn->conn)
                dblink_conn_not_avail(conname);
-       else
-               conn = rconn->conn;
+
+       conn = rconn->conn;
 
        /* If we are not in a transaction, start one */
        if (PQtransactionStatus(conn) == PQTRANS_IDLE)
@@ -451,7 +451,7 @@ PG_FUNCTION_INFO_V1(dblink_close);
 Datum
 dblink_close(PG_FUNCTION_ARGS)
 {
-       PGconn     *conn = NULL;
+       PGconn     *conn;
        PGresult   *res = NULL;
        char       *curname = NULL;
        char       *conname = NULL;
@@ -495,8 +495,8 @@ dblink_close(PG_FUNCTION_ARGS)
 
        if (!rconn || !rconn->conn)
                dblink_conn_not_avail(conname);
-       else
-               conn = rconn->conn;
+
+       conn = rconn->conn;
 
        appendStringInfo(&buf, "CLOSE %s", curname);