[asterisk-dev] Re: [svn-commits] qwell: trunk r40561 - /trunk/channels/chan_skinny.c

Russell Bryant russell at digium.com
Sat Aug 19 21:17:42 MST 2006


----- svn-commits at lists.digium.com wrote:
> Author: qwell
> Date: Sat Aug 19 20:25:02 2006
> New Revision: 40561
> 
> URL: http://svn.digium.com/view/asterisk?rev=40561&view=rev
> Log:
> Fix minor display issues in "skinny show devices".
...
> +static char *device2str(int type)
> +{
> +	static char tmp[15];
> +
> +	switch (type) {
> +	case SKINNY_DEVICE_NONE:
> +		return "No Device";
...
> +	default:
> +		snprintf(tmp, sizeof(tmp), "UNKNOWN-%d", type);
> +		return tmp;
> +	}
> +}
> +

This function is actually not thread-safe.  The function, ast_state2str() in channel.c worked exactly this same way until very recently when I converted it to use thread local storage instead.  Check out ast_state2str() and you can use virtually the exact same code for here as well.

-- 
Russell Bryant
Software Developer
Digium, Inc.




More information about the asterisk-dev mailing list