[asterisk-commits] russell: trunk r41958 - in /trunk: include/asterisk/frame.h main/frame.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Sep 3 16:14:55 MST 2006


Author: russell
Date: Sun Sep  3 18:14:54 2006
New Revision: 41958

URL: http://svn.digium.com/view/asterisk?rev=41958&view=rev
Log:
Add the ability to specify that a frame should not be considered for caching
for uses in cases where you *know* that it will do no good.  This patch was
inspired by file for use in some work of his on mixmonitor/chanspy.

Modified:
    trunk/include/asterisk/frame.h
    trunk/main/frame.c

Modified: trunk/include/asterisk/frame.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/frame.h?rev=41958&r1=41957&r2=41958&view=diff
==============================================================================
--- trunk/include/asterisk/frame.h (original)
+++ trunk/include/asterisk/frame.h Sun Sep  3 18:14:54 2006
@@ -31,6 +31,8 @@
 
 #include <sys/types.h>
 #include <sys/time.h>
+
+#include "asterisk/compiler.h"
 #include "asterisk/endian.h"
 #include "asterisk/linkedlists.h"
 
@@ -354,12 +356,18 @@
 struct ast_frame *ast_fralloc(char *source, int len);
 #endif
 
-/*!  \brief Frees a frame 
+/*!  
+ * \brief Frees a frame 
+ * 
  * \param fr Frame to free
- * Free a frame, and the memory it used if applicable
- * \return no return.
- */
-void ast_frfree(struct ast_frame *fr);
+ * \param cache Whether to consider this frame for frame caching
+ */
+void ast_frame_free(struct ast_frame *fr, int cache);
+
+static void force_inline ast_frfree(struct ast_frame *fr)
+{
+	ast_frame_free(fr, 1);
+}
 
 /*! \brief Makes a frame independent of any static storage
  * \param fr frame to act upon

Modified: trunk/main/frame.c
URL: http://svn.digium.com/view/asterisk/trunk/main/frame.c?rev=41958&r1=41957&r2=41958&view=diff
==============================================================================
--- trunk/main/frame.c (original)
+++ trunk/main/frame.c Sun Sep  3 18:14:54 2006
@@ -317,12 +317,12 @@
 	free(frames);
 }
 
-void ast_frfree(struct ast_frame *fr)
+void ast_frame_free(struct ast_frame *fr, int cache)
 {
 	if (!fr->mallocd)
 		return;
 
-	if (fr->mallocd == AST_MALLOCD_HDR) {
+	if (cache && fr->mallocd == AST_MALLOCD_HDR) {
 		/* Cool, only the header is malloc'd, let's just cache those for now 
 		 * to keep things simple... */
 		struct ast_frame_cache *frames;



More information about the asterisk-commits mailing list