silc_buffer_srealloc

SYNOPSIS

    static inline
    SilcBuffer silc_buffer_srealloc(SilcStack stack,
                                    SilcBuffer sb, SilcUInt32 newsize);

DESCRIPTION

Reallocates buffer. Old data is saved into the new buffer. The buffer is exact clone of the old one except that there is now more/less space at the end of buffer. Returns NULL if system is out of memory. This always returns `sb' unless `sb' was NULL.

If the `newsize' is shorter than the current buffer size, the data and tail area of the buffer must be set to correct position before calling this function so that buffer overflow would not occur when the buffer size is reduced.

This routine use SilcStack are memory source. If `stack' is NULL reverts back to normal allocating routine.

Note that this call consumes the `stack'. The caller should push the stack before calling the function and pop it later.