[sr-dev] git:master:767fb51a: kazoo : fix transform

Alex Hermann alex at speakup.nl
Mon Jan 5 14:43:15 CET 2015


On Monday 05 January 2015, Luis Azedo wrote:
> Author: Luis Azedo <luis at 2600hz.com>
> Committer: Luis Azedo <luis at 2600hz.com>
> Date: 2015-01-05T13:24:39Z
> 
> kazoo :  fix transform

Could you maybe add an a little more verbose commit message. For example, what 
transformation is fixed and what was wrong with it.


> @@ -150,8 +151,11 @@ int kz_json_get_field_ex(str* json, str* field,
> pv_value_p dst_val) dst_val->rs.s[len] = '\0';
>  		dst_val->rs.len = len;
>  		dst_val->flags = PV_VAL_STR | PV_VAL_PKG;
> +        dst_val->ri = 0;
>  	} else {
>  		dst_val->flags = PV_VAL_NULL;
> +        dst_val->rs kz_pv_str_empty;
> +        dst_val->ri = 0;

This is messing up the indentation and makes the code hard to read.

Indentation style is, unfortunately, not very consistent throughout kamailio, 
but should at least be consistent with the surrounding code.


>  	}
> 
>  	json_object_put(j);
> diff --git a/modules/kazoo/kz_trans.c b/modules/kazoo/kz_trans.c
> index a753b93..32e38e6 100644
> --- a/modules/kazoo/kz_trans.c
> +++ b/modules/kazoo/kz_trans.c
> @@ -133,8 +133,9 @@ int kz_tr_eval(struct sip_msg *msg, tr_param_t *tp, int
> subtype, pv_value_t *val return -1;
>  			}
> 
> +            /*
>  			// it seems that val memory is not freed
> -			// event with flag set to PV_VAL_PKG
> +			// even with flag set to PV_VAL_PKG
> 
>  			strncpy(_kz_tr_buffer, val->rs.s, val->rs.len);
>  			if(val->flags & PV_VAL_PKG)
> @@ -145,6 +146,7 @@ int kz_tr_eval(struct sip_msg *msg, tr_param_t *tp, int
> subtype, pv_value_t *val val->flags = PV_VAL_STR;
>  			val->ri = 0;
>  			val->rs.s = _kz_tr_buffer;
> +            */
> 
>  			if(oldflags & PV_VAL_PKG) {
>  				pkg_free(tofree);
> @@ -168,8 +170,10 @@ int kz_tr_eval(struct sip_msg *msg, tr_param_t *tp,
> int subtype, pv_value_t *val LM_ERR("error getting json\n");
>  				return -1;
>  			}
> +
> +            /*
>  			// it seems that val memory is not freed
> -			// event with flag set to PV_VAL_PKG
> +			// even with flag set to PV_VAL_PKG
> 
>  			strncpy(_kz_tr_buffer, val->rs.s, val->rs.len);
>  			if(val->flags & PV_VAL_PKG)
> @@ -180,6 +184,7 @@ int kz_tr_eval(struct sip_msg *msg, tr_param_t *tp, int
> subtype, pv_value_t *val val->flags = PV_VAL_STR;
>  			val->ri = 0;
>  			val->rs.s = _kz_tr_buffer;
> +            */
> 
>  			if(oldflags & PV_VAL_PKG) {
>  				pkg_free(tofree);


Why is the code commented and not removed?

-- 
Greetings,

Alex Hermann




More information about the sr-dev mailing list