[svn-commits] kpfleming: trunk r126960 - in /trunk: apps/ include/asterisk/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jul 1 11:16:37 CDT 2008


Author: kpfleming
Date: Tue Jul  1 11:16:36 2008
New Revision: 126960

URL: http://svn.digium.com/view/asterisk?view=rev&rev=126960
Log:
another minor ast_channel memory size decrease... for nearly all channels, 'dialcontext' is only going to be set once during the channel's lifetime, so make it a string field instead of a char array

Modified:
    trunk/apps/app_dial.c
    trunk/apps/app_queue.c
    trunk/include/asterisk/channel.h

Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dial.c?view=diff&rev=126960&r1=126959&r2=126960
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Tue Jul  1 11:16:36 2008
@@ -639,7 +639,7 @@
 						OPT_CALLEE_PARK | OPT_CALLER_PARK |
 						OPT_CALLEE_MIXMONITOR | OPT_CALLER_MIXMONITOR |
 						DIAL_NOFORWARDHTML);
-					ast_copy_string(c->dialcontext, "", sizeof(c->dialcontext));
+					ast_string_field_set(c, dialcontext, "");
 					ast_copy_string(c->exten, "", sizeof(c->exten));
 				}
 				continue;
@@ -677,7 +677,7 @@
 							OPT_CALLEE_PARK | OPT_CALLER_PARK |
 							OPT_CALLEE_MIXMONITOR | OPT_CALLER_MIXMONITOR |
 							DIAL_NOFORWARDHTML);
-						ast_copy_string(c->dialcontext, "", sizeof(c->dialcontext));
+						ast_string_field_set(c, dialcontext, "");
 						ast_copy_string(c->exten, "", sizeof(c->exten));
 						if (CAN_EARLY_BRIDGE(peerflags))
 							/* Setup early bridge if appropriate */
@@ -1513,10 +1513,7 @@
 			ast_app_group_set_channel(tc, outbound_group);
 
 		/* Inherit context and extension */
-		if (!ast_strlen_zero(chan->macrocontext))
-			ast_copy_string(tc->dialcontext, chan->macrocontext, sizeof(tc->dialcontext));
-		else
-			ast_copy_string(tc->dialcontext, chan->context, sizeof(tc->dialcontext));
+		ast_string_field_set(tc, dialcontext, ast_strlen_zero(chan->macrocontext) ? chan->context : chan->macrocontext);
 		if (!ast_strlen_zero(chan->macroexten))
 			ast_copy_string(tc->exten, chan->macroexten, sizeof(tc->exten));
 		else

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=126960&r1=126959&r2=126960
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Tue Jul  1 11:16:36 2008
@@ -2205,10 +2205,7 @@
 	/* Inherit context and extension */
 	ast_channel_lock(qe->chan);
 	macrocontext = pbx_builtin_getvar_helper(qe->chan, "MACRO_CONTEXT");
-	if (!ast_strlen_zero(macrocontext))
-		ast_copy_string(tmp->chan->dialcontext, macrocontext, sizeof(tmp->chan->dialcontext));
-	else
-		ast_copy_string(tmp->chan->dialcontext, qe->chan->context, sizeof(tmp->chan->dialcontext));
+	ast_string_field_set(tmp->chan, dialcontext, ast_strlen_zero(macrocontext) ? qe->chan->context : macrocontext);
 	macroexten = pbx_builtin_getvar_helper(qe->chan, "MACRO_EXTEN");
 	if (!ast_strlen_zero(macroexten))
 		ast_copy_string(tmp->chan->exten, macroexten, sizeof(tmp->chan->exten));

Modified: trunk/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/channel.h?view=diff&rev=126960&r1=126959&r2=126960
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Tue Jul  1 11:16:36 2008
@@ -469,6 +469,7 @@
 		AST_STRING_FIELD(call_forward);		/*!< Where to forward to if asked to dial on this interface */
 		AST_STRING_FIELD(uniqueid);		/*!< Unique Channel Identifier */
 		AST_STRING_FIELD(parkinglot);		/*! Default parking lot, if empty, default parking lot  */
+		AST_STRING_FIELD(dialcontext);		/*!< Dial: Extension context that we were called from */
 	);
 	
 	struct timeval whentohangup;        		/*!< Non-zero, set to actual time when channel is to be hung up */
@@ -530,7 +531,6 @@
 	char exten[AST_MAX_EXTENSION];			/*!< Dialplan: Current extension number */
 	char macrocontext[AST_MAX_CONTEXT];		/*!< Macro: Current non-macro context. See app_macro.c */
 	char macroexten[AST_MAX_EXTENSION];		/*!< Macro: Current non-macro extension. See app_macro.c */
-	char dialcontext[AST_MAX_CONTEXT];              /*!< Dial: Extension context that we were called from */
 	char emulate_dtmf_digit;			/*!< Digit being emulated */
 };
 




More information about the svn-commits mailing list