new.h 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. /* Storage allocation interface for bison,
  2. Copyright (C) 1984, 1989 Free Software Foundation, Inc.
  3. This file is part of Bison, the GNU Compiler Compiler.
  4. Bison is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. Bison is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with Bison; see the file COPYING. If not, write to
  14. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
  15. #define NEW(t) ((t *) xmalloc((unsigned) sizeof(t)))
  16. #define NEW2(n, t) ((t *) xmalloc((unsigned) ((n) * sizeof(t))))
  17. #ifdef __STDC__
  18. #define FREE(x) (x ? (void) free((char *) (x)) : (void)0)
  19. #else
  20. #define FREE(x) ((x) != 0 && (free ((char *) (x)), 0))
  21. #endif
  22. extern char *xmalloc();
  23. extern char *xrealloc();