06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

pREPC+ <strong>System</strong> <strong>Calls</strong> realloc<br />

realloc Allocates memory.<br />

#include <br />

void *realloc(<br />

void *ptr, /* pointer */<br />

size_t size /* new size */<br />

)<br />

Description<br />

Arguments<br />

Return Value<br />

Error Codes<br />

The realloc() function changes the size of the object pointed to by ptr to the size<br />

specified by size. The contents of the object remain unchanged up to the lesser of<br />

the new or old sizes. If the new size is larger, the value of the newly allocated portion<br />

of the object is indeterminate.<br />

The caller can be blocked if memory is not available and the wait option is selected<br />

in the pREPC+ Configuration Table.<br />

ptr Points to the object whose size is to be changed.<br />

If ptr is a null pointer, realloc() behaves like malloc(). If ptr<br />

does not match a segment previously returned by calloc(),<br />

malloc() or realloc(), the result is unpredictable. If ptr is not a<br />

null pointer and size is 0, the segment is deallocated.<br />

size Specifies the new size of the object.<br />

This function returns a pointer to the possibly moved allocated memory or a null<br />

pointer. If an error occurs, errno is set.<br />

Refer to Appendix B.<br />

<strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong> 3-123<br />

3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!