[OpenSIPS-Devel] [opensips] added exec(cmd, output, input, error, avpenv) function for exec (#375)

Walter Doekes notifications at github.com
Wed Oct 29 09:51:07 CET 2014


> +		if ((buflen + tmplen) >= MAX_BUF_SIZE) {
> +			LM_WARN("no more space in output buffer\n");
> +			break;
> +		}
> +		memcpy(buf+buflen, tmpbuf, tmplen);
> +		buflen += tmplen;
> +
> +		outval.flags = PV_VAL_STR;
> +		outval.rs.s = buf;
> +		outval.rs.len = buflen;
> +
> +		if (buflen &&
> +			pv_set_value(msg, &outvar->v.pve->spec, 0, &outval) < 0) {
> +			LM_ERR("cannot set output pv value\n");
> +			return -1;
> +		}

Seems redundant to re-set outval.flags and rs.s every iteration (and rs.len for that matter).

Shouldn't you move everything from outval.flags to the end of this block to outside the `while{}`?

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/375/files#r19525189
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20141029/b7522804/attachment.htm>


More information about the Devel mailing list