srv_realloc

Description

Reallocate memory.

Syntax

CS_VOID* srv_realloc(mp,newsize)
CS_VOID         *mp;
CS_INT          newsize;

Parameters

mp

A pointer to the old block of memory.

newsize

The number of bytes to reallocate.

Returns

Table 3-87: Return values (srv_realloc)

Returns

To indicate

A pointer to the newly allocated space

The location of the new space.

A null pointer

Server-Library could not allocate newsize bytes.

Examples

Example 1

#include   <ospublic.h>

/*
** Local Prototype.
*/
extern CS_RETCODE ex_srv_realloc PROTOTYPE((
CS_VOID       *mp,
CS_INT       newsize
));

/* 
** EX_SRV_REALLOC
**
**   Reallocate a memory chunk.
**
** Arguments:
**    mp        A pointer to existing memory block.
**    newsize   The new size of the memory block.
**
** Returns:
**    CS_SUCCEED   Memory was allocated successfully.
**    CS_FAIL      An error was detected.
*/
CS_RETCODE      ex_srv_realloc(mp, newsize)
CS_VOID         *mp;
CS_INT          newsize;
{
      mp = srv_realloc(mp, newsize);

      if(mp == (CS_VOID *)NULL)
      {
           return(CS_FAIL);
      }
      return(CS_SUCCEED);
}

Usage

See also

srv_alloc, srv_free, srv_props