[asterisk-dev] [Code Review]: Revamp of terminal color codes

wdoekes reviewboard at asterisk.org
Mon Dec 10 11:54:58 CST 2012



> On Dec. 10, 2012, 3:29 a.m., wdoekes wrote:
> > /trunk/main/pbx.c, lines 4629-4634
> > <https://reviewboard.asterisk.org/r/2241/diff/1/?file=32350#file32350line4629>
> >
> >     Some macros might relieve that.
> >     
> >     Instead of:
> >     
> >     ast_verb(3, "Bla: %s%d%s: %s%s%s",
> >              ast_term_color(COLOR_BRCYAN, 0), number, ast_term_reset(),
> >              ast_term_color(COLOR_BRCYAN, 0), name, ast_term_reset());
> >     
> >     Do:
> >     
> >     ast_verb(3, "Bla: %" AST_C(d) ": %" AST_C(s),
> >              AST_COLORED(COLOR_BRCYAN, 0, number),
> >              AST_COLORED(COLOR_BRCYAN, 0, name));
> >     
> >     Where AST_C(d) would become "s%d%s" and AST_COLORED would expand to the three arguments.
> 
> Tilghman Lesher wrote:
>     I honestly don't see much use for anything other than a substitution of the full "%s%s%s" and the 3 arguments.  I've looked through the code and haven't seen anything like a colorization of an integer.  Cite one, and I'll put forth the extra effort to implement it.

Fine by me too.


- wdoekes


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2241/#review7510
-----------------------------------------------------------


On Dec. 9, 2012, 9:19 p.m., Tilghman Lesher wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2241/
> -----------------------------------------------------------
> 
> (Updated Dec. 9, 2012, 9:19 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> The core module related to coloring terminal output was old and needed some love.  The main thing here was an attempt to get rid of the obscene number of stack-local buffers that were allocated for no other reason than to colorize some output.  Instead, this uses a simple trick to allocate several buffers within threadlocal storage, then automatically rotates between them, so that you can make multiple calls to the colorization routine within one function and not need to allocate multiple buffers.
> 
> 
> Diffs
> -----
> 
>   /trunk/apps/app_queue.c 377511 
>   /trunk/include/asterisk/term.h 377511 
>   /trunk/main/asterisk.c 377511 
>   /trunk/main/data.c 377511 
>   /trunk/main/logger.c 377511 
>   /trunk/main/manager.c 377511 
>   /trunk/main/pbx.c 377511 
>   /trunk/main/term.c 377511 
> 
> Diff: https://reviewboard.asterisk.org/r/2241/diff
> 
> 
> Testing
> -------
> 
> The code works, however, I haven't extended the change to all parts of Asterisk, simply because I wanted to get other eyes on the code and agree on the method employed.
> 
> 
> Thanks,
> 
> Tilghman
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20121210/b4df158a/attachment.htm>


More information about the asterisk-dev mailing list