LWN.net Logo

Heise reports from SCO Forum

Heise reports from SCO Forum

Posted Aug 19, 2003 15:30 UTC (Tue) by rfunk (subscriber, #4054)
In reply to: Heise reports from SCO Forum by rfunk
Parent article: Heise reports from SCO Forum

As it appears in the Lions book:

 
/* 
 * Allocate size units from the given 
 * map. Return the base of the allocated 
 * space. 
 * Algorithm is first fit. 
 */ 
malloc(mp, size) 
struct map *mp; 
{ 
   register int a; 
   register struct map *bp; 
 
   for (bp = mp; bp->m_size; bp++) { 
           if (bp->m_size >= size) { 
                   a = bp->m_addr; 
                   bp->m_addr =+ size; 
                   if ((bp->m_size =- size) == 0) 
                       do { 
                           bp++; 
                           (bp-1)->m_addr = bp->m_addr; 
                       while((bp-1)->m_size = bp->m_size); 
                   return(a); 
           } 
   } 
   return(0); 
} 


(Log in to post comments)

Heise reports from SCO Forum

Posted Aug 19, 2003 18:03 UTC (Tue) by rfunk (subscriber, #4054) [Link]

Oops, I missed a closing brace in this line:
 
                       while((bp-1)->m_size = bp->m_size); 
Should be:
 
                       } while((bp-1)->m_size = bp->m_size); 

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds