This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: redboot decompress.c fixes - ChangeLog


On Fri, 2003-12-05 at 07:32, Ian Campbell wrote:
> > Applied
> 
> Cheers.
> 
> > although I'm not sure I understand your last comment about
> > the initialization.
> 
> I was referring to the code I added to _zlib_init() which sets up the
> memlist pointer. Normally this is done in gzip_init(), but that function
> didn't appear to be called when using JFFS2 in Redboot. Perhaps I was
> mistaken though.

In that case, perhaps the code should be removed from gzip_init() [note:
it's now duplicated which is bad].  If the lists truly need to be reset
every time gzip_init() is called (as it is now), then that should be
addressed.

Bottom line - initializing these structures (free memory list, etc) in
two places is poor practice and will tend toward error.

I'll take care of this.  Good of you to notice this, thanks.

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates
Index: redboot/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.171
diff -u -5 -p -r1.171 ChangeLog
--- redboot/current/ChangeLog	5 Dec 2003 14:15:52 -0000	1.171
+++ redboot/current/ChangeLog	5 Dec 2003 15:10:30 -0000
@@ -1,5 +1,10 @@
+2003-12-05  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/decompress.c (gzip_init): Memory pool initialization should
+	only be done in _zlib_init().
+
 2003-12-05  Ian Campbell  <icampbell@arcom.com>
 
 	* src/decompress.c: Ensure that free'd blocks are returned to the
 	free pool and that adjacent free blocks are merged. Initialise the
 	pool in _zlib_init() so that things are initialised even when
Index: redboot/current/src/decompress.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/src/decompress.c,v
retrieving revision 1.9
diff -u -5 -p -r1.9 decompress.c
--- redboot/current/src/decompress.c	5 Dec 2003 14:15:52 -0000	1.9
+++ redboot/current/src/decompress.c	5 Dec 2003 15:00:11 -0000
@@ -228,16 +228,13 @@ zcfree(void *opaque, void *ptr)
 //
 static int
 gzip_init(_pipe_t* p)
 {
     int err;
-    struct _block *bp;
 
-    bp = (struct _block *)zlib_workspace;
-    memlist = bp;
-    bp->next = bp->prev = 0;
-    bp->size = ZLIB_COMPRESSION_OVERHEAD;
+    // Note: this code used to [re]initialize the memory pool used
+    // by zlib.  This is now done in _zlib_init(), but only once.
     stream.zalloc = zcalloc;
     stream.zfree = zcfree;
     stream.next_in = NULL;
     stream.avail_in = 0;
     stream.next_out = NULL;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]