1*5dd36a3bSchristos<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2*5dd36a3bSchristos<html xmlns="http://www.w3.org/1999/xhtml"> 3*5dd36a3bSchristos<head> 4*5dd36a3bSchristos<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> 5*5dd36a3bSchristos<meta http-equiv="X-UA-Compatible" content="IE=9"/> 6*5dd36a3bSchristos<meta name="generator" content="Doxygen 1.8.12"/> 7*5dd36a3bSchristos<meta name="viewport" content="width=device-width, initial-scale=1"/> 8*5dd36a3bSchristos<title>libcbor: src/allocators.c File Reference</title> 9*5dd36a3bSchristos<link href="tabs.css" rel="stylesheet" type="text/css"/> 10*5dd36a3bSchristos<script type="text/javascript" src="jquery.js"></script> 11*5dd36a3bSchristos<script type="text/javascript" src="dynsections.js"></script> 12*5dd36a3bSchristos<link href="search/search.css" rel="stylesheet" type="text/css"/> 13*5dd36a3bSchristos<script type="text/javascript" src="search/searchdata.js"></script> 14*5dd36a3bSchristos<script type="text/javascript" src="search/search.js"></script> 15*5dd36a3bSchristos<link href="doxygen.css" rel="stylesheet" type="text/css" /> 16*5dd36a3bSchristos<link href="customdoxygen.css" rel="stylesheet" type="text/css"/> 17*5dd36a3bSchristos</head> 18*5dd36a3bSchristos<body> 19*5dd36a3bSchristos<div id="top"><!-- do not remove this div, it is closed by doxygen! --> 20*5dd36a3bSchristos<div id="titlearea"> 21*5dd36a3bSchristos<table cellspacing="0" cellpadding="0"> 22*5dd36a3bSchristos <tbody> 23*5dd36a3bSchristos <tr style="height: 56px;"> 24*5dd36a3bSchristos <td id="projectalign" style="padding-left: 0.5em;"> 25*5dd36a3bSchristos <div id="projectname">libcbor 26*5dd36a3bSchristos  <span id="projectnumber">0.5.0</span> 27*5dd36a3bSchristos </div> 28*5dd36a3bSchristos <div id="projectbrief">libcbor is a C library for parsing and generating CBOR, the general-purpose schema-less binary data format.</div> 29*5dd36a3bSchristos </td> 30*5dd36a3bSchristos </tr> 31*5dd36a3bSchristos </tbody> 32*5dd36a3bSchristos</table> 33*5dd36a3bSchristos</div> 34*5dd36a3bSchristos<!-- end header part --> 35*5dd36a3bSchristos<!-- Generated by Doxygen 1.8.12 --> 36*5dd36a3bSchristos<script type="text/javascript"> 37*5dd36a3bSchristosvar searchBox = new SearchBox("searchBox", "search",false,'Search'); 38*5dd36a3bSchristos</script> 39*5dd36a3bSchristos<script type="text/javascript" src="menudata.js"></script> 40*5dd36a3bSchristos<script type="text/javascript" src="menu.js"></script> 41*5dd36a3bSchristos<script type="text/javascript"> 42*5dd36a3bSchristos$(function() { 43*5dd36a3bSchristos initMenu('',true,false,'search.php','Search'); 44*5dd36a3bSchristos $(document).ready(function() { init_search(); }); 45*5dd36a3bSchristos}); 46*5dd36a3bSchristos</script> 47*5dd36a3bSchristos<div id="main-nav"></div> 48*5dd36a3bSchristos<!-- window showing the filter options --> 49*5dd36a3bSchristos<div id="MSearchSelectWindow" 50*5dd36a3bSchristos onmouseover="return searchBox.OnSearchSelectShow()" 51*5dd36a3bSchristos onmouseout="return searchBox.OnSearchSelectHide()" 52*5dd36a3bSchristos onkeydown="return searchBox.OnSearchSelectKey(event)"> 53*5dd36a3bSchristos</div> 54*5dd36a3bSchristos 55*5dd36a3bSchristos<!-- iframe showing the search results (closed by default) --> 56*5dd36a3bSchristos<div id="MSearchResultsWindow"> 57*5dd36a3bSchristos<iframe src="javascript:void(0)" frameborder="0" 58*5dd36a3bSchristos name="MSearchResults" id="MSearchResults"> 59*5dd36a3bSchristos</iframe> 60*5dd36a3bSchristos</div> 61*5dd36a3bSchristos 62*5dd36a3bSchristos<div id="nav-path" class="navpath"> 63*5dd36a3bSchristos <ul> 64*5dd36a3bSchristos<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li> </ul> 65*5dd36a3bSchristos</div> 66*5dd36a3bSchristos</div><!-- top --> 67*5dd36a3bSchristos<div class="header"> 68*5dd36a3bSchristos <div class="summary"> 69*5dd36a3bSchristos<a href="#func-members">Functions</a> | 70*5dd36a3bSchristos<a href="#var-members">Variables</a> </div> 71*5dd36a3bSchristos <div class="headertitle"> 72*5dd36a3bSchristos<div class="title">allocators.c File Reference</div> </div> 73*5dd36a3bSchristos</div><!--header--> 74*5dd36a3bSchristos<div class="contents"> 75*5dd36a3bSchristos<div class="textblock"><code>#include "<a class="el" href="common_8h_source.html">cbor/common.h</a>"</code><br /> 76*5dd36a3bSchristos</div> 77*5dd36a3bSchristos<p><a href="allocators_8c_source.html">Go to the source code of this file.</a></p> 78*5dd36a3bSchristos<table class="memberdecls"> 79*5dd36a3bSchristos<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> 80*5dd36a3bSchristosFunctions</h2></td></tr> 81*5dd36a3bSchristos<tr class="memitem:a3f9f1d527374dbb4b48ef3fafa92e0bf"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="allocators_8c.html#a3f9f1d527374dbb4b48ef3fafa92e0bf">cbor_set_allocs</a> (<a class="el" href="common_8h.html#ad89d15c2e3f18e8914fcdffe4d725d42">_cbor_malloc_t</a> custom_malloc, <a class="el" href="common_8h.html#a5b52369a95930104d33301d12faabe75">_cbor_realloc_t</a> custom_realloc, <a class="el" href="common_8h.html#af05bb33f6d22cdac535576c8edaf208c">_cbor_free_t</a> custom_free)</td></tr> 82*5dd36a3bSchristos<tr class="memdesc:a3f9f1d527374dbb4b48ef3fafa92e0bf"><td class="mdescLeft"> </td><td class="mdescRight">Sets the memory management routines to use. <a href="#a3f9f1d527374dbb4b48ef3fafa92e0bf">More...</a><br /></td></tr> 83*5dd36a3bSchristos<tr class="separator:a3f9f1d527374dbb4b48ef3fafa92e0bf"><td class="memSeparator" colspan="2"> </td></tr> 84*5dd36a3bSchristos</table><table class="memberdecls"> 85*5dd36a3bSchristos<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a> 86*5dd36a3bSchristosVariables</h2></td></tr> 87*5dd36a3bSchristos<tr class="memitem:a3218c24af00a3efeaecb1716c8f5a289"><td class="memItemLeft" align="right" valign="top"><a class="el" href="common_8h.html#ad89d15c2e3f18e8914fcdffe4d725d42">_cbor_malloc_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="allocators_8c.html#a3218c24af00a3efeaecb1716c8f5a289">_cbor_malloc</a> = malloc</td></tr> 88*5dd36a3bSchristos<tr class="separator:a3218c24af00a3efeaecb1716c8f5a289"><td class="memSeparator" colspan="2"> </td></tr> 89*5dd36a3bSchristos<tr class="memitem:a84ecc1fc92c3812ab6ced693f2c6254c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="common_8h.html#a5b52369a95930104d33301d12faabe75">_cbor_realloc_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="allocators_8c.html#a84ecc1fc92c3812ab6ced693f2c6254c">_cbor_realloc</a> = realloc</td></tr> 90*5dd36a3bSchristos<tr class="separator:a84ecc1fc92c3812ab6ced693f2c6254c"><td class="memSeparator" colspan="2"> </td></tr> 91*5dd36a3bSchristos<tr class="memitem:a994f4145360ef0bfa3c48e59a5ca7186"><td class="memItemLeft" align="right" valign="top"><a class="el" href="common_8h.html#af05bb33f6d22cdac535576c8edaf208c">_cbor_free_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="allocators_8c.html#a994f4145360ef0bfa3c48e59a5ca7186">_cbor_free</a> = free</td></tr> 92*5dd36a3bSchristos<tr class="separator:a994f4145360ef0bfa3c48e59a5ca7186"><td class="memSeparator" colspan="2"> </td></tr> 93*5dd36a3bSchristos</table> 94*5dd36a3bSchristos<h2 class="groupheader">Function Documentation</h2> 95*5dd36a3bSchristos<a id="a3f9f1d527374dbb4b48ef3fafa92e0bf"></a> 96*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a3f9f1d527374dbb4b48ef3fafa92e0bf">§ </a></span>cbor_set_allocs()</h2> 97*5dd36a3bSchristos 98*5dd36a3bSchristos<div class="memitem"> 99*5dd36a3bSchristos<div class="memproto"> 100*5dd36a3bSchristos <table class="memname"> 101*5dd36a3bSchristos <tr> 102*5dd36a3bSchristos <td class="memname">void cbor_set_allocs </td> 103*5dd36a3bSchristos <td>(</td> 104*5dd36a3bSchristos <td class="paramtype"><a class="el" href="common_8h.html#ad89d15c2e3f18e8914fcdffe4d725d42">_cbor_malloc_t</a> </td> 105*5dd36a3bSchristos <td class="paramname"><em>custom_malloc</em>, </td> 106*5dd36a3bSchristos </tr> 107*5dd36a3bSchristos <tr> 108*5dd36a3bSchristos <td class="paramkey"></td> 109*5dd36a3bSchristos <td></td> 110*5dd36a3bSchristos <td class="paramtype"><a class="el" href="common_8h.html#a5b52369a95930104d33301d12faabe75">_cbor_realloc_t</a> </td> 111*5dd36a3bSchristos <td class="paramname"><em>custom_realloc</em>, </td> 112*5dd36a3bSchristos </tr> 113*5dd36a3bSchristos <tr> 114*5dd36a3bSchristos <td class="paramkey"></td> 115*5dd36a3bSchristos <td></td> 116*5dd36a3bSchristos <td class="paramtype"><a class="el" href="common_8h.html#af05bb33f6d22cdac535576c8edaf208c">_cbor_free_t</a> </td> 117*5dd36a3bSchristos <td class="paramname"><em>custom_free</em> </td> 118*5dd36a3bSchristos </tr> 119*5dd36a3bSchristos <tr> 120*5dd36a3bSchristos <td></td> 121*5dd36a3bSchristos <td>)</td> 122*5dd36a3bSchristos <td></td><td></td> 123*5dd36a3bSchristos </tr> 124*5dd36a3bSchristos </table> 125*5dd36a3bSchristos</div><div class="memdoc"> 126*5dd36a3bSchristos 127*5dd36a3bSchristos<p>Sets the memory management routines to use. </p> 128*5dd36a3bSchristos<p>Only available when CBOR_CUSTOM_ALLOC is truthy</p> 129*5dd36a3bSchristos<pre class="fragment">embed:rst:leading-asterisk 130*5dd36a3bSchristos* .. warning:: This function modifies the global state and should therefore be used accordingly. Changing the memory handlers while allocated items exist will result in a ``free``/``malloc`` mismatch. This function is not thread safe with respect to both itself and all the other *libcbor* functions that work with the heap. 131*5dd36a3bSchristos* .. note:: `realloc` implementation must correctly support `NULL` reallocation 132*5dd36a3bSchristos* </pre><dl class="params"><dt>Parameters</dt><dd> 133*5dd36a3bSchristos <table class="params"> 134*5dd36a3bSchristos <tr><td class="paramname">custom_malloc</td><td>malloc implementation </td></tr> 135*5dd36a3bSchristos <tr><td class="paramname">custom_realloc</td><td>realloc implementation </td></tr> 136*5dd36a3bSchristos <tr><td class="paramname">custom_free</td><td>free implementation </td></tr> 137*5dd36a3bSchristos </table> 138*5dd36a3bSchristos </dd> 139*5dd36a3bSchristos</dl> 140*5dd36a3bSchristos 141*5dd36a3bSchristos<p>Definition at line <a class="el" href="allocators_8c_source.html#l00014">14</a> of file <a class="el" href="allocators_8c_source.html">allocators.c</a>.</p> 142*5dd36a3bSchristos 143*5dd36a3bSchristos</div> 144*5dd36a3bSchristos</div> 145*5dd36a3bSchristos<h2 class="groupheader">Variable Documentation</h2> 146*5dd36a3bSchristos<a id="a994f4145360ef0bfa3c48e59a5ca7186"></a> 147*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a994f4145360ef0bfa3c48e59a5ca7186">§ </a></span>_cbor_free</h2> 148*5dd36a3bSchristos 149*5dd36a3bSchristos<div class="memitem"> 150*5dd36a3bSchristos<div class="memproto"> 151*5dd36a3bSchristos <table class="memname"> 152*5dd36a3bSchristos <tr> 153*5dd36a3bSchristos <td class="memname"><a class="el" href="common_8h.html#af05bb33f6d22cdac535576c8edaf208c">_cbor_free_t</a> _cbor_free = free</td> 154*5dd36a3bSchristos </tr> 155*5dd36a3bSchristos </table> 156*5dd36a3bSchristos</div><div class="memdoc"> 157*5dd36a3bSchristos 158*5dd36a3bSchristos<p>Definition at line <a class="el" href="allocators_8c_source.html#l00012">12</a> of file <a class="el" href="allocators_8c_source.html">allocators.c</a>.</p> 159*5dd36a3bSchristos 160*5dd36a3bSchristos</div> 161*5dd36a3bSchristos</div> 162*5dd36a3bSchristos<a id="a3218c24af00a3efeaecb1716c8f5a289"></a> 163*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a3218c24af00a3efeaecb1716c8f5a289">§ </a></span>_cbor_malloc</h2> 164*5dd36a3bSchristos 165*5dd36a3bSchristos<div class="memitem"> 166*5dd36a3bSchristos<div class="memproto"> 167*5dd36a3bSchristos <table class="memname"> 168*5dd36a3bSchristos <tr> 169*5dd36a3bSchristos <td class="memname"><a class="el" href="common_8h.html#ad89d15c2e3f18e8914fcdffe4d725d42">_cbor_malloc_t</a> _cbor_malloc = malloc</td> 170*5dd36a3bSchristos </tr> 171*5dd36a3bSchristos </table> 172*5dd36a3bSchristos</div><div class="memdoc"> 173*5dd36a3bSchristos 174*5dd36a3bSchristos<p>Definition at line <a class="el" href="allocators_8c_source.html#l00010">10</a> of file <a class="el" href="allocators_8c_source.html">allocators.c</a>.</p> 175*5dd36a3bSchristos 176*5dd36a3bSchristos</div> 177*5dd36a3bSchristos</div> 178*5dd36a3bSchristos<a id="a84ecc1fc92c3812ab6ced693f2c6254c"></a> 179*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a84ecc1fc92c3812ab6ced693f2c6254c">§ </a></span>_cbor_realloc</h2> 180*5dd36a3bSchristos 181*5dd36a3bSchristos<div class="memitem"> 182*5dd36a3bSchristos<div class="memproto"> 183*5dd36a3bSchristos <table class="memname"> 184*5dd36a3bSchristos <tr> 185*5dd36a3bSchristos <td class="memname"><a class="el" href="common_8h.html#a5b52369a95930104d33301d12faabe75">_cbor_realloc_t</a> _cbor_realloc = realloc</td> 186*5dd36a3bSchristos </tr> 187*5dd36a3bSchristos </table> 188*5dd36a3bSchristos</div><div class="memdoc"> 189*5dd36a3bSchristos 190*5dd36a3bSchristos<p>Definition at line <a class="el" href="allocators_8c_source.html#l00011">11</a> of file <a class="el" href="allocators_8c_source.html">allocators.c</a>.</p> 191*5dd36a3bSchristos 192*5dd36a3bSchristos</div> 193*5dd36a3bSchristos</div> 194*5dd36a3bSchristos</div><!-- contents --> 195*5dd36a3bSchristos<!-- start footer part --> 196*5dd36a3bSchristos<hr class="footer"/><address class="footer"><small> 197*5dd36a3bSchristosGenerated on Mon Feb 6 2017 00:26:19 for libcbor by  <a href="http://www.doxygen.org/index.html"> 198*5dd36a3bSchristos<img class="footer" src="doxygen.png" alt="doxygen"/> 199*5dd36a3bSchristos</a> 1.8.12 200*5dd36a3bSchristos</small></address> 201*5dd36a3bSchristos</body> 202*5dd36a3bSchristos</html> 203