summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/asterisk.c4
-rw-r--r--main/callerid.c2
-rw-r--r--main/config.c8
-rw-r--r--main/netsock2.c8
-rw-r--r--main/pbx.c10
-rw-r--r--main/sched.c35
-rw-r--r--main/stdtime/localtime.c6
-rw-r--r--main/utils.c3
8 files changed, 41 insertions, 35 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index 4c15d231f..e348b2199 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -331,6 +331,7 @@ int option_verbose; /*!< Verbosity level */
int option_debug; /*!< Debug level */
int ast_pjproject_max_log_level = -1;/* Default to -1 to know if we have read the level from pjproject yet. */
int ast_option_pjproject_log_level;
+int ast_option_pjproject_cache_pools;
double ast_option_maxload; /*!< Max load avg on system */
int ast_option_maxcalls; /*!< Max number of active calls */
int ast_option_maxfiles; /*!< Max number of open file handles (files, sockets) */
@@ -3744,6 +3745,7 @@ static void read_pjproject_startup_options(void)
struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE | CONFIG_FLAG_NOREALTIME };
ast_option_pjproject_log_level = DEFAULT_PJ_LOG_MAX_LEVEL;
+ ast_option_pjproject_cache_pools = DEFAULT_PJPROJECT_CACHE_POOLS;
cfg = ast_config_load2("pjproject.conf", "" /* core, can't reload */, config_flags);
if (!cfg
@@ -3762,6 +3764,8 @@ static void read_pjproject_startup_options(void)
} else if (MAX_PJ_LOG_MAX_LEVEL < ast_option_pjproject_log_level) {
ast_option_pjproject_log_level = MAX_PJ_LOG_MAX_LEVEL;
}
+ } else if (!strcasecmp(v->name, "cache_pools")) {
+ ast_option_pjproject_cache_pools = !ast_false(v->value);
}
}
diff --git a/main/callerid.c b/main/callerid.c
index d6f8575fb..6c4e5cf04 100644
--- a/main/callerid.c
+++ b/main/callerid.c
@@ -501,7 +501,7 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, s
case 0x06: /* short dial number */
case 0x07: /* reserved */
default: /* reserved */
- if (option_debug > 1)
+ if (DEBUG_ATLEAST(2))
ast_log(LOG_NOTICE, "did info:#1=%X\n", (unsigned)cid->rawdata[x]);
break ;
}
diff --git a/main/config.c b/main/config.c
index 27a61c299..dfa6f0923 100644
--- a/main/config.c
+++ b/main/config.c
@@ -2187,10 +2187,10 @@ static struct ast_config *config_text_file_load(const char *database, const char
lineno++;
if (fgets(buf, sizeof(buf), f)) {
/* Skip lines that are too long */
- if (strlen(buf) == sizeof(buf) - 1 && buf[sizeof(buf) - 1] != '\n') {
+ if (strlen(buf) == sizeof(buf) - 1 && buf[sizeof(buf) - 2] != '\n') {
ast_log(LOG_WARNING, "Line %d too long, skipping. It begins with: %.32s...\n", lineno, buf);
while (fgets(buf, sizeof(buf), f)) {
- if (strlen(buf) != sizeof(buf) - 1 || buf[sizeof(buf) - 1] == '\n') {
+ if (strlen(buf) != sizeof(buf) - 1 || buf[sizeof(buf) - 2] == '\n') {
break;
}
}
@@ -2777,9 +2777,7 @@ int ast_config_text_file_save2(const char *configfile, const struct ast_config *
}
cat = cat->next;
}
- if (!option_debug) {
- ast_verb(2, "Saving '%s': saved\n", fn);
- }
+ ast_verb(2, "Saving '%s': saved\n", fn);
} else {
ast_debug(1, "Unable to open for writing: %s\n", fn);
ast_verb(2, "Unable to write '%s' (%s)\n", fn, strerror(errno));
diff --git a/main/netsock2.c b/main/netsock2.c
index ef74ab92b..fedbd94a0 100644
--- a/main/netsock2.c
+++ b/main/netsock2.c
@@ -443,7 +443,7 @@ uint16_t _ast_sockaddr_port(const struct ast_sockaddr *addr, const char *file, i
&& addr->ss.ss_family == AF_INET6) {
return ntohs(((struct sockaddr_in6 *)&addr->ss)->sin6_port);
}
- if (option_debug >= 1) {
+ if (DEBUG_ATLEAST(1)) {
ast_log(__LOG_DEBUG, file, line, func, "Not an IPv4 nor IPv6 address, cannot get port.\n");
}
return 0;
@@ -461,7 +461,7 @@ void _ast_sockaddr_set_port(struct ast_sockaddr *addr, uint16_t port, const char
} else if (addr->len == sizeof(struct sockaddr_in6)
&& addr->ss.ss_family == AF_INET6) {
((struct sockaddr_in6 *)&addr->ss)->sin6_port = htons(port);
- } else if (option_debug >= 1) {
+ } else if (DEBUG_ATLEAST(1)) {
ast_log(__LOG_DEBUG, file, line, func,
"Not an IPv4 nor IPv6 address, cannot set port.\n");
}
@@ -657,7 +657,7 @@ int _ast_sockaddr_to_sin(const struct ast_sockaddr *addr,
return 0;
}
- if (addr->ss.ss_family != AF_INET && option_debug >= 1) {
+ if (addr->ss.ss_family != AF_INET && DEBUG_ATLEAST(1)) {
ast_log(__LOG_DEBUG, file, line, func, "Address family is not AF_INET\n");
}
@@ -670,7 +670,7 @@ void _ast_sockaddr_from_sin(struct ast_sockaddr *addr, const struct sockaddr_in
{
memcpy(&addr->ss, sin, sizeof(*sin));
- if (addr->ss.ss_family != AF_INET && option_debug >= 1) {
+ if (addr->ss.ss_family != AF_INET && DEBUG_ATLEAST(1)) {
ast_log(__LOG_DEBUG, file, line, func, "Address family is not AF_INET\n");
}
diff --git a/main/pbx.c b/main/pbx.c
index 942c15c05..70e72fe43 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -7508,13 +7508,13 @@ static int ast_add_extension2_lockopt(struct ast_context *con,
ast_add_hint(tmp);
}
}
- if (option_debug) {
+ if (DEBUG_ATLEAST(1)) {
if (tmp->matchcid == AST_EXT_MATCHCID_ON) {
- ast_debug(1, "Added extension '%s' priority %d (CID match '%s') to %s (%p)\n",
- tmp->name, tmp->priority, tmp->cidmatch_display, con->name, con);
+ ast_log(LOG_DEBUG, "Added extension '%s' priority %d (CID match '%s') to %s (%p)\n",
+ tmp->name, tmp->priority, tmp->cidmatch_display, con->name, con);
} else {
- ast_debug(1, "Added extension '%s' priority %d to %s (%p)\n",
- tmp->name, tmp->priority, con->name, con);
+ ast_log(LOG_DEBUG, "Added extension '%s' priority %d to %s (%p)\n",
+ tmp->name, tmp->priority, con->name, con);
}
}
diff --git a/main/sched.c b/main/sched.c
index a4ca260c6..d8afc74e6 100644
--- a/main/sched.c
+++ b/main/sched.c
@@ -31,10 +31,7 @@
#include "asterisk.h"
#ifdef DEBUG_SCHEDULER
-#define DEBUG(a) do { \
- if (option_debug) \
- DEBUG_M(a) \
- } while (0)
+#define DEBUG(a) a
#else
#define DEBUG(a)
#endif
@@ -548,8 +545,7 @@ int ast_sched_add_variable(struct ast_sched_context *con, int when, ast_sched_cb
}
#ifdef DUMP_SCHEDULER
/* Dump contents of the context while we have the lock so nothing gets screwed up by accident. */
- if (option_debug)
- ast_sched_dump(con);
+ ast_sched_dump(con);
#endif
if (con->sched_thread) {
ast_cond_signal(&con->sched_thread->cond);
@@ -649,8 +645,7 @@ int _ast_sched_del(struct ast_sched_context *con, int id, const char *file, int
#ifdef DUMP_SCHEDULER
/* Dump contents of the context while we have the lock so nothing gets screwed up by accident. */
- if (option_debug)
- ast_sched_dump(con);
+ ast_sched_dump(con);
#endif
if (con->sched_thread) {
ast_cond_signal(&con->sched_thread->cond);
@@ -711,25 +706,33 @@ void ast_sched_report(struct ast_sched_context *con, struct ast_str **buf, struc
void ast_sched_dump(struct ast_sched_context *con)
{
struct sched *q;
- struct timeval when = ast_tvnow();
+ struct timeval when;
int x;
size_t heap_size;
+
+ if (!DEBUG_ATLEAST(1)) {
+ return;
+ }
+
+ when = ast_tvnow();
#ifdef SCHED_MAX_CACHE
- ast_debug(1, "Asterisk Schedule Dump (%zu in Q, %u Total, %u Cache, %u high-water)\n", ast_heap_size(con->sched_heap), con->eventcnt - 1, con->schedccnt, con->highwater);
+ ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%zu in Q, %u Total, %u Cache, %u high-water)\n",
+ ast_heap_size(con->sched_heap), con->eventcnt - 1, con->schedccnt, con->highwater);
#else
- ast_debug(1, "Asterisk Schedule Dump (%zu in Q, %u Total, %u high-water)\n", ast_heap_size(con->sched_heap), con->eventcnt - 1, con->highwater);
+ ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%zu in Q, %u Total, %u high-water)\n",
+ ast_heap_size(con->sched_heap), con->eventcnt - 1, con->highwater);
#endif
- ast_debug(1, "=============================================================\n");
- ast_debug(1, "|ID Callback Data Time (sec:ms) |\n");
- ast_debug(1, "+-----+-----------------+-----------------+-----------------+\n");
+ ast_log(LOG_DEBUG, "=============================================================\n");
+ ast_log(LOG_DEBUG, "|ID Callback Data Time (sec:ms) |\n");
+ ast_log(LOG_DEBUG, "+-----+-----------------+-----------------+-----------------+\n");
ast_mutex_lock(&con->lock);
heap_size = ast_heap_size(con->sched_heap);
for (x = 1; x <= heap_size; x++) {
struct timeval delta;
q = ast_heap_peek(con->sched_heap, x);
delta = ast_tvsub(q->when, when);
- ast_debug(1, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n",
+ ast_log(LOG_DEBUG, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n",
q->sched_id->id,
q->callback,
q->data,
@@ -737,7 +740,7 @@ void ast_sched_dump(struct ast_sched_context *con)
(long int)delta.tv_usec);
}
ast_mutex_unlock(&con->lock);
- ast_debug(1, "=============================================================\n");
+ ast_log(LOG_DEBUG, "=============================================================\n");
}
/*! \brief
diff --git a/main/stdtime/localtime.c b/main/stdtime/localtime.c
index 2976e59c1..5134ec2b9 100644
--- a/main/stdtime/localtime.c
+++ b/main/stdtime/localtime.c
@@ -310,7 +310,7 @@ static struct state * sstate_alloc(void);
static void sstate_free(struct state *p);
static AST_LIST_HEAD_STATIC(zonelist, state);
-#ifdef HAVE_NEWLOCALE
+#if defined(HAVE_NEWLOCALE) && defined(HAVE_USELOCALE)
static AST_LIST_HEAD_STATIC(localelist, locale_entry);
#endif
@@ -504,7 +504,7 @@ static void *kqueue_daemon(void *data)
continue;
}
- sp = kev.udata;
+ sp = (struct state *) kev.udata;
AST_LIST_LOCK(&zonelist);
/* see comment near psx_sp in add_notify() */
@@ -2362,7 +2362,7 @@ struct timeval ast_mktime(struct ast_tm *tmp, const char *zone)
return time1(tmp, localsub, 0L, sp);
}
-#ifdef HAVE_NEWLOCALE
+#if defined(HAVE_NEWLOCALE) && defined(HAVE_USELOCALE)
static struct locale_entry *find_by_locale(locale_t locale)
{
struct locale_entry *cur;
diff --git a/main/utils.c b/main/utils.c
index dab8889a6..c2e07fccf 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -189,7 +189,9 @@ static int gethostbyname_r (const char *name, struct hostent *ret, char *buf,
*/
struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp)
{
+#ifndef HAVE_GETHOSTBYNAME_R_5
int res;
+#endif
int herrno;
int dots = 0;
const char *s;
@@ -199,7 +201,6 @@ struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp)
integers, we break with tradition and refuse to look up a
pure integer */
s = host;
- res = 0;
while (s && *s) {
if (*s == '.')
dots++;