[Toybox] [CLEANUP] xzcat: remove XZ_(PREALLOC|SINGLE), inline xz_dec_bcj_create

Rob Landley rob at landley.net
Wed Jul 17 15:19:59 PDT 2013


On 07/13/2013 07:23:52 PM, Isaac wrote:
> Because we only use XZ_DYNALLOC, there's a bunch of dead code.
> This patch removes the #ifdef's and if()s associated with support for
> multiple modes.
> single_call was only used to store the mode; it is no longer needed.
> A little bit of reorganization was needed to reduce the number of  
> prototypes.
> Documentation associated with dead code was dropped.
> 
> There are still some relics of multiple modes in the continued  
> presence
> of "XZ_DYNALLOC" and xz_mode.
> 
> Additionally, I inlined xz_dec_bcj_create; it was called once.
> 
> This loses about 125 lines, mostly comments.

Looks good. Consider it applied as soon as I finish up this timeout  
command.

Today's "huh" bug: calling xexec(toys.optargs+2) is subtly broken,  
because toy_init() will free toys.optargs() and then argument parsing  
will malloc new blocks of data over it. The fix is trivial (copy  
optargs to a temp variable and zero the original pointer) but it's  
uncomfortably subtle enough I should make a wrapper function for it to  
remind people it needs to be done. (It works if you just run a command  
name with no arguments, so in previous testing I didn't notice...)

Rob
 1374099599.0


More information about the Toybox mailing list