[asterisk-dev] tilghman: trunk r157870 - /trunk/funcs/func_realtime.c

Russell Bryant russell at digium.com
Wed Nov 19 17:55:53 CST 2008


SVN commits to the Digium repositories wrote:
> Author: tilghman
> Date: Wed Nov 19 15:54:39 2008
> New Revision: 157870
> 
> URL: http://svn.digium.com/view/asterisk?view=rev&rev=157870
> Log:
> Two new functions, REALTIME_FIELD, and REALTIME_HASH, which should make
> querying realtime from the dialplan a little more consistent and easy to use.
> The original REALTIME function is preserved, for those who are already
> accustomed to that interface.
> (closes issue #13651)
>  Reported by: Corydon76
>  Patches: 
>        20081119__bug13651__2.diff.txt uploaded by Corydon76 (license 14)
>  Tested by: blitzrage, Corydon76
> 
> Modified:
>     trunk/funcs/func_realtime.c

> +static char *hash_escape(struct ast_str **str, const char *value)
> +{
> +	int len;
> +	ast_str_reset(*str);
> +
> +	if ((*str)->len < (len = strlen(value) * 2 + 1)) {
> +		ast_str_make_space(str, len);
> +	}
> +	for (; *value; value++) {
> +		if (*value == ',' || *value == '\\') {
> +			(*str)->str[(*str)->used++] = '\\';
> +		}
> +		(*str)->str[(*str)->used++] = *value;
> +	}
> +	(*str)->str[(*str)->used] = '\0';
> +	return (*str)->str;
> +}

Can you make an ast_str API call out of this?  I would really like to 
centralize all of the code that modifies an ast_str.  Ideally, no code 
outside of the ast_str API should ever modify the internals of the 
ast_str object.

-- 
Russell Bryant
Senior Software Engineer
Open Source Team Lead
Digium, Inc.



More information about the asterisk-dev mailing list