[dhcp 3.1.3] compile error

Glenn Satchell glenn.satchell at uniq.com.au
Sat Jun 5 15:24:30 UTC 2010


On 06/05/10 17:41, Earl Lapus wrote:
> Hi,
>
> I enabled DEBUG_MALLOC_POOL in `include/sites.h` and I encountered a
> compile error (see attached file dhcp-3.1.3-compile-error.txt). I made
> a simple modification (see attached file alloc.c.diff) and it now
> works. Was I doing the right thing?
>
> Cheers,
> Earl
>

Hi Earl

diff -ruN ../dhcp-3.1.3/omapip/alloc.c ../dhcp-3.1.3-mod/omapip/alloc.c
--- ../dhcp-3.1.3/omapip/alloc.c	2009-09-02 04:32:28.000000000 +0800
+++ ../dhcp-3.1.3-mod/omapip/alloc.c	2010-06-05 15:37:33.000000000 +0800
@@ -269,6 +269,7 @@
  	static unsigned long dmalloc_cutoff_point;
  	struct dmalloc_preamble *dp;
  #if defined(DEBUG_MALLOC_POOL)
+        int i;
  	unsigned char *foo;
  #endif

This is what that section of code looks like in 3.1.2:

void dmalloc_dump_outstanding ()
{
         static unsigned long dmalloc_cutoff_point;
         struct dmalloc_preamble *dp;
         unsigned char *foo;
         int i;

         if (!dmalloc_cutoff_point)
                 dmalloc_cutoff_point = dmalloc_cutoff_generation;
         for (dp = dmalloc_list; dp; dp = dp -> prev) {
                 if (dp -> generation <= dmalloc_cutoff_point)
                         break;
#if defined (DEBUG_MALLOC_POOL)
                 for (i = 0; i < DMLFSIZE; i++) {

Your fix should be fine.

BTW the same error looks like it is still in 4.1.1 and 4.2.0b1 (missing 
declaration for int i).

void dmalloc_dump_outstanding ()
{
         static unsigned long dmalloc_cutoff_point;
         struct dmalloc_preamble *dp;
#if defined(DEBUG_MALLOC_POOL)
         unsigned char *foo;
#endif

         if (!dmalloc_cutoff_point)
                 dmalloc_cutoff_point = dmalloc_cutoff_generation;
         for (dp = dmalloc_list; dp; dp = dp -> prev) {
                 if (dp -> generation <= dmalloc_cutoff_point)
                         break;
#if defined (DEBUG_MALLOC_POOL)
                 for (i = 0; i < DMLFSIZE; i++) {


-- 
regards,
-glenn
--
Glenn Satchell                            |  Miss 9: What do you
Uniq Advances Pty Ltd, Sydney Australia   |  do at work Dad?
mailto:glenn.satchell at uniq.com.au         |  Miss 6: He just
http://www.uniq.com.au tel:0409-458-580   |  types random stuff.



More information about the dhcp-users mailing list