diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-09-21 14:37:20 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-09-21 14:37:20 +0000 |
commit | 02c2b2e2c1f00151ac2099ff68efda2ac89271a0 (patch) | |
tree | b76c4146efd5357b7e89db353ccebf4bdefa8e7b /res/res_config_pgsql.c | |
parent | ec43deabe7d576aca83ebbda30dfc0290e38ef3c (diff) |
gcc 4.2 has a new set of warnings dealing with cosnt pointers. This set of
changes gets all of Asterisk (minus chan_alsa for now) to compile with gcc 4.2.
(closes issue #10774, patch from qwell)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@83432 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_config_pgsql.c')
-rw-r--r-- | res/res_config_pgsql.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c index e58cbda49..0439d6bc8 100644 --- a/res/res_config_pgsql.c +++ b/res/res_config_pgsql.c @@ -667,7 +667,7 @@ static int parse_config(void) dbport = atoi(s); } - if (dbhost && !(s = ast_variable_retrieve(config, "general", "dbsock"))) { + if (!ast_strlen_zero(dbhost) && !(s = ast_variable_retrieve(config, "general", "dbsock"))) { ast_log(LOG_WARNING, "Postgresql RealTime: No database socket found, using '/tmp/pgsql.sock' as default.\n"); strcpy(dbsock, "/tmp/pgsql.sock"); @@ -676,7 +676,7 @@ static int parse_config(void) } ast_config_destroy(config); - if (dbhost) { + if (!ast_strlen_zero(dbhost)) { ast_log(LOG_DEBUG, "Postgresql RealTime Host: %s\n", dbhost); ast_log(LOG_DEBUG, "Postgresql RealTime Port: %i\n", dbport); } else { @@ -702,7 +702,7 @@ static int pgsql_reconnect(const char *database) pgsqlConn = NULL; } - if ((!pgsqlConn) && (dbhost || dbsock) && dbuser && dbpass && my_database) { + if ((!pgsqlConn) && (!ast_strlen_zero(dbhost) || !ast_strlen_zero(dbsock)) && !ast_strlen_zero(dbuser) && !ast_strlen_zero(dbpass) && !ast_strlen_zero(my_database)) { char *connInfo = NULL; unsigned int size = 100 + strlen(dbhost) + strlen(dbuser) @@ -744,15 +744,15 @@ static int realtime_pgsql_status(int fd, int argc, char **argv) int ctime = time(NULL) - connect_time; if (pgsqlConn && PQstatus(pgsqlConn) == CONNECTION_OK) { - if (dbhost) { + if (!ast_strlen_zero(dbhost)) { snprintf(status, 255, "Connected to %s@%s, port %d", dbname, dbhost, dbport); - } else if (dbsock) { + } else if (!ast_strlen_zero(dbsock)) { snprintf(status, 255, "Connected to %s on socket file %s", dbname, dbsock); } else { snprintf(status, 255, "Connected to %s@%s", dbname, dbhost); } - if (dbuser && *dbuser) { + if (!ast_strlen_zero(dbuser)) { snprintf(status2, 99, " with username %s", dbuser); } |