[asterisk-commits] russell: branch russell/heap r175832 - in /team/russell/heap: ./ channels/ fo...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Feb 15 15:12:55 CST 2009


Author: russell
Date: Sun Feb 15 15:12:54 2009
New Revision: 175832

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=175832
Log:
sync with trunk, resolve conflict in ast_sched_report()

Modified:
    team/russell/heap/   (props changed)
    team/russell/heap/channels/chan_sip.c
    team/russell/heap/formats/format_ilbc.c
    team/russell/heap/include/asterisk/sched.h
    team/russell/heap/main/sched.c

Propchange: team/russell/heap/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/russell/heap/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Feb 15 15:12:54 2009
@@ -1,1 +1,1 @@
-/trunk:1-175807
+/trunk:1-175831

Modified: team/russell/heap/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/heap/channels/chan_sip.c?view=diff&rev=175832&r1=175831&r2=175832
==============================================================================
--- team/russell/heap/channels/chan_sip.c (original)
+++ team/russell/heap/channels/chan_sip.c Sun Feb 15 15:12:54 2009
@@ -14631,7 +14631,7 @@
 
 static char *sip_show_sched(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
-	char cbuf[2256];
+	struct ast_str *cbuf;
 	struct ast_cb_names cbnames = {9, { "retrans_pkt",
                                         "__sip_autodestruct",
                                         "expire_register",
@@ -14661,9 +14661,13 @@
 	case CLI_GENERATE:
 		return NULL;
 	}
+
+	cbuf = ast_str_alloca(2048);
+
 	ast_cli(a->fd, "\n");
-	ast_sched_report(sched, cbuf, sizeof(cbuf), &cbnames);
-	ast_cli(a->fd, "%s", cbuf);
+	ast_sched_report(sched, &cbuf, &cbnames);
+	ast_cli(a->fd, "%s", cbuf->str);
+
 	return CLI_SUCCESS;
 }
 

Modified: team/russell/heap/formats/format_ilbc.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/heap/formats/format_ilbc.c?view=diff&rev=175832&r1=175831&r2=175832
==============================================================================
--- team/russell/heap/formats/format_ilbc.c (original)
+++ team/russell/heap/formats/format_ilbc.c Sun Feb 15 15:12:54 2009
@@ -24,10 +24,6 @@
  * \arg File name extension: ilbc
  * \ingroup formats
  */
-
-/*** MODULEINFO
-        <defaultenabled>no</defaultenabled>
- ***/
 
 #include "asterisk.h"
 

Modified: team/russell/heap/include/asterisk/sched.h
URL: http://svn.digium.com/svn-view/asterisk/team/russell/heap/include/asterisk/sched.h?view=diff&rev=175832&r1=175831&r2=175832
==============================================================================
--- team/russell/heap/include/asterisk/sched.h (original)
+++ team/russell/heap/include/asterisk/sched.h Sun Feb 15 15:12:54 2009
@@ -147,13 +147,12 @@
 typedef int (*ast_sched_cb)(const void *data);
 #define AST_SCHED_CB(a) ((ast_sched_cb)(a))
 
-struct ast_cb_names
-{
+struct ast_cb_names {
 	int numassocs;
 	char *list[10];
 	ast_sched_cb cblist[10];
 };
-char *ast_sched_report(struct sched_context *con, char *buf, int bufsiz, struct ast_cb_names *cbnames);
+void ast_sched_report(struct sched_context *con, struct ast_str **buf, struct ast_cb_names *cbnames);
 		
 /*! \brief Adds a scheduled event
  * Schedule an event to take place at some point in the future.  callback

Modified: team/russell/heap/main/sched.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/heap/main/sched.c?view=diff&rev=175832&r1=175831&r2=175832
==============================================================================
--- team/russell/heap/main/sched.c (original)
+++ team/russell/heap/main/sched.c Sun Feb 15 15:12:54 2009
@@ -507,40 +507,40 @@
 	
 	return 0;
 }
-char *ast_sched_report(struct sched_context *con, char *buf, int bufsiz, struct ast_cb_names *cbnames)
-{
-	int *countlist,i;
-	//struct sched *cur;
-	char buf2[1200];
-	ast_sched_cb xxx = NULL;
-	
-	buf[0] = 0;
-	sprintf(buf, " Highwater = %d\n schedcnt = %d\n", con->highwater, con->schedcnt);
-	countlist = ast_calloc(sizeof(int),cbnames->numassocs+1);
-#if 0	
-	AST_DLLIST_TRAVERSE(&con->schedq, cur, list) {
+
+void ast_sched_report(struct sched_context *con, struct ast_str **buf, struct ast_cb_names *cbnames)
+{
+	int i, x;
+	struct sched *cur;
+	int countlist[cbnames->numassocs + 1];
+	size_t heap_size;
+	
+	ast_str_set(buf, 0, " Highwater = %d\n schedcnt = %d\n", con->highwater, con->schedcnt);
+
+	heap_size = ast_heap_size(con->sched_heap);
+
+	for (x = 1; x <= heap_size; x++) {
+		cur = ast_heap_peek(con->sched_heap, x);
 		/* match the callback to the cblist */
-		for (i=0;i<cbnames->numassocs;i++) {
-			if (cur->callback == cbnames->cblist[i])
+		for (i = 0; i < cbnames->numassocs; i++) {
+			if (cur->callback == cbnames->cblist[i]) {
 				break;
-		}
-		if (i < cbnames->numassocs)
+			}
+		}
+		if (i < cbnames->numassocs) {
 			countlist[i]++;
-		else {
-			xxx = cur->callback;
+		} else {
 			countlist[cbnames->numassocs]++;
 		}
 	}
-#endif
-	for (i=0;i<cbnames->numassocs;i++) {
-		sprintf(buf2,"    %s : %d\n", cbnames->list[i], countlist[i]);
-		strcat(buf, buf2);
-	}
-	sprintf(buf2,"   <unknown:%p> : %d\n", xxx, countlist[cbnames->numassocs]);
-	strcat( buf, buf2);
-	return buf;
-}
-
+
+	for (i = 0; i < cbnames->numassocs; i++) {
+		ast_str_append(buf, 0, "    %s : %d\n", cbnames->list[i], countlist[i]);
+	}
+
+	ast_str_append(buf, 0, "   <unknown> : %d\n", countlist[cbnames->numassocs]);
+}
+	
 /*! \brief Dump the contents of the scheduler to LOG_DEBUG */
 void ast_sched_dump(const struct sched_context *con)
 {




More information about the asterisk-commits mailing list