示例#1
0
/* Return a pointer to free()able block of memory large enough
   to hold BYTES number of bytes.  If the memory cannot be allocated,
   print an error message and abort. */
void *
xmalloc (size_t bytes)
{
  void *temp = malloc (bytes);

  if (!temp)
    memory_error_and_abort ("xmalloc");
  return (temp);
}
示例#2
0
void *
xcalloc (unsigned int count, unsigned int bytes)
{
  void *temp = (void *)calloc (count, bytes);

  if (!temp)
    memory_error_and_abort ("xcalloc");
  return (temp);
}
示例#3
0
/* Return a pointer to free()able block of memory large enough
   to hold BYTES number of bytes.  If the memory cannot be allocated,
   print an error message and abort. */
void *
xmalloc (unsigned int bytes)
{
  void *temp = (void *)malloc (bytes);

  if (!temp)
    memory_error_and_abort ("xmalloc");
  return (temp);
}
示例#4
0
文件: history.c 项目: pyer/forth
/* Return a pointer to free()able block of memory large enough
   to hold BYTES number of bytes.  If the memory cannot be allocated,
   print an error message and abort. */
PTR_T xmalloc ( size_t bytes )
{
  PTR_T temp;

  temp = malloc (bytes);
  if (temp == 0)
    memory_error_and_abort ("xmalloc");
  return (temp);
}
示例#5
0
文件: history.c 项目: pyer/forth
PTR_T xrealloc ( PTR_T pointer, size_t bytes )
{
  PTR_T temp;

  temp = pointer ? realloc (pointer, bytes) : malloc (bytes);

  if (temp == 0)
    memory_error_and_abort ("xrealloc");
  return (temp);
}
示例#6
0
void *
xrealloc (void *pointer, unsigned int bytes)
{
  void *temp;

  if (!pointer)
    temp = (void *)malloc (bytes);
  else
    temp = (void *)realloc (pointer, bytes);

  if (!temp)
    memory_error_and_abort ("xrealloc");
  return (temp);
}
示例#7
0
void *
xrealloc (void *pointer, size_t bytes)
{
  void *temp;

  if (!pointer)
    temp = malloc (bytes);
  else
    temp = realloc (pointer, bytes);

  if (!temp)
    memory_error_and_abort ("xrealloc");

  return (temp);
}