/usr/share/doc/libcext-dev/html/group__cxmemory.html is in libcext-doc 7.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>C Standard Library Extensions: Memory Management Utilities</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">C Standard Library Extensions
 <span id="projectnumber">1.2.2</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">Memory Management Utilities</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga0c60a509c010b61711b01103ae030b4c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__cxmemory.html#ga0c60a509c010b61711b01103ae030b4c">cx_memory_vtable_set</a> (const cx_memory_vtable *table)</td></tr>
<tr class="memdesc:ga0c60a509c010b61711b01103ae030b4c"><td class="mdescLeft"> </td><td class="mdescRight">Install a new set of memory managmement functions. <a href="#ga0c60a509c010b61711b01103ae030b4c">More...</a><br /></td></tr>
<tr class="separator:ga0c60a509c010b61711b01103ae030b4c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga7ae1df2916d7231b1959cebcf4acafab"><td class="memItemLeft" align="right" valign="top">cxptr </td><td class="memItemRight" valign="bottom"><a class="el" href="group__cxmemory.html#ga7ae1df2916d7231b1959cebcf4acafab">cx_malloc</a> (cxsize nbytes)</td></tr>
<tr class="memdesc:ga7ae1df2916d7231b1959cebcf4acafab"><td class="mdescLeft"> </td><td class="mdescRight">Allocate <em>nbytes</em> bytes. <a href="#ga7ae1df2916d7231b1959cebcf4acafab">More...</a><br /></td></tr>
<tr class="separator:ga7ae1df2916d7231b1959cebcf4acafab"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga0bc6a6f776bf144d1e5305e447da3631"><td class="memItemLeft" align="right" valign="top">cxptr </td><td class="memItemRight" valign="bottom"><a class="el" href="group__cxmemory.html#ga0bc6a6f776bf144d1e5305e447da3631">cx_malloc_clear</a> (cxsize nbytes)</td></tr>
<tr class="memdesc:ga0bc6a6f776bf144d1e5305e447da3631"><td class="mdescLeft"> </td><td class="mdescRight">Allocate <em>nbytes</em> bytes and clear them. <a href="#ga0bc6a6f776bf144d1e5305e447da3631">More...</a><br /></td></tr>
<tr class="separator:ga0bc6a6f776bf144d1e5305e447da3631"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gad6e24975b7161a4d3f5fe49fd84df740"><td class="memItemLeft" align="right" valign="top">cxptr </td><td class="memItemRight" valign="bottom"><a class="el" href="group__cxmemory.html#gad6e24975b7161a4d3f5fe49fd84df740">cx_calloc</a> (cxsize natoms, cxsize nbytes)</td></tr>
<tr class="memdesc:gad6e24975b7161a4d3f5fe49fd84df740"><td class="mdescLeft"> </td><td class="mdescRight">Allocate memory for <em>natoms</em> elements of size <em>size</em>. <a href="#gad6e24975b7161a4d3f5fe49fd84df740">More...</a><br /></td></tr>
<tr class="separator:gad6e24975b7161a4d3f5fe49fd84df740"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga9bba647812fb989479d1cb2291ae3bdf"><td class="memItemLeft" align="right" valign="top">cxptr </td><td class="memItemRight" valign="bottom"><a class="el" href="group__cxmemory.html#ga9bba647812fb989479d1cb2291ae3bdf">cx_realloc</a> (cxptr memory, cxsize nbytes)</td></tr>
<tr class="memdesc:ga9bba647812fb989479d1cb2291ae3bdf"><td class="mdescLeft"> </td><td class="mdescRight">Change the size of a memory block. <a href="#ga9bba647812fb989479d1cb2291ae3bdf">More...</a><br /></td></tr>
<tr class="separator:ga9bba647812fb989479d1cb2291ae3bdf"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga535a509573c6617da8f0dccdb2710bc9"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__cxmemory.html#ga535a509573c6617da8f0dccdb2710bc9">cx_free</a> (cxptr memory)</td></tr>
<tr class="memdesc:ga535a509573c6617da8f0dccdb2710bc9"><td class="mdescLeft"> </td><td class="mdescRight">Memory block deallocation. <a href="#ga535a509573c6617da8f0dccdb2710bc9">More...</a><br /></td></tr>
<tr class="separator:ga535a509573c6617da8f0dccdb2710bc9"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gae489c929c01055ebf1fd49b2148c2f92"><td class="memItemLeft" align="right" valign="top">cxbool </td><td class="memItemRight" valign="bottom"><a class="el" href="group__cxmemory.html#gae489c929c01055ebf1fd49b2148c2f92">cx_memory_is_system_malloc</a> (void)</td></tr>
<tr class="memdesc:gae489c929c01055ebf1fd49b2148c2f92"><td class="mdescLeft"> </td><td class="mdescRight">Check if the system's defaults are used for memory allocation. <a href="#gae489c929c01055ebf1fd49b2148c2f92">More...</a><br /></td></tr>
<tr class="separator:gae489c929c01055ebf1fd49b2148c2f92"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>The module provides wrapper routines for the standard C memory management functions. The wrappers for the system memory allocators guarantee to always return valid pointer to the allocated memory block of memory. If the requested memory cannot be allocated the functions stop the program calling <b>abort()</b>, following the philosophy that it is better to terminate the application immediately when running out of resources. The memory deallocator is protected against* passing <code>NULL</code>.</p>
<dl class="section user"><dt>Synopsis:</dt><dd><div class="fragment"><div class="line"><span class="preprocessor">#include <cxmemory.h></span></div>
</div><!-- fragment --> </dd></dl>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="gad6e24975b7161a4d3f5fe49fd84df740"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">cxptr cx_calloc </td>
<td>(</td>
<td class="paramtype">cxsize </td>
<td class="paramname"><em>natoms</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">cxsize </td>
<td class="paramname"><em>nbytes</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Allocate memory for <em>natoms</em> elements of size <em>size</em>. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">natoms</td><td>Number of atomic elements. </td></tr>
<tr><td class="paramname">nbytes</td><td>Element size in bytes.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Pointer to the allocated memory block.</dd></dl>
<p>The function allocates memory suitable for storage of <em>natoms</em> elements of size <em>nbytes</em> bytes. The allocated memory is cleared, i.e. the value 0 is written to each single byte. If the allocation fails the function does not return, but the program execution is stopped printing a message to the error channel showing the current code position. </p>
<p>References <a class="el" href="group__cxmessages.html#gad86cd013f05c08f9dd3b749dcd940377">cx_error()</a>.</p>
<p>Referenced by <a class="el" href="group__cxutils.html#ga91f78cad9b32274b77051bf75178d023">cx_line_alloc()</a>, <a class="el" href="group__cxfileutils.html#ga48dab751d6469555e885ecc7be2b667b">cx_path_alloc()</a>, <a class="el" href="group__cxstring.html#gae73fda53dad0d22b93eb0b21bdb30ef8">cx_string_extend()</a>, and <a class="el" href="group__cxstrutils.html#ga5097161d30fca7aceceafb1267486cfa">cx_strndup()</a>.</p>
</div>
</div>
<a class="anchor" id="ga535a509573c6617da8f0dccdb2710bc9"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void cx_free </td>
<td>(</td>
<td class="paramtype">cxptr </td>
<td class="paramname"><em>memory</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Memory block deallocation. </p>
<dl class="section return"><dt>Returns</dt><dd>Nothing.</dd></dl>
<p>Deallocates a memory block previously allocated by <b><a class="el" href="group__cxmemory.html#ga7ae1df2916d7231b1959cebcf4acafab" title="Allocate nbytes bytes. ">cx_malloc()</a></b>, <b><a class="el" href="group__cxmemory.html#ga0bc6a6f776bf144d1e5305e447da3631" title="Allocate nbytes bytes and clear them. ">cx_malloc_clear()</a></b>, <b><a class="el" href="group__cxmemory.html#gad6e24975b7161a4d3f5fe49fd84df740" title="Allocate memory for natoms elements of size size. ">cx_calloc()</a></b>, or <b><a class="el" href="group__cxmemory.html#ga9bba647812fb989479d1cb2291ae3bdf" title="Change the size of a memory block. ">cx_realloc()</a></b>.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__cxmemory.html#ga7ae1df2916d7231b1959cebcf4acafab" title="Allocate nbytes bytes. ">cx_malloc()</a>, <a class="el" href="group__cxmemory.html#ga0bc6a6f776bf144d1e5305e447da3631" title="Allocate nbytes bytes and clear them. ">cx_malloc_clear()</a>, <a class="el" href="group__cxmemory.html#gad6e24975b7161a4d3f5fe49fd84df740" title="Allocate memory for natoms elements of size size. ">cx_calloc()</a> </dd></dl>
<p>Referenced by <a class="el" href="group__cxdeque.html#gaccc454dff4ccc6be34f54427f7cbd44a">cx_deque_delete()</a>, <a class="el" href="group__cxdeque.html#gaa2fc80632e4d71a70b41ad428b725fd2">cx_deque_destroy()</a>, <a class="el" href="group__cxlist.html#gad3facbcedf3ad4df40d39cb674fbf504">cx_list_delete()</a>, <a class="el" href="group__cxlist.html#gaf1709c7653459559ee7f4f8371dec77c">cx_list_destroy()</a>, <a class="el" href="group__cxmessages.html#ga285fc56885fcb786d62dc7bc94119949">cx_log_remove_handler()</a>, <a class="el" href="group__cxmessages.html#ga7da0d562d30cfcf37a25c1e3af1dfb3b">cx_logv()</a>, <a class="el" href="group__cxmessages.html#ga61bf6d7fbd22c7eaabc33028aae024f7">cx_print()</a>, <a class="el" href="group__cxmessages.html#gadce1cff77bbf105e15da2c3fc1c9caec">cx_printerr()</a>, <a class="el" href="group__cxutils.html#ga98f021d0f4930900ace77052253f5808">cx_program_set_name()</a>, <a class="el" href="group__cxslist.html#gaab85764bce368f99428c95479ae5240b">cx_slist_delete()</a>, <a class="el" href="group__cxslist.html#ga0edc236ae8857991e235f9172140c15e">cx_slist_destroy()</a>, <a class="el" href="group__cxstrutils.html#ga435b2fcd1be708ad7aec8f1523612b8a">cx_strfreev()</a>, <a class="el" href="group__cxstring.html#ga5488378ca5476e1402fa9ac880c5c2e6">cx_string_append()</a>, <a class="el" href="group__cxstring.html#ga7c9522f40844cecd8aa31a537d594a73">cx_string_delete()</a>, <a class="el" href="group__cxstring.html#gac36b30ef4a5fa1036a333964db2ddbd0">cx_string_erase()</a>, <a class="el" href="group__cxstring.html#gae73fda53dad0d22b93eb0b21bdb30ef8">cx_string_extend()</a>, <a class="el" href="group__cxstring.html#gaa9916cdc9590244f118ee8d82d88f576">cx_string_insert()</a>, <a class="el" href="group__cxstring.html#ga5255beabea7b5da62d4d2bf7bf6a27ad">cx_string_prepend()</a>, <a class="el" href="group__cxstring.html#ga379950ddc09f3785959e5765b3d91223">cx_string_resize()</a>, <a class="el" href="group__cxstring.html#gad1c9f69afcebd0ef57d3e5a79fa221ac">cx_string_substr()</a>, and <a class="el" href="group__cxtree.html#ga5e30a6c27e8e423d35a0818f264337fe">cx_tree_delete()</a>.</p>
</div>
</div>
<a class="anchor" id="ga7ae1df2916d7231b1959cebcf4acafab"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">cxptr cx_malloc </td>
<td>(</td>
<td class="paramtype">cxsize </td>
<td class="paramname"><em>nbytes</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Allocate <em>nbytes</em> bytes. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">nbytes</td><td>Number of bytes.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Pointer to the allocated memory block.</dd></dl>
<p>The function allocates <em>nbytes</em> bytes of memory. The allocated memory is not cleared. If the allocation fails the function does not return, but the program execution is stopped printing a message to the error channel showing the current code position.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__cxmemory.html#ga0bc6a6f776bf144d1e5305e447da3631" title="Allocate nbytes bytes and clear them. ">cx_malloc_clear()</a> </dd></dl>
<p>References <a class="el" href="group__cxmessages.html#gad86cd013f05c08f9dd3b749dcd940377">cx_error()</a>.</p>
<p>Referenced by <a class="el" href="group__cxdeque.html#ga08414696dbbe9888ae5f8d1e346e94c8">cx_deque_new()</a>, <a class="el" href="group__cxlist.html#ga488b31c7553afc4ac5b31b276dda80e6">cx_list_new()</a>, <a class="el" href="group__cxmessages.html#gaa41ee3d085b05e65dacc48c437380e2b">cx_log_set_handler()</a>, <a class="el" href="group__cxslist.html#gacbeb18632065ead0f8d196264040a485">cx_slist_new()</a>, <a class="el" href="group__cxstring.html#ga5488378ca5476e1402fa9ac880c5c2e6">cx_string_append()</a>, <a class="el" href="group__cxstring.html#gac36b30ef4a5fa1036a333964db2ddbd0">cx_string_erase()</a>, <a class="el" href="group__cxstring.html#gaa9916cdc9590244f118ee8d82d88f576">cx_string_insert()</a>, <a class="el" href="group__cxstring.html#ga5255beabea7b5da62d4d2bf7bf6a27ad">cx_string_prepend()</a>, <a class="el" href="group__cxstring.html#ga379950ddc09f3785959e5765b3d91223">cx_string_resize()</a>, <a class="el" href="group__cxstring.html#gad1c9f69afcebd0ef57d3e5a79fa221ac">cx_string_substr()</a>, <a class="el" href="group__cxstrutils.html#ga080c5e4cf8f46db99c4fde827f3876ef">cx_strjoinv()</a>, <a class="el" href="group__cxstrutils.html#ga63a07380a56b6934e69d0a59324daf9d">cx_strsplit()</a>, <a class="el" href="group__cxtree.html#ga4d5b89c5e8709645b85996d05478d71e">cx_tree_new()</a>, and <a class="el" href="group__cxutils.html#ga0864ab11701a3596082a3317d94dddf9">cx_vasprintf()</a>.</p>
</div>
</div>
<a class="anchor" id="ga0bc6a6f776bf144d1e5305e447da3631"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">cxptr cx_malloc_clear </td>
<td>(</td>
<td class="paramtype">cxsize </td>
<td class="paramname"><em>nbytes</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Allocate <em>nbytes</em> bytes and clear them. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">nbytes</td><td>Number of bytes.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Pointer to the allocated memory block.</dd></dl>
<p>The function works as <b><a class="el" href="group__cxmemory.html#ga7ae1df2916d7231b1959cebcf4acafab" title="Allocate nbytes bytes. ">cx_malloc()</a></b>, but the allocated memory is cleared, i.e. a 0 is written to each byte of the allocated block.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__cxmemory.html#ga7ae1df2916d7231b1959cebcf4acafab" title="Allocate nbytes bytes. ">cx_malloc()</a> </dd></dl>
<p>References <a class="el" href="group__cxmessages.html#gad86cd013f05c08f9dd3b749dcd940377">cx_error()</a>.</p>
</div>
</div>
<a class="anchor" id="gae489c929c01055ebf1fd49b2148c2f92"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">cxbool cx_memory_is_system_malloc </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Check if the system's defaults are used for memory allocation. </p>
<dl class="section return"><dt>Returns</dt><dd>It returns <code>TRUE</code> if memory is allocated through the system's <b>malloc()</b> implementation, it not it returns <code>FALSE</code>.</dd></dl>
<p>Checks whether the allocator used by <b><a class="el" href="group__cxmemory.html#ga7ae1df2916d7231b1959cebcf4acafab" title="Allocate nbytes bytes. ">cx_malloc()</a></b> is the system's malloc implementation. If the system's malloc implementation is used memory allocated with the system's <b>malloc()</b> call can be used interchangeable with memory allocated by <b><a class="el" href="group__cxmemory.html#ga7ae1df2916d7231b1959cebcf4acafab" title="Allocate nbytes bytes. ">cx_malloc()</a></b>.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__cxmemory.html#ga0c60a509c010b61711b01103ae030b4c" title="Install a new set of memory managmement functions. ">cx_memory_vtable_set()</a> </dd></dl>
<p>Referenced by <a class="el" href="group__cxutils.html#ga0864ab11701a3596082a3317d94dddf9">cx_vasprintf()</a>.</p>
</div>
</div>
<a class="anchor" id="ga0c60a509c010b61711b01103ae030b4c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void cx_memory_vtable_set </td>
<td>(</td>
<td class="paramtype">const cx_memory_vtable * </td>
<td class="paramname"><em>table</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Install a new set of memory managmement functions. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">table</td><td>Set of memory management functions.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Nothing.</dd></dl>
<p>The function installs the replacements for <b>malloc()</b>, <b>calloc()</b>, <b>realloc()</b> and <b>free()</b> provided by <em>table</em> in the internal vtable.</p>
<dl class="section attention"><dt>Attention</dt><dd>The function can be called only <b>once</b> before any of the memory handling functions are called, either explicitly or implicitly through another library functions! For thread-safety reasons the function may <b>only</b> be called from the <em>main</em> thread! </dd></dl>
<p>References <a class="el" href="group__cxmessages.html#ga71f3ac7c5d9726daeba0826a260fb2d3">cx_warning()</a>.</p>
</div>
</div>
<a class="anchor" id="ga9bba647812fb989479d1cb2291ae3bdf"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">cxptr cx_realloc </td>
<td>(</td>
<td class="paramtype">cxptr </td>
<td class="paramname"><em>memory</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">cxsize </td>
<td class="paramname"><em>nbytes</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Change the size of a memory block. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">memory</td><td>Number of atomic elements. </td></tr>
<tr><td class="paramname">nbytes</td><td>New memory block size in bytes.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Pointer to the allocated memory block.</dd></dl>
<p>The function changes the size of an already allocated memory block <em>memory</em> to the new size <em>nbytes</em> bytes. The contents is unchanged to the minimum of old and new size; newly allocated memory is not initialized. If <em>memory</em> is <code>NULL</code> the call to <b><a class="el" href="group__cxmemory.html#ga9bba647812fb989479d1cb2291ae3bdf" title="Change the size of a memory block. ">cx_realloc()</a></b> is equivalent to <b><a class="el" href="group__cxmemory.html#ga7ae1df2916d7231b1959cebcf4acafab" title="Allocate nbytes bytes. ">cx_malloc()</a></b>, and if <em>nbytes</em> is 0 the call is equivalent to <b><a class="el" href="group__cxmemory.html#ga535a509573c6617da8f0dccdb2710bc9" title="Memory block deallocation. ">cx_free()</a></b>. Unless <em>memory</em> is <code>NULL</code>, it must have been returned by a previous call to <b><a class="el" href="group__cxmemory.html#ga7ae1df2916d7231b1959cebcf4acafab" title="Allocate nbytes bytes. ">cx_malloc()</a></b>, <b><a class="el" href="group__cxmemory.html#ga0bc6a6f776bf144d1e5305e447da3631" title="Allocate nbytes bytes and clear them. ">cx_malloc_clear()</a></b>, <b><a class="el" href="group__cxmemory.html#gad6e24975b7161a4d3f5fe49fd84df740" title="Allocate memory for natoms elements of size size. ">cx_calloc()</a></b>, or <b><a class="el" href="group__cxmemory.html#ga9bba647812fb989479d1cb2291ae3bdf" title="Change the size of a memory block. ">cx_realloc()</a></b>.</p>
<dl class="section note"><dt>Note</dt><dd>The returned memory block returned on successfull allocation may not be the same as the one pointed to by <em>memory</em>. Existing references pointing to locations within the original memory block might be invalidated!</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__cxmemory.html#ga7ae1df2916d7231b1959cebcf4acafab" title="Allocate nbytes bytes. ">cx_malloc()</a>, <a class="el" href="group__cxmemory.html#ga0bc6a6f776bf144d1e5305e447da3631" title="Allocate nbytes bytes and clear them. ">cx_malloc_clear()</a>, <a class="el" href="group__cxmemory.html#gad6e24975b7161a4d3f5fe49fd84df740" title="Allocate memory for natoms elements of size size. ">cx_calloc()</a> </dd></dl>
<p>References <a class="el" href="group__cxmessages.html#gad86cd013f05c08f9dd3b749dcd940377">cx_error()</a>.</p>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.10
</small></address>
</body>
</html>
|