[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH v2 12/13] libdpkg: compression: move each format's code into its own function



Hi!

On Sat, 2009-10-24 at 17:48:59 -0500, Jonathan Nieder wrote:
> Add compress_gzip, decompress_gzip, etc functions with code from
> compress_cat and decompress_cat.  Instead of
> 
> 	switch (type) {
> 	case compress_type_gzip:
> 	#ifdef WITH_ZLIB
> 		/* decompress using zlib */
> 	#else
> 		fd_fd_filter(fd_in, fd_out, GZIP, "gzip", "-dc", v.buf);
> 	#endif
> 
> we write
> 
> 	switch(type) {
> 	case compress_type_gzip:
> 		decompress_gzip(...);
> 
> with decompress_gzip defined appropriately depending on the value
> of WITH_ZLIB.  This should make each function easier to read on
> its own.

Applied this one with several modifications. Didn't move the backends
into a different file. Named the noop backend as none. And adapted the
code to the fact that no COMPRESS and DECOMPRESS macros are being
used.

thanks,
guillem


Reply to: