aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_config_pgsql.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-21 14:40:10 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-21 14:40:10 +0000
commit16927b7f7a7bce25329d1c2be0f31fbd789cb221 (patch)
tree9799cdd844ef78877a6446a6746e82e0c090bc9a /res/res_config_pgsql.c
parente935ee6eac3ecb38b704ea2e9c2e86309150ab84 (diff)
Merged revisions 83432 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r83432 | russell | 2007-09-21 09:37:20 -0500 (Fri, 21 Sep 2007) | 4 lines 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/trunk@83433 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_config_pgsql.c')
-rw-r--r--res/res_config_pgsql.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index dc1d8a02c..ce1174a54 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -820,7 +820,7 @@ static int parse_config(int reload)
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");
@@ -830,7 +830,7 @@ static int parse_config(int reload)
ast_config_destroy(config);
if (option_debug) {
- if (dbhost) {
+ if (!ast_strlen_zero(dbhost)) {
ast_debug(1, "Postgresql RealTime Host: %s\n", dbhost);
ast_debug(1, "Postgresql RealTime Port: %i\n", dbport);
} else {
@@ -868,7 +868,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)
@@ -909,15 +909,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);
}