[asterisk-commits] branch kpfleming/vldtmf r8956 - in /team/kpfleming/vldtmf: ./ apps/ include/a...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Jan 31 14:21:06 MST 2006


Author: kpfleming
Date: Mon Jan 30 19:20:27 2006
New Revision: 8956

URL: http://svn.digium.com/view/asterisk?rev=8956&view=rev
Log:
finish conversion to use list macros for (nearly all) frame lists

Modified:
    team/kpfleming/vldtmf/apps/app_milliwatt.c
    team/kpfleming/vldtmf/apps/app_mixmonitor.c
    team/kpfleming/vldtmf/include/asterisk/slinfactory.h
    team/kpfleming/vldtmf/slinfactory.c
    team/kpfleming/vldtmf/udptl.c

Modified: team/kpfleming/vldtmf/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/vldtmf/apps/app_milliwatt.c?rev=8956&r1=8955&r2=8956&view=diff
==============================================================================
--- team/kpfleming/vldtmf/apps/app_milliwatt.c (original)
+++ team/kpfleming/vldtmf/apps/app_milliwatt.c Mon Jan 30 19:20:27 2006
@@ -90,7 +90,7 @@
 	wf.src = "app_milliwatt";
 	wf.delivery.tv_sec = 0;
 	wf.delivery.tv_usec = 0;
-	wf.next = NULL;
+	AST_LIST_NEXT(&wf, next) = NULL;
 	/* create a buffer containing the digital milliwatt pattern */
 	for(i = 0; i < len; i++)
 	{

Modified: team/kpfleming/vldtmf/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/vldtmf/apps/app_mixmonitor.c?rev=8956&r1=8955&r2=8956&view=diff
==============================================================================
--- team/kpfleming/vldtmf/apps/app_mixmonitor.c (original)
+++ team/kpfleming/vldtmf/apps/app_mixmonitor.c Mon Jan 30 19:20:27 2006
@@ -235,7 +235,7 @@
 			   of frames if a queue flush was necessary, so process them
 			*/
 			for (; f; f = next) {
-				next = f->next;
+				next = AST_LIST_NEXT(f, next);
 				if (write)
 					ast_writestream(fs, f);
 				ast_frfree(f);

Modified: team/kpfleming/vldtmf/include/asterisk/slinfactory.h
URL: http://svn.digium.com/view/asterisk/team/kpfleming/vldtmf/include/asterisk/slinfactory.h?rev=8956&r1=8955&r2=8956&view=diff
==============================================================================
--- team/kpfleming/vldtmf/include/asterisk/slinfactory.h (original)
+++ team/kpfleming/vldtmf/include/asterisk/slinfactory.h Mon Jan 30 19:20:27 2006
@@ -23,17 +23,19 @@
 
 #ifndef _ASTERISK_SLINFACTORY_H
 #define _ASTERISK_SLINFACTORY_H
+
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
 
+#include "asterisk/frame.h"
 
 #if defined(__cplusplus) || defined(c_plusplus)
 extern "C" {
 #endif
 
 struct ast_slinfactory {
-	struct ast_frame *queue;
+	struct ast_frame_list *queue;
 	struct ast_trans_pvt *trans;
 	short hold[1280];
 	short *offset;
@@ -46,8 +48,6 @@
 void ast_slinfactory_destroy(struct ast_slinfactory *sf);
 int ast_slinfactory_feed(struct ast_slinfactory *sf, struct ast_frame *f);
 int ast_slinfactory_read(struct ast_slinfactory *sf, short *buf, size_t bytes);
-		 
-
 
 #if defined(__cplusplus) || defined(c_plusplus)
 }

Modified: team/kpfleming/vldtmf/slinfactory.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/vldtmf/slinfactory.c?rev=8956&r1=8955&r2=8956&view=diff
==============================================================================
--- team/kpfleming/vldtmf/slinfactory.c (original)
+++ team/kpfleming/vldtmf/slinfactory.c Mon Jan 30 19:20:27 2006
@@ -33,13 +33,13 @@
 #include "asterisk/slinfactory.h"
 #include "asterisk/logger.h"
 #include "asterisk/translate.h"
-
+#include "asterisk/linkedlists.h"
 
 void ast_slinfactory_init(struct ast_slinfactory *sf) 
 {
 	memset(sf, 0, sizeof(struct ast_slinfactory));
 	sf->offset = sf->hold;
-	sf->queue = NULL;
+	AST_LIST_HEAD_INIT_NOLOCK(sf->queue);
 }
 
 void ast_slinfactory_destroy(struct ast_slinfactory *sf) 
@@ -51,10 +51,8 @@
 		sf->trans = NULL;
 	}
 
-	while((f = sf->queue)) {
-		sf->queue = f->next;
+	while((f = AST_LIST_REMOVE_HEAD(sf->queue, next)))
 		ast_frfree(f);
-	}
 }
 
 int ast_slinfactory_feed(struct ast_slinfactory *sf, struct ast_frame *f)
@@ -88,16 +86,13 @@
 
 	if (frame) {
 		int x = 0;
-		for (frame_ptr = sf->queue; frame_ptr && frame_ptr->next; frame_ptr=frame_ptr->next) {
+
+		AST_LIST_INSERT_TAIL(sf->queue, frame, next);
+		sf->size += frame->datalen;	
+
+		AST_LIST_TRAVERSE(sf->queue, frame_ptr, next)
 			x++;
-		}
-		if (frame_ptr) {
-			frame_ptr->next = frame;
-		} else {
-			sf->queue = frame;
-		}
-		frame->next = NULL;
-		sf->size += frame->datalen;	
+
 		return x;
 	}
 
@@ -131,8 +126,7 @@
 			continue;
 		}
 		
