/[m4]/m4/gnulib/m4/obstack.c
ViewVC logotype

Diff of /m4/gnulib/m4/obstack.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by gary, Tue Oct 7 14:10:11 2003 UTC revision 1.3 by gary, Thu Nov 13 12:05:57 2003 UTC
# Line 21  Line 21 
21  # include <config.h>  # include <config.h>
22  #endif  #endif
23    
24    #ifdef _LIBC
25    #include <obstack.h>
26    #else
27  #include "obstack.h"  #include "obstack.h"
28    #endif
29    
30  /* NOTE BEFORE MODIFYING THIS FILE: This version number must be  /* NOTE BEFORE MODIFYING THIS FILE: This version number must be
31     incremented whenever callers compiled using an old obstack.h can no     incremented whenever callers compiled using an old obstack.h can no
# Line 282  _obstack_newchunk (struct obstack *h, in Line 286  _obstack_newchunk (struct obstack *h, in
286    /* The new chunk certainly contains no empty object yet.  */    /* The new chunk certainly contains no empty object yet.  */
287    h->maybe_empty_object = 0;    h->maybe_empty_object = 0;
288  }  }
289    #ifdef _LIBC
290    libc_hidden_def (_obstack_newchunk)
291    #endif
292    
293  /* Return nonzero if object OBJ has been allocated from obstack H.  /* Return nonzero if object OBJ has been allocated from obstack H.
294     This is here for debugging.     This is here for debugging.
# Line 314  _obstack_allocated_p (struct obstack *h, Line 321  _obstack_allocated_p (struct obstack *h,
321    
322  # undef obstack_free  # undef obstack_free
323    
 /* This function has two names with identical definitions.  
    This is the first one, called from non-ANSI code.  */  
   
 void  
 _obstack_free (struct obstack *h, void *obj)  
 {  
   register struct _obstack_chunk *lp;   /* below addr of any objects in this chunk */  
   register struct _obstack_chunk *plp;  /* point to previous chunk if any */  
   
   lp = h->chunk;  
   /* We use >= because there cannot be an object at the beginning of a chunk.  
      But there can be an empty object at that address  
      at the end of another chunk.  */  
   while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj))  
     {  
       plp = lp->prev;  
       CALL_FREEFUN (h, lp);  
       lp = plp;  
       /* If we switch chunks, we can't tell whether the new current  
          chunk contains an empty object, so assume that it may.  */  
       h->maybe_empty_object = 1;  
     }  
   if (lp)  
     {  
       h->object_base = h->next_free = (char *) (obj);  
       h->chunk_limit = lp->limit;  
       h->chunk = lp;  
     }  
   else if (obj != 0)  
     /* obj is not in any of the chunks! */  
     abort ();  
 }  
   
 /* This function is used from ANSI code.  */  
   
324  void  void
325  obstack_free (struct obstack *h, void *obj)  obstack_free (struct obstack *h, void *obj)
326  {  {
# Line 378  obstack_free (struct obstack *h, void *o Line 350  obstack_free (struct obstack *h, void *o
350      /* obj is not in any of the chunks! */      /* obj is not in any of the chunks! */
351      abort ();      abort ();
352  }  }
353    
354    #ifdef _LIBC
355    /* Older versions of libc used a function _obstack_free intended to be
356       called by non-GCC compilers.  */
357    strong_alias (obstack_free, _obstack_free)
358    #endif
359    
360  int  int
361  _obstack_memory_used (struct obstack *h)  _obstack_memory_used (struct obstack *h)
# Line 400  _obstack_memory_used (struct obstack *h) Line 378  _obstack_memory_used (struct obstack *h)
378  # endif  # endif
379  # define _(msgid) gettext (msgid)  # define _(msgid) gettext (msgid)
380    
381  # if defined _LIBC && defined USE_IN_LIBIO  # ifdef _LIBC
382  #  include <libio/iolibio.h>  #  include <libio/iolibio.h>
 #  define fputs(s, f) _IO_fputs (s, f)  
383  # endif  # endif
384    
385  # ifndef __attribute__  # ifndef __attribute__

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26