I duplicated memjoin.inl and modified it for my own needs. Attached are
some backported, untested, changes in case someone feels the urge
to test & report on them.




-- 
Øyvind Harboe
http://www.zylin.com - eCos ARM & FPGA  developer kit
### Eclipse Workspace Patch 1.0
#P ecos
Index: services/memalloc/common/current/include/memjoin.inl
===================================================================
RCS file: 
/cvs/ecos/ecos/packages/services/memalloc/common/current/include/memjoin.inl,v
retrieving revision 1.7
diff -u -r1.7 memjoin.inl
--- services/memalloc/common/current/include/memjoin.inl        5 Jul 2004 
11:07:05 -0000       1.7
+++ services/memalloc/common/current/include/memjoin.inl        14 Dec 2007 
10:20:42 -0000
@@ -79,7 +79,7 @@
 inline T *
 Cyg_Mempool_Joined<T>::find_pool_for_ptr( const cyg_uint8 *ptr )
 {
-    cyg_uint8 i;
+    int i;
 
     for ( i=0; i < poolcount; i++ ) {
         if ( ptr >= pools[i].startaddr &&
@@ -98,7 +98,7 @@
 Cyg_Mempool_Joined<T>::Cyg_Mempool_Joined( cyg_uint8 num_heaps, T *heaps[] )
 {
     Cyg_Mempool_Status stat;
-    cyg_uint8 i;
+    int i;
 
     CYG_REPORT_FUNCTION();
     CYG_REPORT_FUNCARG2( "num_heaps=%u, heaps=%08x", (int)num_heaps, heaps );
@@ -165,7 +165,7 @@
 inline cyg_uint8 *
 Cyg_Mempool_Joined<T>::try_alloc( cyg_int32 size )
 {
-    cyg_uint8 i;
+    int i;
     cyg_uint8 *ptr=NULL;
 
     CYG_REPORT_FUNCTYPE( "returning memory at addr %08x" );
@@ -269,8 +269,6 @@
                                            tmpstat );
                 if ( tmpstat.arenasize > 0)
                     status.arenasize += tmpstat.arenasize;
-                else
-                    status.arenasize = -1;
             } // if
         } // if
 
@@ -280,8 +278,6 @@
                                            tmpstat );
                 if ( tmpstat.freeblocks > 0 )
                     status.freeblocks += tmpstat.freeblocks;
-                else
-                    status.freeblocks = -1;
             } // if
         } // if
 
@@ -291,8 +287,6 @@
                                            tmpstat );
                 if ( tmpstat.totalallocated > 0 )
                     status.totalallocated += tmpstat.totalallocated;
-                else
-                    status.totalallocated = -1;
             } // if
         } // if
 
@@ -302,17 +296,13 @@
                                            tmpstat );
                 if ( tmpstat.totalfree > 0 )
                     status.totalfree += tmpstat.totalfree;
-                else
-                    status.totalfree = -1;
             } // if
         } // if
 
         if ( status.maxfree >= 0 ) {
             if ( 0 != (flags & CYG_MEMPOOL_STAT_MAXFREE) ) {
                 pools[i].pool->get_status( CYG_MEMPOOL_STAT_MAXFREE, tmpstat );
-                if ( tmpstat.maxfree < 0 )
-                    status.maxfree = -1;
-                else if ( tmpstat.maxfree > status.maxfree )
+                if ( tmpstat.maxfree > status.maxfree )
                     status.maxfree = tmpstat.maxfree;
             } // if
         } // if
@@ -322,8 +312,6 @@
                 pools[i].pool->get_status( CYG_MEMPOOL_STAT_ORIGSIZE, tmpstat 
);
                 if ( tmpstat.origsize > 0 )
                     status.origsize += tmpstat.origsize;
-                else
-                    status.origsize = -1;
             } // if
         } // if
 
@@ -331,9 +319,7 @@
             if ( 0 != (flags & CYG_MEMPOOL_STAT_MAXOVERHEAD) ) {
                 pools[i].pool->get_status( CYG_MEMPOOL_STAT_MAXOVERHEAD,
                                            tmpstat );
-                if ( tmpstat.maxoverhead < 0 )
-                    status.maxoverhead = -1;
-                else if ( tmpstat.maxoverhead > status.maxoverhead )
+                if ( tmpstat.maxoverhead > status.maxoverhead )
                     status.maxoverhead = tmpstat.maxoverhead;
             } // if
         } // if
Index: services/memalloc/common/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/services/memalloc/common/current/ChangeLog,v
retrieving revision 1.42
diff -u -r1.42 ChangeLog
--- services/memalloc/common/current/ChangeLog  5 Nov 2007 12:38:19 -0000       
1.42
+++ services/memalloc/common/current/ChangeLog  14 Dec 2007 10:20:41 -0000
@@ -1,3 +1,8 @@
+2007-12-14  Oyvind Harboe <[EMAIL PROTECTED]>
+
+       * include/memjoin.inl: removed usage of 8 bit iteration variables,
+       fixed memstat.
+       
 2007-11-05  Oyvind Harboe <[EMAIL PROTECTED]>
        
        * cdl/memalloc.cdl: Added option CYGBLD_MEMALLOC_MALLOC_EXTERNAL_JOIN_H

Reply via email to