[asterisk-commits] rizzo: branch rizzo/astobj2 r48557 - in
/team/rizzo/astobj2: ./ agi/ apps/ bu...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Dec 18 06:48:07 MST 2006
Author: rizzo
Date: Mon Dec 18 07:48:07 2006
New Revision: 48557
URL: http://svn.digium.com/view/asterisk?view=rev&rev=48557
Log:
merge from trunk
Modified:
team/rizzo/astobj2/Makefile
team/rizzo/astobj2/Makefile.moddir_rules
team/rizzo/astobj2/Makefile.rules
team/rizzo/astobj2/acinclude.m4
team/rizzo/astobj2/agi/Makefile
team/rizzo/astobj2/apps/app_queue.c
team/rizzo/astobj2/build_tools/prep_tarball
team/rizzo/astobj2/channels/chan_iax2.c
team/rizzo/astobj2/codecs/ilbc/Makefile
team/rizzo/astobj2/codecs/lpc10/Makefile
team/rizzo/astobj2/funcs/func_curl.c
team/rizzo/astobj2/funcs/func_realtime.c
team/rizzo/astobj2/include/asterisk.h
team/rizzo/astobj2/include/asterisk/autoconfig.h.in
team/rizzo/astobj2/main/Makefile
team/rizzo/astobj2/main/cli.c
team/rizzo/astobj2/main/manager.c
team/rizzo/astobj2/main/utils.c
team/rizzo/astobj2/utils/Makefile
team/rizzo/astobj2/utils/ael_main.c
team/rizzo/astobj2/utils/astman.c
team/rizzo/astobj2/utils/smsq.c
Modified: team/rizzo/astobj2/Makefile
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/Makefile?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/Makefile (original)
+++ team/rizzo/astobj2/Makefile Mon Dec 18 07:48:07 2006
@@ -181,6 +181,8 @@
ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
+ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
+
ifeq ($(AST_DEVMODE),yes)
ASTCFLAGS+=-Werror -Wunused
endif
@@ -237,10 +239,6 @@
SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
-SUBDIRS_CLEAN_DEPEND:=$(SUBDIRS:%=%-clean-depend)
-MOD_SUBDIRS_DEPEND:=$(MOD_SUBDIRS:%=%-depend)
-OTHER_SUBDIRS_DEPEND:=$(OTHER_SUBDIRS:%=%-depend)
-SUBDIRS_DEPEND:=$(OTHER_SUBDIRS_DEPEND) $(MOD_SUBDIRS_DEPEND)
SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
@@ -304,7 +302,7 @@
@$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDFLAGS)
@$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LIBS)
-$(SUBDIRS): depend makeopts.embed_rules
+$(SUBDIRS): include/asterisk/version.h include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
# ensure that all module subdirectories are processed before 'main' during
# a parallel build, since if there are modules selected to be embedded the
@@ -346,19 +344,13 @@
fi
@rm -f $@.tmp
-$(SUBDIRS_CLEAN_DEPEND):
- @$(MAKE) --no-print-directory -C $(@:-clean-depend=) clean-depend
-
$(SUBDIRS_CLEAN):
@$(MAKE) --no-print-directory -C $(@:-clean=) clean
-clean-depend: $(SUBDIRS_CLEAN_DEPEND)
-
-clean: $(SUBDIRS_CLEAN) clean-depend
+clean: $(SUBDIRS_CLEAN)
rm -f defaults.h
rm -f include/asterisk/build.h
rm -f include/asterisk/version.h
- rm -f .depend
@$(MAKE) -C menuselect clean
cp -f .cleancount .lastclean
@@ -402,7 +394,6 @@
grep ^C update.out | cut -b4- ; \
fi ; \
rm -f update.out; \
- $(MAKE) clean-depend; \
else \
echo "Not under version control"; \
fi
@@ -634,14 +625,6 @@
echo "We could not install init scripts for your operating system."; \
fi
-$(MOD_SUBDIRS_DEPEND):
- @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
-
-$(OTHER_SUBDIRS_DEPEND):
- @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
-
-depend: include/asterisk/version.h include/asterisk/buildopts.h include/asterisk/build.h defaults.h $(SUBDIRS_DEPEND)
-
sounds:
$(MAKE) -C sounds all
@@ -701,4 +684,4 @@
@echo "Generating input for menuselect ..."
@build_tools/prep_moduledeps > $@
-.PHONY: menuselect main sounds clean clean-depend dist-clean distclean all prereqs depend cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_CLEAN) $(SUBDIRS_CLEAN_DEPEND) $(SUBDIRS_DEPEND) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS)
+.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS)
Modified: team/rizzo/astobj2/Makefile.moddir_rules
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/Makefile.moddir_rules?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/Makefile.moddir_rules (original)
+++ team/rizzo/astobj2/Makefile.moddir_rules Mon Dec 18 07:48:07 2006
@@ -40,7 +40,7 @@
modules.link: $(addsuffix .o,$(filter $(EMBEDDED_MODS),$(C_MODS)))
modules.link: $(addsuffix .oo,$(filter $(EMBEDDED_MODS),$(CC_MODS)))
-.PHONY: clean clean-depend depend uninstall _all
+.PHONY: clean uninstall _all
ifneq ($(LOADABLE_MODS),)
_all: $(LOADABLE_MODS:%=%.so)
@@ -67,11 +67,9 @@
@for file in $(patsubst %,$(SUBDIR)/%,$(filter %.o,$^)); do echo "INPUT (../$${file})" >> $@; done
@for file in $(patsubst %,$(SUBDIR)/%,$(filter-out %.o,$^)); do echo "INPUT (../$${file})" >> $@; done
-clean-depend::
- rm -f .depend
-
-clean:: clean-depend
+clean::
rm -f *.so *.o *.oo
+ rm -f .*.o.d .*.oo.d
rm -f modules.link
install:: all
@@ -79,11 +77,6 @@
uninstall::
-ifneq ($(wildcard .depend),)
- include .depend
+ifneq ($(wildcard .*.d),)
+ include .*.d
endif
-
-depend: .depend
-
-.depend:
- ../build_tools/mkdep $(ASTCFLAGS) `ls *.c *.cc 2> /dev/null`
Modified: team/rizzo/astobj2/Makefile.rules
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/Makefile.rules?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/Makefile.rules (original)
+++ team/rizzo/astobj2/Makefile.rules Mon Dec 18 07:48:07 2006
@@ -38,11 +38,19 @@
%.o: %.c
$(ECHO_PREFIX) echo " [CC] $< -> $@"
+ifeq ($(AST_DEVMODE),yes)
+ $(CMD_PREFIX) $(CC) -o $@ -c $< $(ASTCFLAGS) -MMD -MT $@ -MF .$(subst /,_,$@).d -MP
+else
$(CMD_PREFIX) $(CC) -o $@ -c $< $(ASTCFLAGS)
+endif
%.oo: %.cc
$(ECHO_PREFIX) echo " [CXX] $< -> $@"
+ifeq ($(AST_DEVMODE),yes)
+ $(CMD_PREFIX) $(CXX) -o $@ -c $< $(ASTCFLAGS) -MMD -MT $@ -MF .$(subst /,_,$@).d -MP
+else
$(CMD_PREFIX) $(CXX) -o $@ -c $< $(ASTCFLAGS)
+endif
%.c: %.y
$(ECHO_PREFIX) echo " [BISON] $< -> $@"
Modified: team/rizzo/astobj2/acinclude.m4
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/acinclude.m4?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/acinclude.m4 (original)
+++ team/rizzo/astobj2/acinclude.m4 Mon Dec 18 07:48:07 2006
@@ -50,10 +50,10 @@
if test ${err} = "0" ; then AC_MSG_RESULT(fail) ; fi
AC_MSG_RESULT()
eval "a=\${${i}_OPTION}"
- AC_MSG_NOTICE(***)
- AC_MSG_NOTICE(*** The $i installation appears to be missing or broken.)
- AC_MSG_NOTICE(*** Either correct the installation, or run configure)
- AC_MSG_NOTICE(*** including --without-${a}.)
+ AC_MSG_NOTICE([***])
+ AC_MSG_NOTICE([*** The $i installation appears to be missing or broken.])
+ AC_MSG_NOTICE([*** Either correct the installation, or run configure])
+ AC_MSG_NOTICE([*** including --without-${a}.])
err=1
done
if test $err = 1 ; then exit 1; fi
Modified: team/rizzo/astobj2/agi/Makefile
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/agi/Makefile?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/agi/Makefile (original)
+++ team/rizzo/astobj2/agi/Makefile Mon Dec 18 07:48:07 2006
@@ -11,7 +11,7 @@
# the GNU General Public License
#
-.PHONY: clean clean-depend all depend uninstall
+.PHONY: clean all uninstall
AGIS=agi-test.agi eagi-test eagi-sphinx-test jukebox.agi
@@ -37,18 +37,11 @@
uninstall:
for x in $(AGIS); do rm -f $(DESTDIR)$(AGI_DIR)/$$x ; done
-clean-depend:
- rm -f .depend
-
-clean: clean-depend
+clean:
rm -f *.so *.o look eagi-test eagi-sphinx-test
+ rm -f .*.o.d .*.oo.d
rm -f strcompat.c
-ifneq ($(wildcard .depend),)
- include .depend
+ifneq ($(wildcard .*.d),)
+ include .*.d
endif
-
-depend: .depend
-
-.depend:
- ../build_tools/mkdep $(CFLAGS) `ls *.c`
Modified: team/rizzo/astobj2/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/apps/app_queue.c?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/apps/app_queue.c (original)
+++ team/rizzo/astobj2/apps/app_queue.c Mon Dec 18 07:48:07 2006
@@ -4035,141 +4035,107 @@
return 1;
}
-static int __queues_show(struct mansession *s, int manager, int fd, int argc, char **argv)
+/*! \brief direct ouput to manager or cli with proper terminator */
+static void do_print(struct mansession *s, int fd, const char *str)
+{
+ if (s)
+ astman_append(s, "%s\r\n", str);
+ else
+ ast_cli(fd, "%s\n", str);
+}
+
+static int __queues_show(struct mansession *s, int fd, int argc, char **argv)
{
struct call_queue *q;
- struct queue_ent *qe;
- struct member *mem;
- int pos, queue_show;
- time_t now;
- char max_buf[80];
- char *max;
- size_t max_left;
- float sl = 0;
- char *term = manager ? "\r\n" : "\n";
-
- time(&now);
- if (argc == 2)
- queue_show = 0;
- else if (argc == 3)
- queue_show = 1;
- else
+ struct ast_str *out = ast_str_alloca(80);
+ int found = 0;
+ time_t now = time(NULL);
+
+ if (argc != 2 && argc != 3)
return RESULT_SHOWUSAGE;
/* We only want to load realtime queues when a specific queue is asked for. */
- if (queue_show)
+ if (argc == 3) /* specific queue */
load_realtime_queue(argv[2]);
AST_LIST_LOCK(&queues);
- if (AST_LIST_EMPTY(&queues)) {
- AST_LIST_UNLOCK(&queues);
- if (queue_show) {
- if (s)
- astman_append(s, "No such queue: %s.%s",argv[2], term);
- else
- ast_cli(fd, "No such queue: %s.%s",argv[2], term);
- } else {
- if (s)
- astman_append(s, "No queues.%s", term);
- else
- ast_cli(fd, "No queues.%s", term);
- }
- return RESULT_SUCCESS;
- }
AST_LIST_TRAVERSE(&queues, q, list) {
+ float sl;
+
ast_mutex_lock(&q->lock);
- if (queue_show) {
- if (strcasecmp(q->name, argv[2]) != 0) {
- ast_mutex_unlock(&q->lock);
- if (!AST_LIST_NEXT(q, list)) {
- ast_cli(fd, "No such queue: %s.%s",argv[2], term);
- break;
- }
- continue;
- }
- }
- max_buf[0] = '\0';
- max = max_buf;
- max_left = sizeof(max_buf);
+ if (argc == 3 && !strcasecmp(q->name, argv[2])) {
+ ast_mutex_unlock(&q->lock);
+ continue;
+ }
+ found = 1;
+
+ ast_str_set(&out, 0, "%-12.12s has %d calls (max ", q->name, q->count);
if (q->maxlen)
- ast_build_string(&max, &max_left, "%d", q->maxlen);
+ ast_str_append(&out, 0, "%d", q->maxlen);
else
- ast_build_string(&max, &max_left, "unlimited");
+ ast_str_append(&out, 0, "unlimited");
sl = 0;
if (q->callscompleted > 0)
sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted);
- if (s)
- astman_append(s, "%-12.12s has %d calls (max %s) in '%s' strategy (%ds holdtime), W:%d, C:%d, A:%d, SL:%2.1f%% within %ds%s",
- q->name, q->count, max_buf, int2strat(q->strategy), q->holdtime, q->weight,
- q->callscompleted, q->callsabandoned,sl,q->servicelevel, term);
+ ast_str_append(&out, 0, ") in '%s' strategy (%ds holdtime), W:%d, C:%d, A:%d, SL:%2.1f%% within %ds",
+ int2strat(q->strategy), q->holdtime, q->weight,
+ q->callscompleted, q->callsabandoned,sl,q->servicelevel);
+ do_print(s, fd, out->str);
+ if (!q->members)
+ do_print(s, fd, " No Members");
+ else {
+ struct member *mem;
+
+ do_print(s, fd, " Members: ");
+ for (mem = q->members; mem; mem = mem->next) {
+ ast_str_set(&out, 0, " %s", mem->interface);
+ if (mem->penalty)
+ ast_str_append(&out, 0, " with penalty %d", mem->penalty);
+ ast_str_append(&out, 0, "%s%s (%s)",
+ mem->dynamic ? " (dynamic)" : "",
+ mem->paused ? " (paused)" : "",
+ devstate2str(mem->status));
+ if (mem->calls)
+ ast_str_append(&out, 0, " has taken %d calls (last was %ld secs ago)",
+ mem->calls, (long) (time(NULL) - mem->lastcall));
+ else
+ ast_str_append(&out, 0, " has taken no calls yet");
+ do_print(s, fd, out->str);
+ }
+ }
+ if (!q->head)
+ do_print(s, fd, " No Callers");
+ else {
+ struct queue_ent *qe;
+ int pos = 1;
+
+ do_print(s, fd, " Callers: ");
+ for (qe = q->head; qe; qe = qe->next) {
+ ast_str_set(&out, 0, " %d. %s (wait: %ld:%2.2ld, prio: %d)",
+ pos++, qe->chan->name, (long) (now - qe->start) / 60,
+ (long) (now - qe->start) % 60, qe->prio);
+ do_print(s, fd, out->str);
+ }
+ }
+ do_print(s, fd, ""); /* blank line between entries */
+ ast_mutex_unlock(&q->lock);
+ if (argc == 3) /* print a specific entry */
+ break;
+ }
+ AST_LIST_UNLOCK(&queues);
+ if (!found) {
+ if (argc == 3)
+ ast_str_set(&out, 0, "No such queue: %s.", argv[2]);
else
- ast_cli(fd, "%-12.12s has %d calls (max %s) in '%s' strategy (%ds holdtime), W:%d, C:%d, A:%d, SL:%2.1f%% within %ds%s",
- q->name, q->count, max_buf, int2strat(q->strategy), q->holdtime, q->weight, q->callscompleted, q->callsabandoned,sl,q->servicelevel, term);
- if (q->members) {
- if (s)
- astman_append(s, " Members: %s", term);
- else
- ast_cli(fd, " Members: %s", term);
- for (mem = q->members; mem; mem = mem->next) {
- max_buf[0] = '\0';
- max = max_buf;
- max_left = sizeof(max_buf);
- if (mem->penalty)
- ast_build_string(&max, &max_left, " with penalty %d", mem->penalty);
- if (mem->dynamic)
- ast_build_string(&max, &max_left, " (dynamic)");
- if (mem->paused)
- ast_build_string(&max, &max_left, " (paused)");
- ast_build_string(&max, &max_left, " (%s)", devstate2str(mem->status));
- if (mem->calls) {
- ast_build_string(&max, &max_left, " has taken %d calls (last was %ld secs ago)",
- mem->calls, (long) (time(NULL) - mem->lastcall));
- } else
- ast_build_string(&max, &max_left, " has taken no calls yet");
- if (s)
- astman_append(s, " %s%s%s", mem->interface, max_buf, term);
- else
- ast_cli(fd, " %s%s%s", mem->interface, max_buf, term);
- }
- } else if (s)
- astman_append(s, " No Members%s", term);
- else
- ast_cli(fd, " No Members%s", term);
- if (q->head) {
- pos = 1;
- if (s)
- astman_append(s, " Callers: %s", term);
- else
- ast_cli(fd, " Callers: %s", term);
- for (qe = q->head; qe; qe = qe->next) {
- if (s)
- astman_append(s, " %d. %s (wait: %ld:%2.2ld, prio: %d)%s",
- pos++, qe->chan->name, (long) (now - qe->start) / 60,
- (long) (now - qe->start) % 60, qe->prio, term);
- else
- ast_cli(fd, " %d. %s (wait: %ld:%2.2ld, prio: %d)%s", pos++,
- qe->chan->name, (long) (now - qe->start) / 60,
- (long) (now - qe->start) % 60, qe->prio, term);
- }
- } else if (s)
- astman_append(s, " No Callers%s", term);
- else
- ast_cli(fd, " No Callers%s", term);
- if (s)
- astman_append(s, "%s", term);
- else
- ast_cli(fd, "%s", term);
- ast_mutex_unlock(&q->lock);
- if (queue_show)
- break;
- }
- AST_LIST_UNLOCK(&queues);
+ ast_str_set(&out, 0, "No queues.");
+ do_print(s, fd, out->str);
+ }
return RESULT_SUCCESS;
}
static int queue_show(int fd, int argc, char **argv)
{
- return __queues_show(NULL, 0, fd, argc, argv);
+ return __queues_show(NULL, fd, argc, argv);
}
static char *complete_queue(const char *line, const char *word, int pos, int state)
@@ -4198,7 +4164,7 @@
{
char *a[] = { "queue", "show" };
- __queues_show(s, 1, -1, 2, a);
+ __queues_show(s, -1, 2, a);
astman_append(s, "\r\n\r\n"); /* Properly terminate Manager output */
return RESULT_SUCCESS;
Modified: team/rizzo/astobj2/build_tools/prep_tarball
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/build_tools/prep_tarball?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/build_tools/prep_tarball (original)
+++ team/rizzo/astobj2/build_tools/prep_tarball Mon Dec 18 07:48:07 2006
@@ -5,4 +5,4 @@
#
# It will be executed from the top-level directory of the project.
-make -C sounds all MENUSELECT_CORE_SOUNDS=CORE-SOUNDS-EN-GSM MENUSELECT_MOH=MOH-FREEPLAY-WAV WGET=wget
+make -C sounds all MENUSELECT_CORE_SOUNDS=CORE-SOUNDS-EN-GSM MENUSELECT_MOH=MOH-FREEPLAY-WAV WGET=wget DOWNLOAD=wget
Modified: team/rizzo/astobj2/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_iax2.c?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/channels/chan_iax2.c (original)
+++ team/rizzo/astobj2/channels/chan_iax2.c Mon Dec 18 07:48:07 2006
@@ -6311,8 +6311,8 @@
return 1;
if (packet_len < (sizeof(*meta) + sizeof(*mth))) {
- ast_log(LOG_WARNING, "midget meta trunk packet received (%d of %d min)\n", packet_len,
- (int)(sizeof(*meta) + sizeof(*mth)));
+ ast_log(LOG_WARNING, "midget meta trunk packet received (%d of %zd min)\n", packet_len,
+ sizeof(*meta) + sizeof(*mth));
return 1;
}
mth = (struct ast_iax2_meta_trunk_hdr *)(meta->data);
@@ -6455,7 +6455,7 @@
memcpy(&sin, &thread->iosin, sizeof(sin));
if (res < sizeof(*mh)) {
- ast_log(LOG_WARNING, "midget packet received (%d of %d min)\n", res, (int)sizeof(*mh));
+ ast_log(LOG_WARNING, "midget packet received (%d of %zd min)\n", res, sizeof(*mh));
return 1;
}
if ((vh->zeros == 0) && (ntohs(vh->callno) & 0x8000)) {
@@ -6616,7 +6616,7 @@
}
/* A full frame */
if (res < sizeof(*fh)) {
- ast_log(LOG_WARNING, "midget packet received (%d of %d min)\n", res, (int)sizeof(*fh));
+ ast_log(LOG_WARNING, "midget packet received (%d of %zd min)\n", res, sizeof(*fh));
ast_mutex_unlock(&iaxsl[fr->callno]);
return 1;
}
Modified: team/rizzo/astobj2/codecs/ilbc/Makefile
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/codecs/ilbc/Makefile?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/codecs/ilbc/Makefile (original)
+++ team/rizzo/astobj2/codecs/ilbc/Makefile Mon Dec 18 07:48:07 2006
@@ -17,4 +17,4 @@
$(CMD_PREFIX) $(RANLIB) $@
clean:
- rm -f $(LIB) *.o
+ rm -f $(LIB) *.o .*.d
Modified: team/rizzo/astobj2/codecs/lpc10/Makefile
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/codecs/lpc10/Makefile?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/codecs/lpc10/Makefile (original)
+++ team/rizzo/astobj2/codecs/lpc10/Makefile Mon Dec 18 07:48:07 2006
@@ -74,4 +74,4 @@
$(CMD_PREFIX) $(RANLIB) $@
clean:
- rm -f *.o $(LIB)
+ rm -f *.o $(LIB) .*.d
Modified: team/rizzo/astobj2/funcs/func_curl.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/funcs/func_curl.c?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/funcs/func_curl.c (original)
+++ team/rizzo/astobj2/funcs/func_curl.c Mon Dec 18 07:48:07 2006
@@ -84,6 +84,21 @@
static const char *global_useragent = "asterisk-libcurl-agent/1.0";
+static int curl_instance_init(void *data)
+{
+ CURL **curl = data;
+
+ if (!(*curl = curl_easy_init()))
+ return -1;
+
+ curl_easy_setopt(*curl, CURLOPT_NOSIGNAL, 1);
+ curl_easy_setopt(*curl, CURLOPT_TIMEOUT, 180);
+ curl_easy_setopt(*curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
+ curl_easy_setopt(*curl, CURLOPT_USERAGENT, global_useragent);
+
+ return 0;
+}
+
static void curl_instance_cleanup(void *data)
{
CURL **curl = data;
@@ -99,15 +114,6 @@
if (!(curl = ast_threadstorage_get(&curl_instance, sizeof(*curl))))
return -1;
-
- if (!*curl) {
- if (!(*curl = curl_easy_init()))
- return -1;
- curl_easy_setopt(*curl, CURLOPT_NOSIGNAL, 1);
- curl_easy_setopt(*curl, CURLOPT_TIMEOUT, 180);
- curl_easy_setopt(*curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
- curl_easy_setopt(*curl, CURLOPT_USERAGENT, global_useragent);
- }
curl_easy_setopt(*curl, CURLOPT_URL, url);
curl_easy_setopt(*curl, CURLOPT_WRITEDATA, (void *) chunk);
Modified: team/rizzo/astobj2/funcs/func_realtime.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/funcs/func_realtime.c?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/funcs/func_realtime.c (original)
+++ team/rizzo/astobj2/funcs/func_realtime.c Mon Dec 18 07:48:07 2006
@@ -49,8 +49,9 @@
{
struct ast_variable *var, *head;
struct ast_module_user *u;
- char *results;
- size_t resultslen = 0;
+ struct ast_str *out;
+ size_t resultslen;
+ int n;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(family);
AST_APP_ARG(fieldmatch);
@@ -80,13 +81,17 @@
ast_module_user_remove(u);
return -1;
}
+ resultslen = 0;
+ n = 0;
+ for (var = head; var; n++, var = var->next)
+ resultslen += strlen(var->name) + strlen(var->value);
+ /* add space for delimiters and final '\0' */
+ resultslen += n * (strlen(args.delim1) + strlen(args.delim2)) + 1;
+
+ out = ast_str_alloca(resultslen);
for (var = head; var; var = var->next)
- resultslen += strlen(var->name) + strlen(var->value) + 2;
-
- results = alloca(resultslen);
- for (var = head; var; var = var->next)
- ast_build_string(&results, &resultslen, "%s%s%s%s", var->name, args.delim2, var->value, args.delim1);
- ast_copy_string(buf, results, len);
+ ast_str_append(&out, 0, "%s%s%s%s", var->name, args.delim2, var->value, args.delim1);
+ ast_copy_string(buf, out->str, len);
ast_module_user_remove(u);
Modified: team/rizzo/astobj2/include/asterisk.h
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/include/asterisk.h?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/include/asterisk.h (original)
+++ team/rizzo/astobj2/include/asterisk.h Mon Dec 18 07:48:07 2006
@@ -18,6 +18,13 @@
#ifndef _ASTERISK_H
#define _ASTERISK_H
+/* The include of 'autoconfig.h' is not necessary for any modules that
+ are part of the Asterisk source tree, because the top-level Makefile
+ will forcibly include that header in all compilations before all
+ other headers (even system headers). However, leaving this here will
+ help out-of-tree module builders, and doesn't cause any harm for the
+ in-tree modules.
+*/
#include "asterisk/autoconfig.h"
#include "asterisk/compat.h"
Modified: team/rizzo/astobj2/include/asterisk/autoconfig.h.in
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/include/asterisk/autoconfig.h.in?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/include/asterisk/autoconfig.h.in (original)
+++ team/rizzo/astobj2/include/asterisk/autoconfig.h.in Mon Dec 18 07:48:07 2006
@@ -658,6 +658,13 @@
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
+/* Define to 1 if on AIX 3.
+ System headers sometimes define this.
+ We just want to avoid a redefinition error message. */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
@@ -671,6 +678,27 @@
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
+
+/* Define to 1 if on MINIX. */
+#undef _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+ this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE
+
+/* Enable extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
/* Define like PROTOTYPES; this can be used by system headers. */
#undef __PROTOTYPES
Modified: team/rizzo/astobj2/main/Makefile
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/main/Makefile?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/main/Makefile (original)
+++ team/rizzo/astobj2/main/Makefile Mon Dec 18 07:48:07 2006
@@ -142,7 +142,7 @@
clean::
rm -f asterisk
- rm -f .depend
+ rm -f db1-ast/.*.d
@if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
@$(MAKE) -C db1-ast clean
@$(MAKE) -C stdtime clean
Modified: team/rizzo/astobj2/main/cli.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/main/cli.c?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/main/cli.c (original)
+++ team/rizzo/astobj2/main/cli.c Mon Dec 18 07:48:07 2006
@@ -332,8 +332,7 @@
static void print_uptimestr(int fd, time_t timeval, const char *prefix, int printsec)
{
int x; /* the main part - years, weeks, etc. */
- char timestr[256]="", *s = timestr;
- size_t maxbytes = sizeof(timestr);
+ struct ast_str *out;
#define SECOND (1)
#define MINUTE (SECOND*60)
@@ -344,40 +343,41 @@
#define NEEDCOMMA(x) ((x)? ",": "") /* define if we need a comma */
if (timeval < 0) /* invalid, nothing to show */
return;
+
if (printsec) { /* plain seconds output */
- ast_build_string(&s, &maxbytes, "%lu", (u_long)timeval);
- timeval = 0; /* bypass the other cases */
- }
+ ast_cli(fd, "%s: %lu\n", prefix, (u_long)timeval);
+ return;
+ }
+ out = ast_str_alloca(256);
if (timeval > YEAR) {
x = (timeval / YEAR);
timeval -= (x * YEAR);
- ast_build_string(&s, &maxbytes, "%d year%s%s ", x, ESS(x),NEEDCOMMA(timeval));
+ ast_str_append(&out, 0, "%d year%s%s ", x, ESS(x),NEEDCOMMA(timeval));
}
if (timeval > WEEK) {
x = (timeval / WEEK);
timeval -= (x * WEEK);
- ast_build_string(&s, &maxbytes, "%d week%s%s ", x, ESS(x),NEEDCOMMA(timeval));
+ ast_str_append(&out, 0, "%d week%s%s ", x, ESS(x),NEEDCOMMA(timeval));
}
if (timeval > DAY) {
x = (timeval / DAY);
timeval -= (x * DAY);
- ast_build_string(&s, &maxbytes, "%d day%s%s ", x, ESS(x),NEEDCOMMA(timeval));
+ ast_str_append(&out, 0, "%d day%s%s ", x, ESS(x),NEEDCOMMA(timeval));
}
if (timeval > HOUR) {
x = (timeval / HOUR);
timeval -= (x * HOUR);
- ast_build_string(&s, &maxbytes, "%d hour%s%s ", x, ESS(x),NEEDCOMMA(timeval));
+ ast_str_append(&out, 0, "%d hour%s%s ", x, ESS(x),NEEDCOMMA(timeval));
}
if (timeval > MINUTE) {
x = (timeval / MINUTE);
timeval -= (x * MINUTE);
- ast_build_string(&s, &maxbytes, "%d minute%s%s ", x, ESS(x),NEEDCOMMA(timeval));
+ ast_str_append(&out, 0, "%d minute%s%s ", x, ESS(x),NEEDCOMMA(timeval));
}
x = timeval;
- if (x > 0)
- ast_build_string(&s, &maxbytes, "%d second%s ", x, ESS(x));
- if (timestr[0] != '\0')
- ast_cli(fd, "%s: %s\n", prefix, timestr);
+ if (x > 0 || out->used == 0) /* if there is nothing, print 0 seconds */
+ ast_str_append(&out, 0, "%d second%s ", x, ESS(x));
+ ast_cli(fd, "%s: %s\n", prefix, out->str);
}
static char * handle_showuptime(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Modified: team/rizzo/astobj2/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/main/manager.c?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/main/manager.c (original)
+++ team/rizzo/astobj2/main/manager.c Mon Dec 18 07:48:07 2006
@@ -114,12 +114,6 @@
static int num_sessions = 0;
static int manager_debug; /*!< enable some debugging code in the manager */
-
-AST_THREADSTORAGE(manager_event_buf);
-#define MANAGER_EVENT_BUF_INITSIZE 256
-
-AST_THREADSTORAGE(astman_append_buf);
-#define ASTMAN_APPEND_BUF_INITSIZE 256
/*!
* Descriptor for a manager session, either on the AMI socket or over HTTP.
@@ -302,24 +296,23 @@
};
/*! \brief Convert authority code to a list of options */
-static char *authority_to_str(int authority, char *res, int reslen)
+static char *authority_to_str(int authority, struct ast_str **res)
{
int i;
- char *dst = res, *sep = "";
- size_t len = reslen;
-
- res[0] = '\0';
+ char *sep = "";
+
+ (*res)->used = 0;
for (i = 0; i < (sizeof(perms) / sizeof(perms[0])) - 1; i++) {
if (authority & perms[i].num) {
- ast_build_string(&dst, &len, "%s%s", sep, perms[i].label);
+ ast_str_append(res, 0, "%s%s", sep, perms[i].label);
sep = ",";
}
}
- if (ast_strlen_zero(res)) /* replace empty string with something sensible */
- ast_copy_string(res, "<none>", reslen);
-
- return res;
+ if ((*res)->used == 0) /* replace empty string with something sensible */
+ ast_str_append(res, 0, "<none>");
+
+ return (*res)->str;
}
/*! Tells you if smallstr exists inside bigstr
@@ -423,7 +416,7 @@
static int handle_showmancmd(int fd, int argc, char *argv[])
{
struct manager_action *cur;
- char authority[80];
+ struct ast_str *authority = ast_str_alloca(80);
int num;
if (argc != 4)
@@ -435,7 +428,7 @@
if (!strcasecmp(cur->action, argv[num])) {
ast_cli(fd, "Action: %s\nSynopsis: %s\nPrivilege: %s\n%s\n",
cur->action, cur->synopsis,
- authority_to_str(cur->authority, authority, sizeof(authority) -1),
+ authority_to_str(cur->authority, &authority),
S_OR(cur->description, "") );
}
}
@@ -535,7 +528,7 @@
static int handle_showmancmds(int fd, int argc, char *argv[])
{
struct manager_action *cur;
- char authority[80];
+ struct ast_str *authority = ast_str_alloca(80);
char *format = " %-15.15s %-15.15s %-55.55s\n";
ast_cli(fd, format, "Action", "Privilege", "Synopsis");
@@ -543,7 +536,7 @@
ast_mutex_lock(&actionlock);
for (cur = first_action; cur; cur = cur->next) /* Walk the list of actions */
- ast_cli(fd, format, cur->action, authority_to_str(cur->authority, authority, sizeof(authority) -1), cur->synopsis);
+ ast_cli(fd, format, cur->action, authority_to_str(cur->authority, &authority), cur->synopsis);
ast_mutex_unlock(&actionlock);
return RESULT_SUCCESS;
@@ -763,7 +756,11 @@
return n < 0 ? -1 : 0;
}
-/*
+/* XXX see if it can be moved inside the function */
+AST_THREADSTORAGE(astman_append_buf);
+#define ASTMAN_APPEND_BUF_INITSIZE 256
+
+/*!
* utility functions for creating AMI replies
*/
void astman_append(struct mansession *s, const char *fmt, ...)
@@ -1228,13 +1225,14 @@
static int action_listcommands(struct mansession *s, struct message *m)
{
struct manager_action *cur;
- char temp[BUFSIZ];
+ struct ast_str *temp = ast_str_alloca(BUFSIZ); /* XXX very large ? */
astman_start_ack(s, m);
ast_mutex_lock(&actionlock);
for (cur = first_action; cur; cur = cur->next) { /* Walk the list of actions */
if ((s->writeperm & cur->authority) == cur->authority)
- astman_append(s, "%s: %s (Priv: %s)\r\n", cur->action, cur->synopsis, authority_to_str(cur->authority, temp, sizeof(temp)));
+ astman_append(s, "%s: %s (Priv: %s)\r\n",
+ cur->action, cur->synopsis, authority_to_str(cur->authority, &temp));
}
ast_mutex_unlock(&actionlock);
astman_append(s, "\r\n");
@@ -2267,14 +2265,18 @@
return 0;
}
+/* XXX see if can be moved inside the function */
+AST_THREADSTORAGE(manager_event_buf);
+#define MANAGER_EVENT_BUF_INITSIZE 256
+
/*! \brief manager_event: Send AMI event to client */
int __manager_event(int category, const char *event,
const char *file, int line, const char *func, const char *fmt, ...)
{
struct mansession *s;
struct manager_custom_hook *hook;
- char auth[80];
- char tmp[4096] = "";
+ struct ast_str *auth = ast_str_alloca(80);
+ const char *cat_str;
va_list ap;
struct timeval now;
struct ast_str *buf;
@@ -2286,9 +2288,10 @@
if (!(buf = ast_str_thread_get(&manager_event_buf, MANAGER_EVENT_BUF_INITSIZE)))
return -1;
+ cat_str = authority_to_str(category, &auth);
ast_str_set(&buf, 0,
"Event: %s\r\nPrivilege: %s\r\n",
- event, authority_to_str(category, auth, sizeof(auth)));
+ event, cat_str);
if (timestampevents) {
now = ast_tvnow();
@@ -2325,16 +2328,8 @@
AST_RWLIST_RDLOCK(&manager_hooks);
if (!AST_RWLIST_EMPTY(&manager_hooks)) {
- char *p;
- int len;
- snprintf(tmp, sizeof(tmp), "event: %s\r\nprivilege: %s\r\n", event, authority_to_str(category, tmp, sizeof(tmp)));
- len = strlen(tmp);
- p = tmp + len;
- va_start(ap, fmt);
- vsnprintf(p, sizeof(tmp) - len, fmt, ap);
- va_end(ap);
AST_RWLIST_TRAVERSE(&manager_hooks, hook, list) {
- hook->helper(category, event, tmp);
+ hook->helper(category, event, buf->str);
}
}
AST_RWLIST_UNLOCK(&manager_hooks);
Modified: team/rizzo/astobj2/main/utils.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/main/utils.c?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/main/utils.c (original)
+++ team/rizzo/astobj2/main/utils.c Mon Dec 18 07:48:07 2006
@@ -1003,19 +1003,15 @@
if (need > (*buf)->len && (max_len == 0 || (*buf)->len < max_len) ) {
if (max_len && max_len < need) /* truncate as needed */
need = max_len;
-
- /* We can only realloc malloc'ed space. */
- if ((*buf)->ts == DS_ALLOCA || (*buf)->ts == DS_STATIC)
+ else if (max_len == 0) /* if unbounded, give more room for next time */
+ need += 16 + need/4;
+ if (0) /* debugging */
+ ast_verbose("extend from %d to %d\n", (int)(*buf)->len, need);
+ if (ast_str_make_space(buf, need)) {
+ ast_verbose("failed to extend from %d to %d\n", (int)(*buf)->len, need);
return AST_DYNSTR_BUILD_FAILED;
- *buf = ast_realloc(*buf, need + sizeof(struct ast_str));
- if (*buf == NULL) /* XXX watch out, we leak memory here */
- return AST_DYNSTR_BUILD_FAILED;
- (*buf)->len = need;
-
+ }
(*buf)->str[offset] = '\0'; /* Truncate the partial write. */
-
- if ((*buf)->ts != DS_ALLOCA)
- pthread_setspecific((*buf)->ts->key, *buf);
/* va_end() and va_start() must be done before calling
* vsnprintf() again. */
Modified: team/rizzo/astobj2/utils/Makefile
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/utils/Makefile?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/utils/Makefile (original)
+++ team/rizzo/astobj2/utils/Makefile Mon Dec 18 07:48:07 2006
@@ -11,7 +11,7 @@
# the GNU General Public License
#
-.PHONY: clean clean-depend all depend uninstall
+.PHONY: clean all uninstall
ALL_UTILS:=astman smsq stereorize streamplayer aelparse muted
UTILS:=$(ALL_UTILS)
@@ -51,11 +51,9 @@
uninstall:
for x in $(ALL_UTILS); do rm -f $$x $(DESTDIR)$(ASTSBINDIR)/$$x; done
-clean-depend:
- rm -f .depend
-
-clean: clean-depend
+clean:
rm -f *.o $(ALL_UTILS) check_expr
+ rm -f .*.o.d .*.oo.d
rm -f md5.c strcompat.c ast_expr2.c ast_expr2f.c pbx_ael.c
rm -f aelparse.c aelbison.c
@@ -122,11 +120,6 @@
muted: muted.o
muted: LIBS+=$(AUDIO_LIBS)
-ifneq ($(wildcard .depend),)
- include .depend
+ifneq ($(wildcard .*.d),)
+ include .*.d
endif
-
-depend: .depend
-
-.depend:
- ../build_tools/mkdep $(ASTCFLAGS) `ls *.c`
Modified: team/rizzo/astobj2/utils/ael_main.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/utils/ael_main.c?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/utils/ael_main.c (original)
+++ team/rizzo/astobj2/utils/ael_main.c Mon Dec 18 07:48:07 2006
@@ -1,5 +1,3 @@
-#include "asterisk/autoconfig.h"
-
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
Modified: team/rizzo/astobj2/utils/astman.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/utils/astman.c?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/utils/astman.c (original)
+++ team/rizzo/astobj2/utils/astman.c Mon Dec 18 07:48:07 2006
@@ -22,8 +22,6 @@
*
*/
-#include "asterisk/autoconfig.h"
-
#include <newt.h>
#include <stdio.h>
#include <sys/time.h>
Modified: team/rizzo/astobj2/utils/smsq.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/utils/smsq.c?view=diff&rev=48557&r1=48556&r2=48557
==============================================================================
--- team/rizzo/astobj2/utils/smsq.c (original)
+++ team/rizzo/astobj2/utils/smsq.c Mon Dec 18 07:48:07 2006
@@ -16,8 +16,6 @@
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
-
-#include "asterisk/autoconfig.h"
#include <stdio.h>
#include <popt.h>
More information about the asterisk-commits
mailing list