diff options
| author | Chih-Hung Hsieh <[email protected]> | 2016-01-22 10:04:33 -0800 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2016-01-23 19:55:41 +0100 |
| commit | 203f0a3eec8c630c5183fb9984d66339c1ea3c31 (patch) | |
| tree | 8b9d04f67b2d2cf38c119cd97621edfa2c03008c /libelf/elf_compress.c | |
| parent | 0cd02dcafcfdaff56f483f41c0ec45de756c7083 (diff) | |
Move nested functions in elf_compress.c and elf_strptr.c.
* elf_compress.c (__libelf_compress): do_deflate_cleanup
* elf_strptr.c (elf_strptr): get_zdata
Signed-off-by: Chih-Hung Hsieh <[email protected]>
Diffstat (limited to 'libelf/elf_compress.c')
| -rw-r--r-- | libelf/elf_compress.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/libelf/elf_compress.c b/libelf/elf_compress.c index ec5b7174..4c7c35e1 100644 --- a/libelf/elf_compress.c +++ b/libelf/elf_compress.c @@ -45,6 +45,21 @@ # define MAX(a, b) ((a) > (b) ? (a) : (b)) #endif +/* Cleanup and return result. Don't leak memory. */ +static void * +do_deflate_cleanup (void *result, z_stream *z, void *out_buf, + int ei_data, Elf_Data *cdatap) +{ + deflateEnd (z); + free (out_buf); + if (ei_data != MY_ELFDATA) + free (cdatap->d_buf); + return result; +} + +#define deflate_cleanup(result) \ + do_deflate_cleanup(result, &z, out_buf, ei_data, &cdata) + /* Given a section, uses the (in-memory) Elf_Data to extract the original data size (including the given header size) and data alignment. Returns a buffer that has at least hsize bytes (for the @@ -109,16 +124,6 @@ __libelf_compress (Elf_Scn *scn, size_t hsize, int ei_data, Elf_Data cdata; cdata.d_buf = NULL; - /* Cleanup and return result. Don't leak memory. */ - void *deflate_cleanup (void *result) - { - deflateEnd (&z); - free (out_buf); - if (ei_data != MY_ELFDATA) - free (cdata.d_buf); - return result; - } - /* Loop over data buffers. */ int flush = Z_NO_FLUSH; do |
