[Asterisk-code-review] term.c: Truncate the message rather than the escape sequences. (asterisk[master])

Jaco Kroon asteriskteam at digium.com
Fri Nov 12 01:31:45 CST 2021


Attention is currently required from: Sean Bright.
Jaco Kroon has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/17333 )

Change subject: term.c: Truncate the message rather than the escape sequences.
......................................................................


Patch Set 1:

(1 comment)

Patchset:

PS1: 
I'm OK with this, this variation has the possible advantage of saving a few cycles in the "error" case, at the expense of screwing up the lead-in escape sequences (which should be fairly unlikely, and would effectively eliminate the message completely.

My variation does not carry that risk, at the cost of an if() and a call to snprintf to repeat what has already been done.

We *could* potentially do a snprintf printing *only* the lead-in, and then use strncpy to fill in the buffer (assuming that it'll fit at least X characters - where X needs to be defined - in addition to the end data), possibly snprintf again, with an adjusted buffer (we know where this starts thanks to return from the first snprintf.  Opinion?

There are one or two things from this patch that I can use to eliminate a branch or two on my variation.



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/17333
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ie460acf577faeb4a6d74062e22ea9f3ffd3233de
Gerrit-Change-Number: 17333
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean at seanbright.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Jaco Kroon <jaco at uls.co.za>
Gerrit-Attention: Sean Bright <sean at seanbright.com>
Gerrit-Comment-Date: Fri, 12 Nov 2021 07:31:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20211112/9e3d1ace/attachment.html>


More information about the asterisk-code-review mailing list