mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +00:00
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. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@41958 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -31,6 +31,8 @@ extern "C" {
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#include "asterisk/compiler.h"
|
||||||
#include "asterisk/endian.h"
|
#include "asterisk/endian.h"
|
||||||
#include "asterisk/linkedlists.h"
|
#include "asterisk/linkedlists.h"
|
||||||
|
|
||||||
@@ -354,12 +356,18 @@ struct ast_option_header {
|
|||||||
struct ast_frame *ast_fralloc(char *source, int len);
|
struct ast_frame *ast_fralloc(char *source, int len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*! \brief Frees a frame
|
/*!
|
||||||
|
* \brief Frees a frame
|
||||||
|
*
|
||||||
* \param fr Frame to free
|
* \param fr Frame to free
|
||||||
* Free a frame, and the memory it used if applicable
|
* \param cache Whether to consider this frame for frame caching
|
||||||
* \return no return.
|
|
||||||
*/
|
*/
|
||||||
void ast_frfree(struct ast_frame *fr);
|
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
|
/*! \brief Makes a frame independent of any static storage
|
||||||
* \param fr frame to act upon
|
* \param fr frame to act upon
|
||||||
|
@@ -317,12 +317,12 @@ static void frame_cache_cleanup(void *data)
|
|||||||
free(frames);
|
free(frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ast_frfree(struct ast_frame *fr)
|
void ast_frame_free(struct ast_frame *fr, int cache)
|
||||||
{
|
{
|
||||||
if (!fr->mallocd)
|
if (!fr->mallocd)
|
||||||
return;
|
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
|
/* Cool, only the header is malloc'd, let's just cache those for now
|
||||||
* to keep things simple... */
|
* to keep things simple... */
|
||||||
struct ast_frame_cache *frames;
|
struct ast_frame_cache *frames;
|
||||||
|
Reference in New Issue
Block a user