Line 1... |
Line 1... |
/* Function declarations for libiberty.
|
/* Function declarations for libiberty.
|
|
|
Copyright 2001, 2002, 2005, 2007 Free Software Foundation, Inc.
|
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
|
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
|
|
Note - certain prototypes declared in this header file are for
|
Note - certain prototypes declared in this header file are for
|
functions whoes implementation copyright does not belong to the
|
functions whoes implementation copyright does not belong to the
|
FSF. Those prototypes are present in this file for reference
|
FSF. Those prototypes are present in this file for reference
|
purposes only and their presence in this file should not construed
|
purposes only and their presence in this file should not construed
|
Line 309... |
Line 310... |
|
|
/* Physical memory routines. Return values are in BYTES. */
|
/* Physical memory routines. Return values are in BYTES. */
|
extern double physmem_total (void);
|
extern double physmem_total (void);
|
extern double physmem_available (void);
|
extern double physmem_available (void);
|
|
|
|
/* Compute the 32-bit CRC of a block of memory. */
|
|
extern unsigned int xcrc32 (const unsigned char *, int, unsigned int);
|
|
|
/* These macros provide a K&R/C89/C++-friendly way of allocating structures
|
/* These macros provide a K&R/C89/C++-friendly way of allocating structures
|
with nice encapsulation. The XDELETE*() macros are technically
|
with nice encapsulation. The XDELETE*() macros are technically
|
superfluous, but provided here for symmetry. Using them consistently
|
superfluous, but provided here for symmetry. Using them consistently
|
makes it easier to update client code to use different allocators such
|
makes it easier to update client code to use different allocators such
|
as new/delete and new[]/delete[]. */
|
as new/delete and new[]/delete[]. */
|
|
|
/* Scalar allocators. */
|
/* Scalar allocators. */
|
|
|
|
#define XALLOCA(T) ((T *) alloca (sizeof (T)))
|
#define XNEW(T) ((T *) xmalloc (sizeof (T)))
|
#define XNEW(T) ((T *) xmalloc (sizeof (T)))
|
#define XCNEW(T) ((T *) xcalloc (1, sizeof (T)))
|
#define XCNEW(T) ((T *) xcalloc (1, sizeof (T)))
|
|
#define XDUP(T, P) ((T *) xmemdup ((P), sizeof (T), sizeof (T)))
|
#define XDELETE(P) free ((void*) (P))
|
#define XDELETE(P) free ((void*) (P))
|
|
|
/* Array allocators. */
|
/* Array allocators. */
|
|
|
|
#define XALLOCAVEC(T, N) ((T *) alloca (sizeof (T) * (N)))
|
#define XNEWVEC(T, N) ((T *) xmalloc (sizeof (T) * (N)))
|
#define XNEWVEC(T, N) ((T *) xmalloc (sizeof (T) * (N)))
|
#define XCNEWVEC(T, N) ((T *) xcalloc ((N), sizeof (T)))
|
#define XCNEWVEC(T, N) ((T *) xcalloc ((N), sizeof (T)))
|
|
#define XDUPVEC(T, P, N) ((T *) xmemdup ((P), sizeof (T) * (N), sizeof (T) * (N)))
|
#define XRESIZEVEC(T, P, N) ((T *) xrealloc ((void *) (P), sizeof (T) * (N)))
|
#define XRESIZEVEC(T, P, N) ((T *) xrealloc ((void *) (P), sizeof (T) * (N)))
|
#define XDELETEVEC(P) free ((void*) (P))
|
#define XDELETEVEC(P) free ((void*) (P))
|
|
|
/* Allocators for variable-sized structures and raw buffers. */
|
/* Allocators for variable-sized structures and raw buffers. */
|
|
|
|
#define XALLOCAVAR(T, S) ((T *) alloca ((S)))
|
#define XNEWVAR(T, S) ((T *) xmalloc ((S)))
|
#define XNEWVAR(T, S) ((T *) xmalloc ((S)))
|
#define XCNEWVAR(T, S) ((T *) xcalloc (1, (S)))
|
#define XCNEWVAR(T, S) ((T *) xcalloc (1, (S)))
|
|
#define XDUPVAR(T, P, S1, S2) ((T *) xmemdup ((P), (S1), (S2)))
|
#define XRESIZEVAR(T, P, S) ((T *) xrealloc ((P), (S)))
|
#define XRESIZEVAR(T, P, S) ((T *) xrealloc ((P), (S)))
|
|
|
/* Type-safe obstack allocator. */
|
/* Type-safe obstack allocator. */
|
|
|
#define XOBNEW(O, T) ((T *) obstack_alloc ((O), sizeof (T)))
|
#define XOBNEW(O, T) ((T *) obstack_alloc ((O), sizeof (T)))
|
|
#define XOBNEWVEC(O, T, N) ((T *) obstack_alloc ((O), sizeof (T) * (N)))
|
|
#define XOBNEWVAR(O, T, S) ((T *) obstack_alloc ((O), (S)))
|
#define XOBFINISH(O, T) ((T) obstack_finish ((O)))
|
#define XOBFINISH(O, T) ((T) obstack_finish ((O)))
|
|
|
/* hex character manipulation routines */
|
/* hex character manipulation routines */
|
|
|
#define _hex_array_size 256
|
#define _hex_array_size 256
|