From 9ad52fe56e8fbb1cd2e37795741773708b72eef3 Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Mon, 27 Jan 2014 20:57:54 -0600 Subject: cbfstool/lzma: Avoid use of typedef with structs and enums When typedef is used with structs, enums, and to create new typenames, readability suffers. As such, restrict use of typedefs only to creating new data types. The 80 character limit is intentionally ignored in this patch in order to make reviewing easier. Change-Id: I62660b19bccf234128930a047c754bce3ebb6cf8 Signed-off-by: Alexandru Gagniuc Reviewed-on: http://review.coreboot.org/5070 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Ronald G. Minnich --- util/cbfstool/lzma/lzma.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'util/cbfstool/lzma/lzma.c') diff --git a/util/cbfstool/lzma/lzma.c b/util/cbfstool/lzma/lzma.c index f889946690..5eebc7e60c 100644 --- a/util/cbfstool/lzma/lzma.c +++ b/util/cbfstool/lzma/lzma.c @@ -57,17 +57,17 @@ static void SzFree(void *unused, void *address) free(address); } -static ISzAlloc LZMAalloc = { SzAlloc, SzFree }; +static struct ISzAlloc LZMAalloc = { SzAlloc, SzFree }; /* Streaming API */ -typedef struct { +struct vector_t { char *p; size_t pos; size_t size; -} vector_t; +}; -static vector_t instream, outstream; +static struct vector_t instream, outstream; static SRes Read(void *unused, void *buf, size_t *size) { @@ -87,8 +87,8 @@ static size_t Write(void *unused, const void *buf, size_t size) return size; } -static ISeqInStream is = { Read }; -static ISeqOutStream os = { Write }; +static struct ISeqInStream is = { Read }; +static struct ISeqOutStream os = { Write }; /** * Compress a buffer with lzma @@ -106,7 +106,7 @@ void do_lzma_compress(char *in, int in_len, char *out, int *out_len) return; } - CLzmaEncProps props; + struct CLzmaEncProps props; LzmaEncProps_Init(&props); props.dictSize = in_len; props.pb = 0; /* PosStateBits, default: 2, range: 0..4 */ @@ -181,7 +181,7 @@ void do_lzma_uncompress(char *dst, int dst_len, char *src, int src_len) return; } - ELzmaStatus status; + enum ELzmaStatus status; size_t destlen = out_sizemax; size_t srclen = src_len - (LZMA_PROPS_SIZE + 8); -- cgit v1.2.3