-		if ((frame_ptr = sf->queue)) {
-			sf->queue = frame_ptr->next;
+		if ((frame_ptr = AST_LIST_REMOVE_HEAD(sf->queue, next))) {
 			frame_data = frame_ptr->data;
 			
 			if ((sofar + frame_ptr->datalen) <= ineed) {

Modified: team/kpfleming/vldtmf/udptl.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/vldtmf/udptl.c?rev=8956&r1=8955&r2=8956&view=diff
==============================================================================
--- team/kpfleming/vldtmf/udptl.c (original)
+++ team/kpfleming/vldtmf/udptl.c Mon Jan 30 19:20:27 2006
@@ -295,7 +295,7 @@
 
 	ptr = 0;
 	ifp_no = 0;
-	s->f[0].next = NULL;
+	AST_LIST_NEXT(&s->f[0], next) = NULL;
 
 	/* Decode seq_number */
 	if (ptr + 2 > len)
@@ -340,10 +340,10 @@
 					s->f[ifp_no].data = (uint8_t *) bufs[i - 1];
 					s->f[ifp_no].offset = 0;
 					s->f[ifp_no].src = "UDPTL";
-					if (ifp_no > 0) {
-						s->f[ifp_no - 1].next = &s->f[ifp_no];
-					}
-					s->f[ifp_no].next = NULL;
+					if (ifp_no > 0)
+						AST_LIST_NEXT(&s->f[ifp_no - 1], next) = &s->f[ifp_no];
+
+					AST_LIST_NEXT(&s->f[ifp_no], next) = NULL;
 					ifp_no++;
 				}
 			}
@@ -361,10 +361,10 @@
 			s->f[ifp_no].data = (uint8_t *) ifp;
 			s->f[ifp_no].offset = 0;
 			s->f[ifp_no].src = "UDPTL";
-			if (ifp_no > 0) {
-				s->f[ifp_no - 1].next = &s->f[ifp_no];
-			}
-			s->f[ifp_no].next = NULL;
+			if (ifp_no > 0)
+				AST_LIST_NEXT(&s->f[ifp_no - 1], next) = &s->f[ifp_no];
+
+			AST_LIST_NEXT(&s->f[ifp_no], next) = NULL;
 		}
 	}
 	else
@@ -461,10 +461,10 @@
 				s->f[ifp_no].data = s->rx[l].buf;
 				s->f[ifp_no].offset = 0;
 				s->f[ifp_no].src = "UDPTL";
-				if (ifp_no > 0) {
-					s->f[ifp_no - 1].next = &s->f[ifp_no];
-				}
-				s->f[ifp_no].next = NULL;
+				if (ifp_no > 0)
+					AST_LIST_NEXT(&s->f[ifp_no - 1], next) = &s->f[ifp_no];
+
+				AST_LIST_NEXT(&s->f[ifp_no], next) = NULL;
 				ifp_no++;
 			}
 		}
@@ -478,10 +478,10 @@
 		s->f[ifp_no].data = (uint8_t *) ifp;
 		s->f[ifp_no].offset = 0;
 		s->f[ifp_no].src = "UDPTL";
-		if (ifp_no > 0) {
-			s->f[ifp_no - 1].next = &s->f[ifp_no];
-		}
-		s->f[ifp_no].next = NULL;
+		if (ifp_no > 0)
+			AST_LIST_NEXT(&s->f[ifp_no - 1], next) = &s->f[ifp_no];
+
+		AST_LIST_NEXT(&s->f[ifp_no], next) = NULL;
 	}
 
 	s->rx_seq_no = seq_no + 1;



More information about the asterisk-commits mailing list