From df477e46525d2e4c139e8b60ab20d37e6a4463a9 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Sat, 24 Dec 2011 07:47:02 -0600 Subject: [PATCH] [libpng16] Eliminated png_info_destroy. It is now used only in png.c and only calls one other internal function and memset. --- ANNOUNCE | 10 +++++++--- CHANGES | 8 ++++++-- png.c | 21 ++++----------------- pngpriv.h | 4 ---- 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 4c84d1601..c00dc422f 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.6.0beta04 - December 22, 2011 +Libpng 1.6.0beta04 - December 24, 2011 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -29,7 +29,8 @@ Changes since the last public release (1.5.7): Version 1.6.0beta01 [December 15, 2011] Removed machine-generated configure files from the GIT repository (they will continue to appear in the tarball distributions). - Restored the new 'simplified' API, which was deleted from libpng-1.5.7. + Restored the new 'simplified' API, which was started in libpng-1.5.7beta02 + but later deleted from libpng-1.5.7beta05. Added example programs for the new 'simplified' API. Added ANSI-C (C90) headers and require them, and take advantage of the change. Also fixed some of the projects/* and contrib/* files that needed @@ -76,7 +77,10 @@ Version 1.6.0beta03 [December 22, 2011] decreases in code size by 1733 bytes. pngerror.o increases in size by about 465 bytes because of the new functionality. -Version 1.6.0beta04 [December 22, 2011] +Version 1.6.0beta04 [December 24, 2011] + Regenerated configure scripts with automake-1.11.2 + Eliminated png_info_destroy. It is now used only in png.c and only calls one + other internal functions and memset. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index e17611f0c..c81ee14f7 100644 --- a/CHANGES +++ b/CHANGES @@ -3780,7 +3780,8 @@ Version 1.5.7 [December 15, 2011] Version 1.6.0beta01 [December 15, 2011] Removed machine-generated configure files from the GIT repository (they will continue to appear in the tarball distributions). - Restored the new 'simplified' API, which was deleted from libpng-1.5.7. + Restored the new 'simplified' API, which was started in libpng-1.5.7beta02 + but later deleted from libpng-1.5.7beta05. Added example programs for the new 'simplified' API. Added ANSI-C (C90) headers and require them, and take advantage of the change. Also fixed some of the projects/* and contrib/* files that needed @@ -3827,7 +3828,10 @@ Version 1.6.0beta03 [December 22, 2011] decreases in code size by 1733 bytes. pngerror.o increases in size by about 465 bytes because of the new functionality. -Version 1.6.0beta04 [December 22, 2011] +Version 1.6.0beta04 [December 24, 2011] + Regenerated configure scripts with automake-1.11.2 + Eliminated png_info_destroy. It is now used only in png.c and only calls one + other internal functions and memset. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/png.c b/png.c index 02e2b2184..d7b69d816 100644 --- a/png.c +++ b/png.c @@ -387,7 +387,8 @@ png_destroy_info_struct(png_const_structp png_ptr, png_infopp info_ptr_ptr) */ *info_ptr_ptr = NULL; - png_info_destroy(png_ptr, info_ptr); + png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); + png_memset(info_ptr, 0, sizeof *info_ptr); png_free(png_ptr, info_ptr); } } @@ -641,20 +642,6 @@ png_free_data(png_const_structp png_ptr, png_infop info_ptr, png_uint_32 mask, info_ptr->free_me &= ~mask; } - -/* This is an internal routine to free any memory that the info struct is - * pointing to before re-using it or freeing the struct itself. Recall - * that png_free() checks for NULL pointers for us. - */ -void /* PRIVATE */ -png_info_destroy(png_const_structp png_ptr, png_infop info_ptr) -{ - png_debug(1, "in png_info_destroy"); - - png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); - - png_memset(info_ptr, 0, sizeof *info_ptr); -} #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ /* This function returns a pointer to the io_ptr associated with the user @@ -775,13 +762,13 @@ png_get_copyright(png_const_structp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.0beta04 - December 22, 2011" PNG_STRING_NEWLINE \ + "libpng version 1.6.0beta04 - December 24, 2011" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2011 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE; # else - return "libpng version 1.6.0beta04 - December 22, 2011\ + return "libpng version 1.6.0beta04 - December 24, 2011\ Copyright (c) 1998-2011 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; diff --git a/pngpriv.h b/pngpriv.h index 5afbb7077..4e4c430a7 100644 --- a/pngpriv.h +++ b/pngpriv.h @@ -710,10 +710,6 @@ PNG_EXTERN PNG_FUNCTION(png_structp,png_create_png_struct, /* Free memory from internal libpng struct */ PNG_EXTERN void png_destroy_png_struct PNGARG((png_structp png_ptr)); -/* Free any memory that info_ptr points to and reset struct. */ -PNG_EXTERN void png_info_destroy PNGARG((png_const_structp png_ptr, - png_infop info_ptr)); - /* Free an allocated jmp_buf (always succeeds) */ PNG_EXTERN void png_free_jmpbuf PNGARG((png_structp png_ptr));