summaryrefslogtreecommitdiff
path: root/src/pq/pq_connect.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-10-05 15:09:28 +0200
committerChristian Grothoff <christian@grothoff.org>2019-10-05 15:09:28 +0200
commitc4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch)
treecac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/pq/pq_connect.c
parentfbb71d527c7d6babf269a8fefce1db291b9f7068 (diff)
downloadgnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.tar.gz
gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.zip
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/pq/pq_connect.c')
-rw-r--r--src/pq/pq_connect.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/src/pq/pq_connect.c b/src/pq/pq_connect.c
index 2ab049724..79b9d6107 100644
--- a/src/pq/pq_connect.c
+++ b/src/pq/pq_connect.c
@@ -36,8 +36,8 @@
36 * @param res information about some libpq event 36 * @param res information about some libpq event
37 */ 37 */
38static void 38static void
39pq_notice_receiver_cb(void *arg, 39pq_notice_receiver_cb (void *arg,
40 const PGresult *res) 40 const PGresult *res)
41{ 41{
42 /* do nothing, intentionally */ 42 /* do nothing, intentionally */
43} 43}
@@ -51,13 +51,13 @@ pq_notice_receiver_cb(void *arg,
51 * @param message information about some libpq event 51 * @param message information about some libpq event
52 */ 52 */
53static void 53static void
54pq_notice_processor_cb(void *arg, 54pq_notice_processor_cb (void *arg,
55 const char *message) 55 const char *message)
56{ 56{
57 GNUNET_log_from(GNUNET_ERROR_TYPE_INFO, 57 GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
58 "pq", 58 "pq",
59 "%s", 59 "%s",
60 message); 60 message);
61} 61}
62 62
63 63
@@ -70,32 +70,32 @@ pq_notice_processor_cb(void *arg,
70 * @return NULL on error 70 * @return NULL on error
71 */ 71 */
72PGconn * 72PGconn *
73GNUNET_PQ_connect(const char *config_str) 73GNUNET_PQ_connect (const char *config_str)
74{ 74{
75 PGconn *conn; 75 PGconn *conn;
76 76
77 conn = PQconnectdb(config_str); 77 conn = PQconnectdb (config_str);
78 if ((NULL == conn) || 78 if ((NULL == conn) ||
79 (CONNECTION_OK != 79 (CONNECTION_OK !=
80 PQstatus(conn))) 80 PQstatus (conn)))
81 { 81 {
82 GNUNET_log_from(GNUNET_ERROR_TYPE_ERROR, 82 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
83 "pq", 83 "pq",
84 "Database connection to '%s' failed: %s\n", 84 "Database connection to '%s' failed: %s\n",
85 config_str, 85 config_str,
86 (NULL != conn) ? 86 (NULL != conn) ?
87 PQerrorMessage(conn) 87 PQerrorMessage (conn)
88 : "PQconnectdb returned NULL"); 88 : "PQconnectdb returned NULL");
89 if (NULL != conn) 89 if (NULL != conn)
90 PQfinish(conn); 90 PQfinish (conn);
91 return NULL; 91 return NULL;
92 } 92 }
93 PQsetNoticeReceiver(conn, 93 PQsetNoticeReceiver (conn,
94 &pq_notice_receiver_cb, 94 &pq_notice_receiver_cb,
95 conn);
96 PQsetNoticeProcessor(conn,
97 &pq_notice_processor_cb,
98 conn); 95 conn);
96 PQsetNoticeProcessor (conn,
97 &pq_notice_processor_cb,
98 conn);
99 return conn; 99 return conn;
100} 100}
101 101
@@ -109,21 +109,21 @@ GNUNET_PQ_connect(const char *config_str)
109 * @return the postgres handle, NULL on error 109 * @return the postgres handle, NULL on error
110 */ 110 */
111PGconn * 111PGconn *
112GNUNET_PQ_connect_with_cfg(const struct GNUNET_CONFIGURATION_Handle * cfg, 112GNUNET_PQ_connect_with_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
113 const char *section) 113 const char *section)
114{ 114{
115 PGconn *dbh; 115 PGconn *dbh;
116 char *conninfo; 116 char *conninfo;
117 117
118 /* Open database and precompile statements */ 118 /* Open database and precompile statements */
119 if (GNUNET_OK != 119 if (GNUNET_OK !=
120 GNUNET_CONFIGURATION_get_value_string(cfg, 120 GNUNET_CONFIGURATION_get_value_string (cfg,
121 section, 121 section,
122 "CONFIG", 122 "CONFIG",
123 &conninfo)) 123 &conninfo))
124 conninfo = NULL; 124 conninfo = NULL;
125 dbh = GNUNET_PQ_connect(conninfo == NULL ? "" : conninfo); 125 dbh = GNUNET_PQ_connect (conninfo == NULL ? "" : conninfo);
126 GNUNET_free_non_null(conninfo); 126 GNUNET_free_non_null (conninfo);
127 return dbh; 127 return dbh;
128} 128}
129 129