www.delorie.com/djgpp/doc/libc/libc_872.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

xrealloc

Syntax

 
#include <stdlib.h>

void *xrealloc(void *ptr, size_t size);

Description

This function is just like realloc (see section realloc), except that if there is no more memory, it prints an error message and exits. It can also properly handle ptr being NULL.

Note that, currently, the header `stdlib.h' does not declare a prototype for xrealloc, because many programs declare its prototype in different and conflicting ways. If you use xrealloc in your own code, you might need to provide your own prototype explicitly.

Return Value

A pointer to a possibly new block.

Portability

ANSI/ISO C No
POSIX No

Example

 
char *buf;
buf = (char *)xrealloc(buf, new_size);


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004