prg_mem_realloc()

Abstract

Re-allocates an existing block of general-purpose memory with a new size.

Syntax

prg_mem_realloc (mem_ptr, size)
Argument Type Description
mem_ptr void * The existing memory block to be re-allocated.
size size_t Number of bytes requested for the memory re-allocation.

Return Type

void *

Pointer to the re-allocated block of memory. PRGC_NIL is returned if the memory re-allocation fails.

prg_mem_funcs.h

Example

/* re-allocate a document request message */
doc_req_msg = (Doc_Req_Msg *) prg_mem_realloc (doc_req_msg,
	sizeof (Big_Doc_Req_Msg));

Details

If no memory block is specified (mem_ptr is PRGC_NIL), this function acts like prg_mem_alloc().

If size is bigger than the previously allocated memory block, the existing memory contents are unchanged and the additional space is filled with zeros.

Purpose

Provides a mechanism to dynamically re-allocate memory with a new size. This function is similar to the realloc() function.

Errors

  • Recoverable Error: Request to allocate (<size> bytes) of Prg memory failed.

Reference

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com