/*
 * alloc.h
 *
 * Trivial veneers for allocating memory
 *
 *  1998 Straylight/Edgeware
 */

/*----- Licensing note ----------------------------------------------------*
 *
 * This file is part of Straylight's core utilities (coreutils).
 *
 * Coreutils is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * Coreutils is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with coreutils.  If not, write to the Free Software Foundation,
 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef ALLOC_H
#define ALLOC_H

#ifdef __cplusplus
  extern "C" {
#endif

/*----- Required headers --------------------------------------------------*/

#include <stddef.h>

/*----- Functions ---------------------------------------------------------*/

/* --- @xmalloc@ --- *
 *
 * Arguments:	@size_t sz@ = size of block to allocate
 *
 * Returns:	Pointer to newly allocated block.
 *
 * Use:		Returns a block of the requested size, or not at all.
 */

extern void *xmalloc(size_t /*sz*/);

/* --- @xrealloc@ --- *
 *
 * Arguments:	@void *p@ = pointer to a block of memory
 *		@size_t sz@ = size we want it to be
 *
 * Returns:	Pointer to resized block
 *
 * Use:		Resizes a block.  Returns the resized block, or not at all.
 */

extern void *xrealloc(void */*p*/, size_t /*sz*/);

/* --- @xstrdup@ --- *
 *
 * Arguments:	@const char *p@ = pointer to string to copy
 *
 * Returns:	Pointer to a copy of the string.
 *
 * Use:		Returns a copy of a string, or not at all.
 */

extern char *xstrdup(const char */*p*/);

/*----- That's all, folks -------------------------------------------------*/

#ifdef __cplusplus
  }
#endif

#endif
