2012-03-01 08:54:20 +00:00
<!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" / >
2012-06-20 07:58:34 +00:00
< meta http-equiv = "X-UA-Compatible" content = "IE=9" / >
2012-03-01 08:54:20 +00:00
< title > HTML Tidy: _TidyAllocator Struct Reference< / title >
< link href = "tabs.css" rel = "stylesheet" type = "text/css" / >
< link href = "doxygen.css" rel = "stylesheet" type = "text/css" / >
< link href = "navtree.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "jquery.js" > < / script >
< script type = "text/javascript" src = "resize.js" > < / script >
< script type = "text/javascript" src = "navtree.js" > < / script >
< script type = "text/javascript" >
$(document).ready(initResizable);
< / script >
< / head >
< body >
< div id = "top" > <!-- do not remove this div! -->
< div id = "titlearea" >
< table cellspacing = "0" cellpadding = "0" >
< tbody >
< tr style = "height: 56px;" >
< td style = "padding-left: 0.5em;" >
< div id = "projectname" > HTML Tidy
  < span id = "projectnumber" > 0.1< / span >
< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
2012-06-20 07:58:34 +00:00
<!-- Generated by Doxygen 1.8.0 -->
2012-03-01 08:54:20 +00:00
< / div >
< div id = "side-nav" class = "ui-resizable side-nav-resizable" >
< div id = "nav-tree" >
< div id = "nav-tree-contents" >
< / div >
< / div >
< div id = "splitbar" style = "-moz-user-select:none;"
class="ui-resizable-handle">
< / div >
< / div >
< script type = "text/javascript" >
initNavTree('struct__TidyAllocator.html','');
< / script >
< div id = "doc-content" >
< div class = "header" >
< div class = "summary" >
< a href = "#pub-attribs" > Data Fields< / a > < / div >
< div class = "headertitle" >
< div class = "title" > _TidyAllocator Struct Reference< div class = "ingroups" > < a class = "el" href = "group__Memory.html" > Memory Allocation< / a > < / div > < / div > < / div >
2012-06-20 07:58:34 +00:00
< / div > <!-- header -->
2012-03-01 08:54:20 +00:00
< div class = "contents" >
2012-06-20 07:58:34 +00:00
2012-03-01 08:54:20 +00:00
< p > < code > #include < < a class = "el" href = "tidy_8h_source.html" > tidy.h< / a > > < / code > < / p >
< table class = "memberdecls" >
< tr > < td colspan = "2" > < h2 > < a name = "pub-attribs" > < / a >
Data Fields< / h2 > < / td > < / tr >
2012-06-20 07:58:34 +00:00
< tr class = "memitem:a2113f1c06a3cfe4cbdf9212a47e6938b" > < td class = "memItemLeft" align = "right" valign = "top" > < a class = "anchor" id = "a2113f1c06a3cfe4cbdf9212a47e6938b" > < / a >
2012-03-01 08:54:20 +00:00
const < a class = "el" href = "group__Memory.html#ga3fe8c5ac7d658618c732565776940ed8" > TidyAllocatorVtbl< / a > *  < / td > < td class = "memItemRight" valign = "bottom" > < b > vtbl< / b > < / td > < / tr >
< / table >
< hr / > < a name = "details" id = "details" > < / a > < h2 > Detailed Description< / h2 >
< div class = "textblock" > < p > An allocator. To create your own allocator, do something like the following:< / p >
< p > typedef struct _MyAllocator { TidyAllocator base; ...other custom allocator state... } MyAllocator;< / p >
2012-06-20 07:58:34 +00:00
< p > void* MyAllocator_alloc(TidyAllocator < em> base, void *block, size_t nBytes) { MyAllocator *self = (MyAllocator)base; ... } (etc)< / p >
2012-03-01 08:54:20 +00:00
< p > static const TidyAllocatorVtbl MyAllocatorVtbl = { MyAllocator_alloc, MyAllocator_realloc, MyAllocator_free, MyAllocator_panic };< / p >
< p > myAllocator allocator; < a class = "el" href = "structTidyDoc.html" > TidyDoc< / a > doc;< / p >
< p > allocator.base.vtbl = & MyAllocatorVtbl; ...initialise allocator specific state... doc = tidyCreateWithAllocator(& allocator); ...< / p >
< p > Although this looks slightly long winded, the advantage is that to create a custom allocator you simply need to set the vtbl pointer correctly. The vtbl itself can reside in static/global data, and hence does not need to be initialised each time an allocator is created, and furthermore the memory is shared amongst all created allocators. < / p >
< / div > < hr / > The documentation for this struct was generated from the following file:< ul >
< li > < a class = "el" href = "tidy_8h_source.html" > tidy.h< / a > < / li >
< / ul >
2012-06-20 07:58:34 +00:00
< / div > <!-- contents -->
2012-03-01 08:54:20 +00:00
< / div >
< div id = "nav-path" class = "navpath" >
< ul >
< li class = "navelem" > < a class = "el" href = "struct__TidyAllocator.html" > _TidyAllocator< / a > < / li >
2012-06-20 07:58:34 +00:00
< li class = "footer" > Generated on Wed Jun 20 2012 16:58:07 for HTML Tidy by
2012-03-01 08:54:20 +00:00
< a href = "http://www.doxygen.org/index.html" >
2012-06-20 07:58:34 +00:00
< img class = "footer" src = "doxygen.png" alt = "doxygen" / > < / a > 1.8.0 < / li >
2012-03-01 08:54:20 +00:00
< / ul >
< / div >
< / body >
< / html >