[svn-commits] russell: branch russell/bindings r103332 - /team/russell/bindings/bindings/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Feb 11 21:09:02 CST 2008
Author: russell
Date: Mon Feb 11 21:09:01 2008
New Revision: 103332
URL: http://svn.digium.com/view/asterisk?view=rev&rev=103332
Log:
handle thread local buffers in such a way that keeps my mac happy
Modified:
team/russell/bindings/bindings/ast_channel.i
Modified: team/russell/bindings/bindings/ast_channel.i
URL: http://svn.digium.com/view/asterisk/team/russell/bindings/bindings/ast_channel.i?view=diff&rev=103332&r1=103331&r2=103332
==============================================================================
--- team/russell/bindings/bindings/ast_channel.i (original)
+++ team/russell/bindings/bindings/ast_channel.i Mon Feb 11 21:09:01 2008
@@ -5,8 +5,15 @@
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/app.h"
+#include "asterisk/threadstorage.h"
#include "res_python/res_python.h"
+
+AST_THREADSTORAGE(ast_channel_get_var_buf);
+#define GET_VAR_BUF_LEN 1024
+
+AST_THREADSTORAGE(ast_channel_read_digit_buf);
+#define READ_DIGIT_BUF_LEN 2
%}
struct ast_channel {
@@ -91,8 +98,11 @@
const char *get_var(const char *var_name)
{
- static __thread char workspace[1024];
+ char *workspace;
char *var_val = NULL;
+
+ if (!(workspace = ast_threadstorage_get(&ast_channel_get_var_buf, GET_VAR_BUF_LEN)))
+ return "";
*workspace = '\0';
@@ -106,9 +116,12 @@
return var_val;
}
- const char * read_digit(const char *prompt = "silence/1", int timeout = 0)
+ const char *read_digit(const char *prompt = "silence/1", int timeout = 0)
{
- static __thread char buf[2];
+ char *buf;
+
+ if (!(buf = ast_threadstorage_get(&ast_channel_read_digit_buf, READ_DIGIT_BUF_LEN)))
+ return "";
buf[0] = '\0';
buf[1] = '\0';
More information about the svn-commits
mailing list