summaryrefslogtreecommitdiffstats
path: root/runtime/docs/html/map_8c-source.html
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/docs/html/map_8c-source.html')
-rw-r--r--runtime/docs/html/map_8c-source.html1711
1 files changed, 865 insertions, 846 deletions
diff --git a/runtime/docs/html/map_8c-source.html b/runtime/docs/html/map_8c-source.html
index 9d91bd68..1ff69e73 100644
--- a/runtime/docs/html/map_8c-source.html
+++ b/runtime/docs/html/map_8c-source.html
@@ -4,866 +4,885 @@
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.1 -->
-<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
-<h1>map.c</h1><a href="map_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/* -*- linux-c -*- */</span><span class="comment"></span>
-00002 <span class="comment">/** @file map.c</span>
-00003 <span class="comment"> * @brief Implements maps (associative arrays) and lists</span>
-00004 <span class="comment"> */</span>
-00005
-00006 <span class="keyword">static</span> <span class="keywordtype">int</span> map_sizes[] = {
-00007 <span class="keyword">sizeof</span>(<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a>),
-00008 sizeof(struct map_node_stat),
-00009 sizeof(struct map_node_str),
-00010 0
-00011 };
-00012
-00013 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> string_hash(<span class="keyword">const</span> <span class="keywordtype">char</span> *key1, <span class="keyword">const</span> <span class="keywordtype">char</span> *key2)
-00014 {
-00015 <span class="keywordtype">int</span> hash = 0, count = 0;
-00016 <span class="keywordtype">char</span> *v1 = (<span class="keywordtype">char</span> *)key1;
-00017 <span class="keywordtype">char</span> *v2 = (<span class="keywordtype">char</span> *)key2;
-00018 <span class="keywordflow">while</span> (*v1 &amp;&amp; count++ &lt; 5) {
-00019 hash += *v1++;
-00020 }
-00021 <span class="keywordflow">while</span> (v2 &amp;&amp; *v2 &amp;&amp; count++ &lt; 5) {
-00022 hash += *v2++;
-00023 }
-00024 <span class="keywordflow">return</span> hash_long((<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>)hash, HASH_TABLE_BITS);
-00025 }
-00026
-00027 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> mixed_hash(<span class="keyword">const</span> <span class="keywordtype">char</span> *key1, <span class="keywordtype">long</span> key2)
-00028 {
-00029 <span class="keywordtype">int</span> hash = 0, count = 0;
-00030 <span class="keywordtype">char</span> *v = (<span class="keywordtype">char</span> *)key1;
-00031 <span class="keywordflow">while</span> (v &amp;&amp; *v &amp;&amp; count++ &lt; 5)
-00032 hash += *v++;
-00033 return hash_long((<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>)(hash ^ key2), HASH_TABLE_BITS);
-00034 }
-00035 <span class="comment"></span>
-00036 <span class="comment">/** Create a new map.</span>
-00037 <span class="comment"> * Maps must be created at module initialization time.</span>
-00038 <span class="comment"> * @param max_entries The maximum number of entries allowed. Currently that number will</span>
-00039 <span class="comment"> * be preallocated. If more entries are required, the oldest ones will be deleted. This makes</span>
-00040 <span class="comment"> * it effectively a circular buffer. If max_entries is 0, there will be no maximum and entries</span>
-00041 <span class="comment"> * will be allocated dynamically.</span>
-00042 <span class="comment"> * @param type Type of values stored in this map. </span>
-00043 <span class="comment"> * @return A MAP on success or NULL on failure.</span>
-00044 <span class="comment"> */</span>
-00045
-<a name="l00046"></a><a class="code" href="map_8c.html#a3">00046</a> <a class="code" href="structmap__root.html">MAP</a> _stp_map_new(<span class="keywordtype">unsigned</span> max_entries, enum valtype type)
-00047 {
-00048 size_t size;
-00049 <a class="code" href="structmap__root.html">MAP</a> m = (<a class="code" href="structmap__root.html">MAP</a>) <a class="code" href="alloc_8h.html#a5">_stp_valloc</a>(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> <a class="code" href="structmap__root.html">map_root</a>));
-00050 <span class="keywordflow">if</span> (m == NULL)
-00051 <span class="keywordflow">return</span> NULL;
-00052
-00053 INIT_LIST_HEAD(&amp;m-&gt;<a class="code" href="structmap__root.html#o4">head</a>);
-00054
-00055 m-&gt;<a class="code" href="structmap__root.html#o1">maxnum</a> = max_entries;
-00056 m-&gt;<a class="code" href="structmap__root.html#o0">type</a> = type;
-00057 <span class="keywordflow">if</span> (type &gt;= END) {
-00058 dbug (<span class="stringliteral">"map_new: unknown type %d\n"</span>, type);
-00059 <span class="keywordflow">return</span> NULL;
-00060 }
-00061
-00062 <span class="keywordflow">if</span> (max_entries) {
-00063 <span class="keywordtype">void</span> *tmp;
-00064 <span class="keywordtype">int</span> i;
-00065 <span class="keyword">struct </span>list_head *e;
-00066
-00067 INIT_LIST_HEAD(&amp;m-&gt;<a class="code" href="structmap__root.html#o5">pool</a>);
-00068 size = map_sizes[type];
-00069 tmp = <a class="code" href="alloc_8h.html#a5">_stp_valloc</a>(max_entries * size);
-00070
-00071 <span class="keywordflow">for</span> (i = max_entries - 1; i &gt;= 0; i--) {
-00072 e = i * size + tmp;
-00073 dbug (<span class="stringliteral">"e=%lx\n"</span>, (<span class="keywordtype">long</span>)e);
-00074 list_add(e, &amp;m-&gt;<a class="code" href="structmap__root.html#o5">pool</a>);
-00075 }
-00076 m-&gt;<a class="code" href="structmap__root.html#o14">membuf</a> = tmp;
-00077 }
-00078 <span class="keywordflow">return</span> m;
-00079 }
-00080
-00081 <span class="keyword">static</span> <span class="keywordtype">void</span> map_free_strings(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *n)
-00082 {
-00083 <span class="keyword">struct </span>map_node_str *m = (<span class="keyword">struct </span>map_node_str *)n;
-00084 dbug (<span class="stringliteral">"n = %lx\n"</span>, (<span class="keywordtype">long</span>)n);
-00085 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o0">type</a> == STRING) {
-00086 dbug (<span class="stringliteral">"val STRING %lx\n"</span>, (<span class="keywordtype">long</span>)m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a>);
-00087 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a>)
-00088 _stp_free(m-&gt;str);
-00089 }
-00090 if (m-&gt;n.key1type == STR) {
-00091 dbug (<span class="stringliteral">"key1 STR %lx\n"</span>, (<span class="keywordtype">long</span>)<a class="code" href="map_8h.html#a0">key1str</a>(m));
-00092 <span class="keywordflow">if</span> (<a class="code" href="map_8h.html#a0">key1str</a>(m))
-00093 _stp_free(key1str(m));
-00094 }
-00095 if (m-&gt;n.key2type == STR) {
-00096 dbug (<span class="stringliteral">"key2 STR %lx\n"</span>, (<span class="keywordtype">long</span>)<a class="code" href="map_8h.html#a1">key2str</a>(m));
-00097 <span class="keywordflow">if</span> (<a class="code" href="map_8h.html#a1">key2str</a>(m))
-00098 _stp_free(key2str(m));
-00099 }
-00100 }
-00101 <span class="comment"></span>
-00102 <span class="comment">/** Deletes the current element.</span>
-00103 <span class="comment"> * If no current element (key) for this map is set, this function does nothing.</span>
-00104 <span class="comment"> * @param map </span>
-00105 <span class="comment"> */</span>
-00106
-<a name="l00107"></a><a class="code" href="map_8c.html#a5">00107</a> <span class="keywordtype">void</span> _stp_map_key_del(<a class="code" href="structmap__root.html">MAP</a> map)
-00108 {
-00109 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *m;
-00110
-00111 dbug (<span class="stringliteral">"create=%d key=%lx\n"</span>, map-&gt;create, (<span class="keywordtype">long</span>)map-&gt;key);
-00112 <span class="keywordflow">if</span> (map == NULL)
-00113 <span class="keywordflow">return</span>;
-00114
-00115 <span class="keywordflow">if</span> (map-&gt;create) {
-00116 map-&gt;create = 0;
-00117 map-&gt;key = NULL;
-00118 <span class="keywordflow">return</span>;
-00119 }
-00120
-00121 <span class="keywordflow">if</span> (map-&gt;key == NULL)
-00122 <span class="keywordflow">return</span>;
-00123
-00124 m = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)map-&gt;key;
+<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
+<h1>map.c</h1><a href="map_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="preprocessor">#ifndef _MAP_C_</span>
+00002 <span class="preprocessor"></span><span class="preprocessor">#define _MAP_C_</span>
+00003 <span class="preprocessor"></span>
+00004 <span class="comment">/* -*- linux-c -*- */</span><span class="comment"></span>
+00005 <span class="comment">/** @file map.c</span>
+00006 <span class="comment"> * @brief Implements maps (associative arrays) and lists</span>
+00007 <span class="comment"> */</span>
+00008
+00009 <span class="preprocessor">#include "<a class="code" href="map_8h.html">map.h</a>"</span>
+00010 <span class="preprocessor">#include "<a class="code" href="alloc_8c.html">alloc.c</a>"</span>
+00011
+00012 <span class="keyword">static</span> <span class="keywordtype">int</span> map_sizes[] = {
+00013 <span class="keyword">sizeof</span>(<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a>),
+00014 sizeof(struct map_node_stat),
+00015 sizeof(struct map_node_str),
+00016 0
+00017 };
+00018
+00019 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> string_hash(<span class="keyword">const</span> <span class="keywordtype">char</span> *key1, <span class="keyword">const</span> <span class="keywordtype">char</span> *key2)
+00020 {
+00021 <span class="keywordtype">int</span> hash = 0, count = 0;
+00022 <span class="keywordtype">char</span> *v1 = (<span class="keywordtype">char</span> *)key1;
+00023 <span class="keywordtype">char</span> *v2 = (<span class="keywordtype">char</span> *)key2;
+00024 <span class="keywordflow">while</span> (*v1 &amp;&amp; count++ &lt; 5) {
+00025 hash += *v1++;
+00026 }
+00027 <span class="keywordflow">while</span> (v2 &amp;&amp; *v2 &amp;&amp; count++ &lt; 5) {
+00028 hash += *v2++;
+00029 }
+00030 <span class="keywordflow">return</span> hash_long((<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>)hash, HASH_TABLE_BITS);
+00031 }
+00032
+00033 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> mixed_hash(<span class="keyword">const</span> <span class="keywordtype">char</span> *key1, <span class="keywordtype">long</span> key2)
+00034 {
+00035 <span class="keywordtype">int</span> hash = 0, count = 0;
+00036 <span class="keywordtype">char</span> *v = (<span class="keywordtype">char</span> *)key1;
+00037 <span class="keywordflow">while</span> (v &amp;&amp; *v &amp;&amp; count++ &lt; 5)
+00038 hash += *v++;
+00039 return hash_long((<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>)(hash ^ key2), HASH_TABLE_BITS);
+00040 }
+00041 <span class="comment"></span>
+00042 <span class="comment">/** @addtogroup maps </span>
+00043 <span class="comment"> * Implements maps (associative arrays) and lists</span>
+00044 <span class="comment"> * @{ </span>
+00045 <span class="comment"> */</span>
+00046 <span class="comment"></span>
+00047 <span class="comment">/** Create a new map.</span>
+00048 <span class="comment"> * Maps must be created at module initialization time.</span>
+00049 <span class="comment"> * @param max_entries The maximum number of entries allowed. Currently that number will</span>
+00050 <span class="comment"> * be preallocated. If more entries are required, the oldest ones will be deleted. This makes</span>
+00051 <span class="comment"> * it effectively a circular buffer. If max_entries is 0, there will be no maximum and entries</span>
+00052 <span class="comment"> * will be allocated dynamically.</span>
+00053 <span class="comment"> * @param type Type of values stored in this map. </span>
+00054 <span class="comment"> * @return A MAP on success or NULL on failure.</span>
+00055 <span class="comment"> */</span>
+00056
+<a name="l00057"></a><a class="code" href="group__maps.html#ga2">00057</a> <a class="code" href="structmap__root.html">MAP</a> _stp_map_new(<span class="keywordtype">unsigned</span> max_entries, enum valtype type)
+00058 {
+00059 size_t size;
+00060 <a class="code" href="structmap__root.html">MAP</a> m = (<a class="code" href="structmap__root.html">MAP</a>) <a class="code" href="group__alloc.html#ga3">_stp_valloc</a>(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> <a class="code" href="structmap__root.html">map_root</a>));
+00061 <span class="keywordflow">if</span> (m == NULL)
+00062 <span class="keywordflow">return</span> NULL;
+00063
+00064 INIT_LIST_HEAD(&amp;m-&gt;<a class="code" href="structmap__root.html#o4">head</a>);
+00065
+00066 m-&gt;<a class="code" href="structmap__root.html#o1">maxnum</a> = max_entries;
+00067 m-&gt;<a class="code" href="structmap__root.html#o0">type</a> = type;
+00068 <span class="keywordflow">if</span> (type &gt;= END) {
+00069 dbug (<span class="stringliteral">"map_new: unknown type %d\n"</span>, type);
+00070 <span class="keywordflow">return</span> NULL;
+00071 }
+00072
+00073 <span class="keywordflow">if</span> (max_entries) {
+00074 <span class="keywordtype">void</span> *tmp;
+00075 <span class="keywordtype">int</span> i;
+00076 <span class="keyword">struct </span>list_head *e;
+00077
+00078 INIT_LIST_HEAD(&amp;m-&gt;<a class="code" href="structmap__root.html#o5">pool</a>);
+00079 size = map_sizes[type];
+00080 tmp = <a class="code" href="group__alloc.html#ga3">_stp_valloc</a>(max_entries * size);
+00081
+00082 <span class="keywordflow">for</span> (i = max_entries - 1; i &gt;= 0; i--) {
+00083 e = i * size + tmp;
+00084 dbug (<span class="stringliteral">"e=%lx\n"</span>, (<span class="keywordtype">long</span>)e);
+00085 list_add(e, &amp;m-&gt;<a class="code" href="structmap__root.html#o5">pool</a>);
+00086 }
+00087 m-&gt;<a class="code" href="structmap__root.html#o14">membuf</a> = tmp;
+00088 }
+00089 <span class="keywordflow">return</span> m;
+00090 }
+00091
+00092 <span class="keyword">static</span> <span class="keywordtype">void</span> map_free_strings(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *n)
+00093 {
+00094 <span class="keyword">struct </span>map_node_str *m = (<span class="keyword">struct </span>map_node_str *)n;
+00095 dbug (<span class="stringliteral">"n = %lx\n"</span>, (<span class="keywordtype">long</span>)n);
+00096 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o0">type</a> == STRING) {
+00097 dbug (<span class="stringliteral">"val STRING %lx\n"</span>, (<span class="keywordtype">long</span>)m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a>);
+00098 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a>)
+00099 _stp_free(m-&gt;str);
+00100 }
+00101 if (m-&gt;n.key1type == STR) {
+00102 dbug (<span class="stringliteral">"key1 STR %lx\n"</span>, (<span class="keywordtype">long</span>)<a class="code" href="group__maps.html#ga24">key1str</a>(m));
+00103 <span class="keywordflow">if</span> (<a class="code" href="group__maps.html#ga24">key1str</a>(m))
+00104 _stp_free(key1str(m));
+00105 }
+00106 if (m-&gt;n.key2type == STR) {
+00107 dbug (<span class="stringliteral">"key2 STR %lx\n"</span>, (<span class="keywordtype">long</span>)<a class="code" href="group__maps.html#ga25">key2str</a>(m));
+00108 <span class="keywordflow">if</span> (<a class="code" href="group__maps.html#ga25">key2str</a>(m))
+00109 _stp_free(key2str(m));
+00110 }
+00111 }
+00112 <span class="comment"></span>
+00113 <span class="comment">/** Deletes the current element.</span>
+00114 <span class="comment"> * If no current element (key) for this map is set, this function does nothing.</span>
+00115 <span class="comment"> * @param map </span>
+00116 <span class="comment"> */</span>
+00117
+<a name="l00118"></a><a class="code" href="group__maps.html#ga4">00118</a> <span class="keywordtype">void</span> _stp_map_key_del(<a class="code" href="structmap__root.html">MAP</a> map)
+00119 {
+00120 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *m;
+00121
+00122 dbug (<span class="stringliteral">"create=%d key=%lx\n"</span>, map-&gt;create, (<span class="keywordtype">long</span>)map-&gt;key);
+00123 <span class="keywordflow">if</span> (map == NULL)
+00124 <span class="keywordflow">return</span>;
00125
-00126 <span class="comment">/* remove node from old hash list */</span>
-00127 hlist_del_init(&amp;m-&gt;<a class="code" href="structmap__node.html#o1">hnode</a>);
-00128
-00129 <span class="comment">/* remove from entry list */</span>
-00130 list_del(&amp;m-&gt;<a class="code" href="structmap__node.html#o0">lnode</a>);
+00126 <span class="keywordflow">if</span> (map-&gt;create) {
+00127 map-&gt;create = 0;
+00128 map-&gt;key = NULL;
+00129 <span class="keywordflow">return</span>;
+00130 }
00131
-00132 <span class="comment">/* remove any allocated string storage */</span>
-00133 map_free_strings(map, (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)map-&gt;key);
+00132 <span class="keywordflow">if</span> (map-&gt;key == NULL)
+00133 <span class="keywordflow">return</span>;
00134
-00135 <span class="keywordflow">if</span> (map-&gt;maxnum)
-00136 list_add(&amp;m-&gt;<a class="code" href="structmap__node.html#o0">lnode</a>, &amp;map-&gt;pool);
-00137 <span class="keywordflow">else</span>
-00138 <a class="code" href="alloc_8h.html#a6">_stp_free</a>(m);
+00135 m = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)map-&gt;key;
+00136
+00137 <span class="comment">/* remove node from old hash list */</span>
+00138 hlist_del_init(&amp;m-&gt;<a class="code" href="structmap__node.html#o1">hnode</a>);
00139
-00140 map-&gt;key = NULL;
-00141 map-&gt;num--;
-00142 }
-00143 <span class="comment"></span>
-00144 <span class="comment">/** Get the first element in a map.</span>
-00145 <span class="comment"> * @param map </span>
-00146 <span class="comment"> * @returns a pointer to the first element.</span>
-00147 <span class="comment"> * This is typically used with _stp_map_iter(). See the foreach() macro</span>
-00148 <span class="comment"> * for typical usage. It probably does what you want anyway.</span>
-00149 <span class="comment"> * @sa foreach</span>
-00150 <span class="comment"> */</span>
-00151
-<a name="l00152"></a><a class="code" href="map_8c.html#a6">00152</a> <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *<a class="code" href="map_8c.html#a6">_stp_map_start</a>(<a class="code" href="structmap__root.html">MAP</a> map)
-00153 {
-00154 <span class="keywordflow">if</span> (map == NULL)
-00155 <span class="keywordflow">return</span> NULL;
-00156
-00157 dbug (<span class="stringliteral">"%lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o4">head</a>.next);
-00158
-00159 <span class="keywordflow">if</span> (list_empty(&amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>))
-00160 <span class="keywordflow">return</span> NULL;
-00161
-00162 <span class="keywordflow">return</span> (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)map-&gt;<a class="code" href="structmap__root.html#o4">head</a>.next;
-00163 }
-00164 <span class="comment"></span>
-00165 <span class="comment">/** Get the next element in a map.</span>
-00166 <span class="comment"> * @param map </span>
-00167 <span class="comment"> * @param m a pointer to the current element, returned from _stp_map_start()</span>
-00168 <span class="comment"> * or _stp_map_iter().</span>
-00169 <span class="comment"> * @returns a pointer to the next element.</span>
-00170 <span class="comment"> * This is typically used with _stp_map_start(). See the foreach() macro</span>
-00171 <span class="comment"> * for typical usage. It probably does what you want anyway.</span>
-00172 <span class="comment"> * @sa foreach</span>
-00173 <span class="comment"> */</span>
-00174
-<a name="l00175"></a><a class="code" href="map_8c.html#a7">00175</a> <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *<a class="code" href="map_8c.html#a7">_stp_map_iter</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *m)
-00176 {
-00177 <span class="keywordflow">if</span> (map == NULL)
-00178 <span class="keywordflow">return</span> NULL;
-00179
-00180 dbug (<span class="stringliteral">"%lx next=%lx prev=%lx map-&gt;head.next=%lx\n"</span>, (<span class="keywordtype">long</span>)m,
-00181 (<span class="keywordtype">long</span>)m-&gt;lnode.next, (<span class="keywordtype">long</span>)m-&gt;lnode.prev, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o4">head</a>.next);
-00182
-00183 <span class="keywordflow">if</span> (m-&gt;lnode.next == &amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>)
-00184 <span class="keywordflow">return</span> NULL;
+00140 <span class="comment">/* remove from entry list */</span>
+00141 list_del(&amp;m-&gt;<a class="code" href="structmap__node.html#o0">lnode</a>);
+00142
+00143 <span class="comment">/* remove any allocated string storage */</span>
+00144 map_free_strings(map, (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)map-&gt;key);
+00145
+00146 <span class="keywordflow">if</span> (map-&gt;maxnum)
+00147 list_add(&amp;m-&gt;<a class="code" href="structmap__node.html#o0">lnode</a>, &amp;map-&gt;pool);
+00148 <span class="keywordflow">else</span>
+00149 <a class="code" href="group__alloc.html#ga4">_stp_free</a>(m);
+00150
+00151 map-&gt;key = NULL;
+00152 map-&gt;num--;
+00153 }
+00154 <span class="comment"></span>
+00155 <span class="comment">/** Get the first element in a map.</span>
+00156 <span class="comment"> * @param map </span>
+00157 <span class="comment"> * @returns a pointer to the first element.</span>
+00158 <span class="comment"> * This is typically used with _stp_map_iter(). See the foreach() macro</span>
+00159 <span class="comment"> * for typical usage. It probably does what you want anyway.</span>
+00160 <span class="comment"> * @sa foreach</span>
+00161 <span class="comment"> */</span>
+00162
+<a name="l00163"></a><a class="code" href="group__maps.html#ga5">00163</a> <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *<a class="code" href="group__maps.html#ga5">_stp_map_start</a>(<a class="code" href="structmap__root.html">MAP</a> map)
+00164 {
+00165 <span class="keywordflow">if</span> (map == NULL)
+00166 <span class="keywordflow">return</span> NULL;
+00167
+00168 dbug (<span class="stringliteral">"%lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o4">head</a>.next);
+00169
+00170 <span class="keywordflow">if</span> (list_empty(&amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>))
+00171 <span class="keywordflow">return</span> NULL;
+00172
+00173 <span class="keywordflow">return</span> (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)map-&gt;<a class="code" href="structmap__root.html#o4">head</a>.next;
+00174 }
+00175 <span class="comment"></span>
+00176 <span class="comment">/** Get the next element in a map.</span>
+00177 <span class="comment"> * @param map </span>
+00178 <span class="comment"> * @param m a pointer to the current element, returned from _stp_map_start()</span>
+00179 <span class="comment"> * or _stp_map_iter().</span>
+00180 <span class="comment"> * @returns a pointer to the next element.</span>
+00181 <span class="comment"> * This is typically used with _stp_map_start(). See the foreach() macro</span>
+00182 <span class="comment"> * for typical usage. It probably does what you want anyway.</span>
+00183 <span class="comment"> * @sa foreach</span>
+00184 <span class="comment"> */</span>
00185
-00186 <span class="keywordflow">return</span> (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)m-&gt;<a class="code" href="structmap__node.html#o0">lnode</a>.next;
-00187 }
-00188 <span class="comment"></span>
-00189 <span class="comment">/** Deletes a map.</span>
-00190 <span class="comment"> * Deletes a map, freeing all memory in all elements. Normally done only when the module exits.</span>
-00191 <span class="comment"> * @param map</span>
-00192 <span class="comment"> */</span>
+<a name="l00186"></a><a class="code" href="group__maps.html#ga6">00186</a> <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *<a class="code" href="group__maps.html#ga6">_stp_map_iter</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *m)
+00187 {
+00188 <span class="keywordflow">if</span> (map == NULL)
+00189 <span class="keywordflow">return</span> NULL;
+00190
+00191 dbug (<span class="stringliteral">"%lx next=%lx prev=%lx map-&gt;head.next=%lx\n"</span>, (<span class="keywordtype">long</span>)m,
+00192 (<span class="keywordtype">long</span>)m-&gt;lnode.next, (<span class="keywordtype">long</span>)m-&gt;lnode.prev, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o4">head</a>.next);
00193
-<a name="l00194"></a><a class="code" href="map_8c.html#a8">00194</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a8">_stp_map_del</a>(<a class="code" href="structmap__root.html">MAP</a> map)
-00195 {
-00196 <span class="keywordflow">if</span> (map == NULL)
-00197 <span class="keywordflow">return</span>;
-00198
-00199 <span class="keywordflow">if</span> (!list_empty(&amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>)) {
-00200 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *ptr = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)map-&gt;<a class="code" href="structmap__root.html#o4">head</a>.next;
-00201 <span class="keywordflow">while</span> (ptr &amp;&amp; ptr != (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)&amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>) {
-00202 map_free_strings(map, ptr);
-00203 ptr = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)ptr-&gt;<a class="code" href="structmap__node.html#o0">lnode</a>.next;
-00204 }
-00205 }
-00206 <a class="code" href="alloc_8h.html#a7">_stp_vfree</a>(map-&gt;<a class="code" href="structmap__root.html#o14">membuf</a>);
-00207 <a class="code" href="alloc_8h.html#a7">_stp_vfree</a>(map);
-00208 }
+00194 <span class="keywordflow">if</span> (m-&gt;lnode.next == &amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>)
+00195 <span class="keywordflow">return</span> NULL;
+00196
+00197 <span class="keywordflow">return</span> (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)m-&gt;<a class="code" href="structmap__node.html#o0">lnode</a>.next;
+00198 }
+00199 <span class="comment"></span>
+00200 <span class="comment">/** Deletes a map.</span>
+00201 <span class="comment"> * Deletes a map, freeing all memory in all elements. Normally done only when the module exits.</span>
+00202 <span class="comment"> * @param map</span>
+00203 <span class="comment"> */</span>
+00204
+<a name="l00205"></a><a class="code" href="group__maps.html#ga7">00205</a> <span class="keywordtype">void</span> <a class="code" href="group__maps.html#ga7">_stp_map_del</a>(<a class="code" href="structmap__root.html">MAP</a> map)
+00206 {
+00207 <span class="keywordflow">if</span> (map == NULL)
+00208 <span class="keywordflow">return</span>;
00209
-00210 <span class="comment">/********************** KEY FUNCTIONS *********************/</span>
-00211
-00212 <span class="comment"></span>
-00213 <span class="comment">/** Set the map's key to two longs.</span>
-00214 <span class="comment"> * This sets the current element based on a key of two strings. If the keys are</span>
-00215 <span class="comment"> * not found, a new element will not be created until a &lt;i&gt;_stp_map_set_xxx&lt;/i&gt;</span>
-00216 <span class="comment"> * call.</span>
-00217 <span class="comment"> * @param map</span>
-00218 <span class="comment"> * @param key1 first key</span>
-00219 <span class="comment"> * @param key2 second key</span>
-00220 <span class="comment"> */</span>
-00221
-<a name="l00222"></a><a class="code" href="map_8c.html#a9">00222</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a9">_stp_map_key_long_long</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">long</span> key1, <span class="keywordtype">long</span> key2)
-00223 {
-00224 <span class="keywordtype">unsigned</span> hv;
-00225 <span class="keyword">struct </span>hlist_head *head;
-00226 <span class="keyword">struct </span>hlist_node *e;
-00227
-00228 <span class="keywordflow">if</span> (map == NULL)
-00229 <span class="keywordflow">return</span>;
-00230
-00231 hv = hash_long(key1 ^ key2, HASH_TABLE_BITS);
-00232 head = &amp;map-&gt;<a class="code" href="structmap__root.html#o13">hashes</a>[hv];
-00233
-00234 dbug (<span class="stringliteral">"hash for %ld,%ld is %d\n"</span>, key1, key2, hv);
-00235
-00236 hlist_for_each(e, head) {
-00237 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *n =
-00238 (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)((long)e - <span class="keyword">sizeof</span>(<span class="keyword">struct </span>hlist_node));
-00239 dbug (<span class="stringliteral">"n =%lx key=%ld,%ld\n"</span>, (<span class="keywordtype">long</span>)n, n-&gt;<a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o0">val</a>, n-&gt;key2.<a class="code" href="unionkey__data.html#o0">val</a>);
-00240 <span class="keywordflow">if</span> (key1 == n-&gt;key1.val &amp;&amp; key2 == n-&gt;key2.val) {
-00241 map-&gt;<a class="code" href="structmap__root.html#o6">key</a> = n;
-00242 dbug (<span class="stringliteral">"saving key %lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
-00243 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 0;
-00244 <span class="keywordflow">return</span>;
-00245 }
-00246 }
-00247
-00248 map-&gt;<a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o0">val</a> = key1;
-00249 map-&gt;<a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o0">val</a> = key2;
-00250 map-&gt;<a class="code" href="structmap__root.html#o8">c_key1type</a> = LONG;
-00251 map-&gt;<a class="code" href="structmap__root.html#o9">c_key2type</a> = LONG;
-00252 map-&gt;<a class="code" href="structmap__root.html#o10">c_keyhead</a> = head;
-00253 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 1;
-00254 }
-00255 <span class="comment"></span>
-00256 <span class="comment">/** Set the map's key to two strings.</span>
-00257 <span class="comment"> * This sets the current element based on a key of two strings. If the keys are</span>
-00258 <span class="comment"> * not found, a new element will not be created until a &lt;i&gt;_stp_map_set_xxx&lt;/i&gt;</span>
-00259 <span class="comment"> * call.</span>
-00260 <span class="comment"> * @param map</span>
-00261 <span class="comment"> * @param key1 first key</span>
-00262 <span class="comment"> * @param key2 second key</span>
-00263 <span class="comment"> */</span>
-00264
-<a name="l00265"></a><a class="code" href="map_8c.html#a10">00265</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a10">_stp_map_key_str_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *key1, <span class="keywordtype">char</span> *key2)
-00266 {
-00267 <span class="keywordtype">unsigned</span> hv;
-00268 <span class="keyword">struct </span>hlist_head *head;
-00269 <span class="keyword">struct </span>hlist_node *e;
-00270
-00271 <span class="keywordflow">if</span> (map == NULL)
-00272 <span class="keywordflow">return</span>;
-00273
-00274 <span class="keywordflow">if</span> (key1 == NULL) {
-00275 map-&gt;<a class="code" href="structmap__root.html#o6">key</a> = NULL;
-00276 <span class="keywordflow">return</span>;
-00277 }
-00278
-00279 hv = string_hash(key1, key2);
-00280 head = &amp;map-&gt;<a class="code" href="structmap__root.html#o13">hashes</a>[hv];
+00210 <span class="keywordflow">if</span> (!list_empty(&amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>)) {
+00211 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *ptr = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)map-&gt;<a class="code" href="structmap__root.html#o4">head</a>.next;
+00212 <span class="keywordflow">while</span> (ptr &amp;&amp; ptr != (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)&amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>) {
+00213 map_free_strings(map, ptr);
+00214 ptr = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)ptr-&gt;<a class="code" href="structmap__node.html#o0">lnode</a>.next;
+00215 }
+00216 }
+00217 <a class="code" href="group__alloc.html#ga5">_stp_vfree</a>(map-&gt;<a class="code" href="structmap__root.html#o14">membuf</a>);
+00218 <a class="code" href="group__alloc.html#ga5">_stp_vfree</a>(map);
+00219 }
+00220
+00221 <span class="comment">/********************** KEY FUNCTIONS *********************/</span>
+00222
+00223 <span class="comment"></span>
+00224 <span class="comment">/** Set the map's key to two longs.</span>
+00225 <span class="comment"> * This sets the current element based on a key of two strings. If the keys are</span>
+00226 <span class="comment"> * not found, a new element will not be created until a &lt;i&gt;_stp_map_set_xxx&lt;/i&gt;</span>
+00227 <span class="comment"> * call.</span>
+00228 <span class="comment"> * @param map</span>
+00229 <span class="comment"> * @param key1 first key</span>
+00230 <span class="comment"> * @param key2 second key</span>
+00231 <span class="comment"> */</span>
+00232
+<a name="l00233"></a><a class="code" href="group__maps.html#ga8">00233</a> <span class="keywordtype">void</span> <a class="code" href="group__maps.html#ga8">_stp_map_key_long_long</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">long</span> key1, <span class="keywordtype">long</span> key2)
+00234 {
+00235 <span class="keywordtype">unsigned</span> hv;
+00236 <span class="keyword">struct </span>hlist_head *head;
+00237 <span class="keyword">struct </span>hlist_node *e;
+00238
+00239 <span class="keywordflow">if</span> (map == NULL)
+00240 <span class="keywordflow">return</span>;
+00241
+00242 hv = hash_long(key1 ^ key2, HASH_TABLE_BITS);
+00243 head = &amp;map-&gt;<a class="code" href="structmap__root.html#o13">hashes</a>[hv];
+00244
+00245 dbug (<span class="stringliteral">"hash for %ld,%ld is %d\n"</span>, key1, key2, hv);
+00246
+00247 hlist_for_each(e, head) {
+00248 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *n =
+00249 (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)((long)e - <span class="keyword">sizeof</span>(<span class="keyword">struct </span>hlist_node));
+00250 dbug (<span class="stringliteral">"n =%lx key=%ld,%ld\n"</span>, (<span class="keywordtype">long</span>)n, n-&gt;<a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o0">val</a>, n-&gt;key2.<a class="code" href="unionkey__data.html#o0">val</a>);
+00251 <span class="keywordflow">if</span> (key1 == n-&gt;key1.val &amp;&amp; key2 == n-&gt;key2.val) {
+00252 map-&gt;<a class="code" href="structmap__root.html#o6">key</a> = n;
+00253 dbug (<span class="stringliteral">"saving key %lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
+00254 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 0;
+00255 <span class="keywordflow">return</span>;
+00256 }
+00257 }
+00258
+00259 map-&gt;<a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o0">val</a> = key1;
+00260 map-&gt;<a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o0">val</a> = key2;
+00261 map-&gt;<a class="code" href="structmap__root.html#o8">c_key1type</a> = LONG;
+00262 map-&gt;<a class="code" href="structmap__root.html#o9">c_key2type</a> = LONG;
+00263 map-&gt;<a class="code" href="structmap__root.html#o10">c_keyhead</a> = head;
+00264 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 1;
+00265 }
+00266 <span class="comment"></span>
+00267 <span class="comment">/** Set the map's key to two strings.</span>
+00268 <span class="comment"> * This sets the current element based on a key of two strings. If the keys are</span>
+00269 <span class="comment"> * not found, a new element will not be created until a &lt;i&gt;_stp_map_set_xxx&lt;/i&gt;</span>
+00270 <span class="comment"> * call.</span>
+00271 <span class="comment"> * @param map</span>
+00272 <span class="comment"> * @param key1 first key</span>
+00273 <span class="comment"> * @param key2 second key</span>
+00274 <span class="comment"> */</span>
+00275
+<a name="l00276"></a><a class="code" href="group__maps.html#ga9">00276</a> <span class="keywordtype">void</span> <a class="code" href="group__maps.html#ga9">_stp_map_key_str_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *key1, <span class="keywordtype">char</span> *key2)
+00277 {
+00278 <span class="keywordtype">unsigned</span> hv;
+00279 <span class="keyword">struct </span>hlist_head *head;
+00280 <span class="keyword">struct </span>hlist_node *e;
00281
-00282 dbug (<span class="stringliteral">"hash for %s,%s is %d\n"</span>, key1, key2, hv);
-00283
-00284 hlist_for_each(e, head) {
-00285 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *n =
-00286 (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)((long)e - <span class="keyword">sizeof</span>(<span class="keyword">struct </span>hlist_node));
-00287 dbug (<span class="stringliteral">"e =%lx key=%s,%s\n"</span>, (<span class="keywordtype">long</span>)e, n-&gt;<a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>,n-&gt;<a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>);
-00288 <span class="keywordflow">if</span> (strcmp(key1, n-&gt;<a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>) == 0
-00289 &amp;&amp; (key2 == NULL || strcmp(key2, n-&gt;<a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>) == 0)) {
-00290 map-&gt;<a class="code" href="structmap__root.html#o6">key</a> = n;
-00291 dbug (<span class="stringliteral">"saving key %lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
-00292 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 0;
-00293 <span class="keywordflow">return</span>;
-00294 }
-00295 }
-00296
-00297 map-&gt;<a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o1">str</a> = key1;
-00298 map-&gt;<a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o1">str</a> = key2;
-00299 map-&gt;<a class="code" href="structmap__root.html#o8">c_key1type</a> = STR;
-00300 map-&gt;<a class="code" href="structmap__root.html#o9">c_key2type</a> = STR;
-00301 map-&gt;<a class="code" href="structmap__root.html#o10">c_keyhead</a> = head;
-00302 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 1;
-00303 }
-00304 <span class="comment"></span>
-00305 <span class="comment">/** Set the map's key to a string and a long.</span>
-00306 <span class="comment"> * This sets the current element based on a key of a string and a long. If the keys are</span>
-00307 <span class="comment"> * not found, a new element will not be created until a &lt;i&gt;_stp_map_set_xxx&lt;/i&gt;</span>
-00308 <span class="comment"> * call.</span>
-00309 <span class="comment"> * @param map</span>
-00310 <span class="comment"> * @param key1 first key</span>
-00311 <span class="comment"> * @param key2 second key</span>
-00312 <span class="comment"> */</span>
-00313
-<a name="l00314"></a><a class="code" href="map_8c.html#a11">00314</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a11">_stp_map_key_str_long</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *key1, <span class="keywordtype">long</span> key2)
-00315 {
-00316 <span class="keywordtype">unsigned</span> hv;
-00317 <span class="keyword">struct </span>hlist_head *head;
-00318 <span class="keyword">struct </span>hlist_node *e;
-00319
-00320 <span class="keywordflow">if</span> (map == NULL)
-00321 <span class="keywordflow">return</span>;
-00322
-00323 <span class="keywordflow">if</span> (key1 == NULL) {
-00324 map-&gt;<a class="code" href="structmap__root.html#o6">key</a> = NULL;
-00325 <span class="keywordflow">return</span>;
-00326 }
-00327
-00328 hv = mixed_hash(key1, key2);
-00329 head = &amp;map-&gt;<a class="code" href="structmap__root.html#o13">hashes</a>[hv];
+00282 <span class="keywordflow">if</span> (map == NULL)
+00283 <span class="keywordflow">return</span>;
+00284
+00285 <span class="keywordflow">if</span> (key1 == NULL) {
+00286 map-&gt;<a class="code" href="structmap__root.html#o6">key</a> = NULL;
+00287 <span class="keywordflow">return</span>;
+00288 }
+00289
+00290 hv = string_hash(key1, key2);
+00291 head = &amp;map-&gt;<a class="code" href="structmap__root.html#o13">hashes</a>[hv];
+00292
+00293 dbug (<span class="stringliteral">"hash for %s,%s is %d\n"</span>, key1, key2, hv);
+00294
+00295 hlist_for_each(e, head) {
+00296 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *n =
+00297 (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)((long)e - <span class="keyword">sizeof</span>(<span class="keyword">struct </span>hlist_node));
+00298 dbug (<span class="stringliteral">"e =%lx key=%s,%s\n"</span>, (<span class="keywordtype">long</span>)e, n-&gt;<a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>,n-&gt;<a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>);
+00299 <span class="keywordflow">if</span> (strcmp(key1, n-&gt;<a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>) == 0
+00300 &amp;&amp; (key2 == NULL || strcmp(key2, n-&gt;<a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>) == 0)) {
+00301 map-&gt;<a class="code" href="structmap__root.html#o6">key</a> = n;
+00302 dbug (<span class="stringliteral">"saving key %lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
+00303 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 0;
+00304 <span class="keywordflow">return</span>;
+00305 }
+00306 }
+00307
+00308 map-&gt;<a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o1">str</a> = key1;
+00309 map-&gt;<a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o1">str</a> = key2;
+00310 map-&gt;<a class="code" href="structmap__root.html#o8">c_key1type</a> = STR;
+00311 map-&gt;<a class="code" href="structmap__root.html#o9">c_key2type</a> = STR;
+00312 map-&gt;<a class="code" href="structmap__root.html#o10">c_keyhead</a> = head;
+00313 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 1;
+00314 }
+00315 <span class="comment"></span>
+00316 <span class="comment">/** Set the map's key to a string and a long.</span>
+00317 <span class="comment"> * This sets the current element based on a key of a string and a long. If the keys are</span>
+00318 <span class="comment"> * not found, a new element will not be created until a &lt;i&gt;_stp_map_set_xxx&lt;/i&gt;</span>
+00319 <span class="comment"> * call.</span>
+00320 <span class="comment"> * @param map</span>
+00321 <span class="comment"> * @param key1 first key</span>
+00322 <span class="comment"> * @param key2 second key</span>
+00323 <span class="comment"> */</span>
+00324
+<a name="l00325"></a><a class="code" href="group__maps.html#ga10">00325</a> <span class="keywordtype">void</span> <a class="code" href="group__maps.html#ga10">_stp_map_key_str_long</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *key1, <span class="keywordtype">long</span> key2)
+00326 {
+00327 <span class="keywordtype">unsigned</span> hv;
+00328 <span class="keyword">struct </span>hlist_head *head;
+00329 <span class="keyword">struct </span>hlist_node *e;
00330
-00331 dbug (<span class="stringliteral">"hash for %s,%ld is %d\n"</span>, key1, key2, hv);
-00332
-00333 hlist_for_each(e, head) {
-00334 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *n =
-00335 (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)((long)e - <span class="keyword">sizeof</span>(<span class="keyword">struct </span>hlist_node));
-00336 dbug (<span class="stringliteral">"e =%lx key=%s,%ld\n"</span>, (<span class="keywordtype">long</span>)e, n-&gt;<a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>,(<span class="keywordtype">long</span>)n-&gt;<a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o0">val</a>);
-00337 <span class="keywordflow">if</span> (strcmp(key1, n-&gt;<a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>) == 0 &amp;&amp; key2 == n-&gt;<a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o0">val</a>) {
-00338 map-&gt;<a class="code" href="structmap__root.html#o6">key</a> = n;
-00339 dbug (<span class="stringliteral">"saving key %lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
-00340 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 0;
-00341 <span class="keywordflow">return</span>;
-00342 }
-00343 }
-00344
-00345 map-&gt;<a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o1">str</a> = key1;
-00346 map-&gt;<a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o0">val</a> = key2;
-00347 map-&gt;<a class="code" href="structmap__root.html#o8">c_key1type</a> = STR;
-00348 map-&gt;<a class="code" href="structmap__root.html#o9">c_key2type</a> = LONG;
-00349 map-&gt;<a class="code" href="structmap__root.html#o10">c_keyhead</a> = head;
-00350 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 1;
-00351 }
-00352 <span class="comment"></span>
-00353 <span class="comment">/** Set the map's key to a long and a string.</span>
-00354 <span class="comment"> * This sets the current element based on a key of a long and a string. If the keys are</span>
-00355 <span class="comment"> * not found, a new element will not be created until a &lt;i&gt;_stp_map_set_xxx&lt;/i&gt;</span>
-00356 <span class="comment"> * call.</span>
-00357 <span class="comment"> * @param map</span>
-00358 <span class="comment"> * @param key1 first key</span>
-00359 <span class="comment"> * @param key2 second key</span>
-00360 <span class="comment"> */</span>
-00361
-<a name="l00362"></a><a class="code" href="map_8c.html#a12">00362</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a12">_stp_map_key_long_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">long</span> key1, <span class="keywordtype">char</span> *key2)
-00363 {
-00364 <span class="keywordtype">unsigned</span> hv;
-00365 <span class="keyword">struct </span>hlist_head *head;
-00366 <span class="keyword">struct </span>hlist_node *e;
-00367
-00368 <span class="keywordflow">if</span> (map == NULL)
-00369 <span class="keywordflow">return</span>;
-00370
-00371 hv = mixed_hash(key2, key1);
-00372 head = &amp;map-&gt;<a class="code" href="structmap__root.html#o13">hashes</a>[hv];
-00373 dbug (<span class="stringliteral">"hash for %ld,%s is %d\n"</span>, key1, key2, hv);
-00374
-00375 hlist_for_each(e, head) {
-00376 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *n =
-00377 (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)((long)e - <span class="keyword">sizeof</span>(<span class="keyword">struct </span>hlist_node));
-00378 dbug (<span class="stringliteral">"e =%lx key=%ld,%s\n"</span>, (<span class="keywordtype">long</span>)e, n-&gt;<a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o0">val</a>,n-&gt;<a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>);
-00379 <span class="keywordflow">if</span> (key1 == n-&gt;<a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o0">val</a> &amp;&amp; strcmp(key2, n-&gt;<a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>) == 0) {
-00380 map-&gt;<a class="code" href="structmap__root.html#o6">key</a> = n;
-00381 dbug (<span class="stringliteral">"saving key %lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
-00382 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 0;
-00383 <span class="keywordflow">return</span>;
-00384 }
-00385 }
-00386
-00387 map-&gt;<a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o0">val</a> = key1;
-00388 map-&gt;<a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o1">str</a> = key2;
-00389 map-&gt;<a class="code" href="structmap__root.html#o8">c_key1type</a> = LONG;
-00390 map-&gt;<a class="code" href="structmap__root.html#o9">c_key2type</a> = STR;
-00391 map-&gt;<a class="code" href="structmap__root.html#o10">c_keyhead</a> = head;
-00392 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 1;
-00393 }
-00394 <span class="comment"></span>
-00395 <span class="comment">/** Set the map's key to a string.</span>
-00396 <span class="comment"> * This sets the current element based on a string key. If the key is</span>
-00397 <span class="comment"> * not found, a new element will not be created until a &lt;i&gt;_stp_map_set_xxx&lt;/i&gt;</span>
-00398 <span class="comment"> * call.</span>
-00399 <span class="comment"> * @param map</span>
-00400 <span class="comment"> * @param key</span>
-00401 <span class="comment"> */</span>
-00402
-<a name="l00403"></a><a class="code" href="map_8c.html#a13">00403</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a13">_stp_map_key_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *key)
-00404 {
-00405 <span class="keywordflow">if</span> (map == NULL)
-00406 <span class="keywordflow">return</span>;
-00407 <a class="code" href="map_8c.html#a10">_stp_map_key_str_str</a>(map, key, NULL);
-00408 map-&gt;<a class="code" href="structmap__root.html#o9">c_key2type</a> = NONE;
-00409 }
-00410 <span class="comment"></span>
-00411 <span class="comment">/** Set the map's key to a long.</span>
-00412 <span class="comment"> * This sets the current element based on a long key. If the key is</span>
-00413 <span class="comment"> * not found, a new element will not be created until a &lt;i&gt;_stp_map_set_xxx&lt;/i&gt;</span>
-00414 <span class="comment"> * call.</span>
-00415 <span class="comment"> * @param map</span>
-00416 <span class="comment"> * @param key </span>
-00417 <span class="comment"> */</span>
-00418
-<a name="l00419"></a><a class="code" href="map_8c.html#a14">00419</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a14">_stp_map_key_long</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">long</span> key)
-00420 {
-00421 <span class="keywordflow">if</span> (map == NULL)
-00422 <span class="keywordflow">return</span>;
-00423 <a class="code" href="map_8c.html#a9">_stp_map_key_long_long</a>(map, key, 0);
-00424 map-&gt;<a class="code" href="structmap__root.html#o9">c_key2type</a> = NONE;
-00425 }
-00426
-00427 <span class="comment">/********************** SET/GET VALUES *********************/</span>
-00428
-00429 <span class="keyword">static</span> <span class="keywordtype">void</span> map_copy_keys(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *m)
-00430 {
-00431 m-&gt;key1type = map-&gt;<a class="code" href="structmap__root.html#o8">c_key1type</a>;
-00432 m-&gt;key2type = map-&gt;<a class="code" href="structmap__root.html#o9">c_key2type</a>;
-00433 <span class="keywordflow">switch</span> (map-&gt;<a class="code" href="structmap__root.html#o8">c_key1type</a>) {
-00434 <span class="keywordflow">case</span> STR:
-00435 m-&gt;key1.str = <a class="code" href="alloc_8h.html#a3">_stp_alloc</a>(strlen(map-&gt;<a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>) + 1);
-00436 strcpy(m-&gt;key1.str, map-&gt;<a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>);
-00437 <span class="keywordflow">break</span>;
-00438 <span class="keywordflow">case</span> LONG:
-00439 m-&gt;key1.val = map-&gt;<a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o0">val</a>;
-00440 <span class="keywordflow">break</span>;
-00441 <span class="keywordflow">case</span> NONE:
-00442 <span class="comment">/* ERROR */</span>
-00443 <span class="keywordflow">break</span>;
-00444 }
-00445 <span class="keywordflow">switch</span> (map-&gt;<a class="code" href="structmap__root.html#o9">c_key2type</a>) {
-00446 <span class="keywordflow">case</span> STR:
-00447 m-&gt;key2.<a class="code" href="unionkey__data.html#o1">str</a> = <a class="code" href="alloc_8h.html#a3">_stp_alloc</a>(strlen(map-&gt;<a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>) + 1);
-00448 strcpy(m-&gt;key2.str, map-&gt;<a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>);
-00449 <span class="keywordflow">break</span>;
-00450 <span class="keywordflow">case</span> LONG:
-00451 m-&gt;key2.<a class="code" href="unionkey__data.html#o0">val</a> = map-&gt;<a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o0">val</a>;
-00452 <span class="keywordflow">break</span>;
-00453 <span class="keywordflow">case</span> NONE:
+00331 <span class="keywordflow">if</span> (map == NULL)
+00332 <span class="keywordflow">return</span>;
+00333
+00334 <span class="keywordflow">if</span> (key1 == NULL) {
+00335 map-&gt;<a class="code" href="structmap__root.html#o6">key</a> = NULL;
+00336 <span class="keywordflow">return</span>;
+00337 }
+00338
+00339 hv = mixed_hash(key1, key2);
+00340 head = &amp;map-&gt;<a class="code" href="structmap__root.html#o13">hashes</a>[hv];
+00341
+00342 dbug (<span class="stringliteral">"hash for %s,%ld is %d\n"</span>, key1, key2, hv);
+00343
+00344 hlist_for_each(e, head) {
+00345 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *n =
+00346 (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)((long)e - <span class="keyword">sizeof</span>(<span class="keyword">struct </span>hlist_node));
+00347 dbug (<span class="stringliteral">"e =%lx key=%s,%ld\n"</span>, (<span class="keywordtype">long</span>)e, n-&gt;<a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>,(<span class="keywordtype">long</span>)n-&gt;<a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o0">val</a>);
+00348 <span class="keywordflow">if</span> (strcmp(key1, n-&gt;<a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>) == 0 &amp;&amp; key2 == n-&gt;<a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o0">val</a>) {
+00349 map-&gt;<a class="code" href="structmap__root.html#o6">key</a> = n;
+00350 dbug (<span class="stringliteral">"saving key %lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
+00351 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 0;
+00352 <span class="keywordflow">return</span>;
+00353 }
+00354 }
+00355
+00356 map-&gt;<a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o1">str</a> = key1;
+00357 map-&gt;<a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o0">val</a> = key2;
+00358 map-&gt;<a class="code" href="structmap__root.html#o8">c_key1type</a> = STR;
+00359 map-&gt;<a class="code" href="structmap__root.html#o9">c_key2type</a> = LONG;
+00360 map-&gt;<a class="code" href="structmap__root.html#o10">c_keyhead</a> = head;
+00361 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 1;
+00362 }
+00363 <span class="comment"></span>
+00364 <span class="comment">/** Set the map's key to a long and a string.</span>
+00365 <span class="comment"> * This sets the current element based on a key of a long and a string. If the keys are</span>
+00366 <span class="comment"> * not found, a new element will not be created until a &lt;i&gt;_stp_map_set_xxx&lt;/i&gt;</span>
+00367 <span class="comment"> * call.</span>
+00368 <span class="comment"> * @param map</span>
+00369 <span class="comment"> * @param key1 first key</span>
+00370 <span class="comment"> * @param key2 second key</span>
+00371 <span class="comment"> */</span>
+00372
+<a name="l00373"></a><a class="code" href="group__maps.html#ga11">00373</a> <span class="keywordtype">void</span> <a class="code" href="group__maps.html#ga11">_stp_map_key_long_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">long</span> key1, <span class="keywordtype">char</span> *key2)
+00374 {
+00375 <span class="keywordtype">unsigned</span> hv;
+00376 <span class="keyword">struct </span>hlist_head *head;
+00377 <span class="keyword">struct </span>hlist_node *e;
+00378
+00379 <span class="keywordflow">if</span> (map == NULL)
+00380 <span class="keywordflow">return</span>;
+00381
+00382 hv = mixed_hash(key2, key1);
+00383 head = &amp;map-&gt;<a class="code" href="structmap__root.html#o13">hashes</a>[hv];
+00384 dbug (<span class="stringliteral">"hash for %ld,%s is %d\n"</span>, key1, key2, hv);
+00385
+00386 hlist_for_each(e, head) {
+00387 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *n =
+00388 (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)((long)e - <span class="keyword">sizeof</span>(<span class="keyword">struct </span>hlist_node));
+00389 dbug (<span class="stringliteral">"e =%lx key=%ld,%s\n"</span>, (<span class="keywordtype">long</span>)e, n-&gt;<a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o0">val</a>,n-&gt;<a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>);
+00390 <span class="keywordflow">if</span> (key1 == n-&gt;<a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o0">val</a> &amp;&amp; strcmp(key2, n-&gt;<a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>) == 0) {
+00391 map-&gt;<a class="code" href="structmap__root.html#o6">key</a> = n;
+00392 dbug (<span class="stringliteral">"saving key %lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
+00393 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 0;
+00394 <span class="keywordflow">return</span>;
+00395 }
+00396 }
+00397
+00398 map-&gt;<a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o0">val</a> = key1;
+00399 map-&gt;<a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o1">str</a> = key2;
+00400 map-&gt;<a class="code" href="structmap__root.html#o8">c_key1type</a> = LONG;
+00401 map-&gt;<a class="code" href="structmap__root.html#o9">c_key2type</a> = STR;
+00402 map-&gt;<a class="code" href="structmap__root.html#o10">c_keyhead</a> = head;
+00403 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 1;
+00404 }
+00405 <span class="comment"></span>
+00406 <span class="comment">/** Set the map's key to a string.</span>
+00407 <span class="comment"> * This sets the current element based on a string key. If the key is</span>
+00408 <span class="comment"> * not found, a new element will not be created until a &lt;i&gt;_stp_map_set_xxx&lt;/i&gt;</span>
+00409 <span class="comment"> * call.</span>
+00410 <span class="comment"> * @param map</span>
+00411 <span class="comment"> * @param key</span>
+00412 <span class="comment"> */</span>
+00413
+<a name="l00414"></a><a class="code" href="group__maps.html#ga12">00414</a> <span class="keywordtype">void</span> <a class="code" href="group__maps.html#ga12">_stp_map_key_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *key)
+00415 {
+00416 <span class="keywordflow">if</span> (map == NULL)
+00417 <span class="keywordflow">return</span>;
+00418 <a class="code" href="group__maps.html#ga9">_stp_map_key_str_str</a>(map, key, NULL);
+00419 map-&gt;<a class="code" href="structmap__root.html#o9">c_key2type</a> = NONE;
+00420 }
+00421 <span class="comment"></span>
+00422 <span class="comment">/** Set the map's key to a long.</span>
+00423 <span class="comment"> * This sets the current element based on a long key. If the key is</span>
+00424 <span class="comment"> * not found, a new element will not be created until a &lt;i&gt;_stp_map_set_xxx&lt;/i&gt;</span>
+00425 <span class="comment"> * call.</span>
+00426 <span class="comment"> * @param map</span>
+00427 <span class="comment"> * @param key </span>
+00428 <span class="comment"> */</span>
+00429
+<a name="l00430"></a><a class="code" href="group__maps.html#ga13">00430</a> <span class="keywordtype">void</span> <a class="code" href="group__maps.html#ga13">_stp_map_key_long</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">long</span> key)
+00431 {
+00432 <span class="keywordflow">if</span> (map == NULL)
+00433 <span class="keywordflow">return</span>;
+00434 <a class="code" href="group__maps.html#ga8">_stp_map_key_long_long</a>(map, key, 0);
+00435 map-&gt;<a class="code" href="structmap__root.html#o9">c_key2type</a> = NONE;
+00436 }
+00437
+00438 <span class="comment">/********************** SET/GET VALUES *********************/</span>
+00439
+00440 <span class="keyword">static</span> <span class="keywordtype">void</span> map_copy_keys(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *m)
+00441 {
+00442 m-&gt;key1type = map-&gt;<a class="code" href="structmap__root.html#o8">c_key1type</a>;
+00443 m-&gt;key2type = map-&gt;<a class="code" href="structmap__root.html#o9">c_key2type</a>;
+00444 <span class="keywordflow">switch</span> (map-&gt;<a class="code" href="structmap__root.html#o8">c_key1type</a>) {
+00445 <span class="keywordflow">case</span> STR:
+00446 m-&gt;key1.str = <a class="code" href="group__alloc.html#ga1">_stp_alloc</a>(strlen(map-&gt;<a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>) + 1);
+00447 strcpy(m-&gt;key1.str, map-&gt;<a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>);
+00448 <span class="keywordflow">break</span>;
+00449 <span class="keywordflow">case</span> LONG:
+00450 m-&gt;key1.val = map-&gt;<a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o0">val</a>;
+00451 <span class="keywordflow">break</span>;
+00452 <span class="keywordflow">case</span> NONE:
+00453 <span class="comment">/* ERROR */</span>
00454 <span class="keywordflow">break</span>;
00455 }
-00456
-00457 <span class="comment">/* add node to new hash list */</span>
-00458 hlist_add_head(&amp;m-&gt;hnode, map-&gt;<a class="code" href="structmap__root.html#o10">c_keyhead</a>);
-00459
-00460 map-&gt;<a class="code" href="structmap__root.html#o6">key</a> = m;
-00461 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 0;
-00462 map-&gt;<a class="code" href="structmap__root.html#o2">num</a>++;
-00463 }
-00464
-00465 <span class="keyword">static</span> <span class="keywordtype">void</span> __stp_map_set_int64(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val, <span class="keywordtype">int</span> add)
-00466 {
-00467 <span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *m;
-00468
-00469 <span class="keywordflow">if</span> (map == NULL)
-00470 return;
-00471
-00472 if (map-&gt;create) {
-00473 <span class="keywordflow">if</span> (val == 0)
-00474 return;
+00456 <span class="keywordflow">switch</span> (map-&gt;<a class="code" href="structmap__root.html#o9">c_key2type</a>) {
+00457 <span class="keywordflow">case</span> STR:
+00458 m-&gt;key2.<a class="code" href="unionkey__data.html#o1">str</a> = <a class="code" href="group__alloc.html#ga1">_stp_alloc</a>(strlen(map-&gt;<a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>) + 1);
+00459 strcpy(m-&gt;key2.str, map-&gt;<a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>);
+00460 <span class="keywordflow">break</span>;
+00461 <span class="keywordflow">case</span> LONG:
+00462 m-&gt;key2.<a class="code" href="unionkey__data.html#o0">val</a> = map-&gt;<a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o0">val</a>;
+00463 <span class="keywordflow">break</span>;
+00464 <span class="keywordflow">case</span> NONE:
+00465 <span class="keywordflow">break</span>;
+00466 }
+00467
+00468 <span class="comment">/* add node to new hash list */</span>
+00469 hlist_add_head(&amp;m-&gt;hnode, map-&gt;<a class="code" href="structmap__root.html#o10">c_keyhead</a>);
+00470
+00471 map-&gt;<a class="code" href="structmap__root.html#o6">key</a> = m;
+00472 map-&gt;<a class="code" href="structmap__root.html#o7">create</a> = 0;
+00473 map-&gt;<a class="code" href="structmap__root.html#o2">num</a>++;
+00474 }
00475
-00476 if (map-&gt;maxnum) {
-00477 <span class="keywordflow">if</span> (list_empty(&amp;map-&gt;<a class="code" href="structmap__root.html#o5">pool</a>)) {
-00478 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o3">no_wrap</a>) {
-00479 <span class="comment">/* ERROR. FIXME */</span>
-00480 <span class="keywordflow">return</span>;
-00481 }
-00482 m = (<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *)map-&gt;<a class="code" href="structmap__root.html#o4">head</a>.next;
-00483 hlist_del_init(&amp;m-&gt;<a class="code" href="structmap__node__int64.html#o0">n</a>.<a class="code" href="structmap__node.html#o1">hnode</a>);
-00484 map_free_strings(map, (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)m);
-00485 dbug (<span class="stringliteral">"got %lx off head\n"</span>, (<span class="keywordtype">long</span>)m);
-00486 } <span class="keywordflow">else</span> {
-00487 m = (<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *)map-&gt;<a class="code" href="structmap__root.html#o5">pool</a>.next;
-00488 dbug (<span class="stringliteral">"got %lx off pool\n"</span>, (<span class="keywordtype">long</span>)m);
-00489 }
-00490 list_move_tail(&amp;m-&gt;<a class="code" href="structmap__node__int64.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>);
-00491 } <span class="keywordflow">else</span> {
-00492 m = (<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *)
-00493 <a class="code" href="alloc_8h.html#a4">_stp_calloc</a>(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> <a class="code" href="structmap__node__int64.html">map_node_int64</a>));
-00494 <span class="comment">/* add node to list */</span>
-00495 list_add_tail(&amp;m-&gt;<a class="code" href="structmap__node__int64.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>);
-00496 }
-00497
-00498 <span class="comment">/* copy the key(s) */</span>
-00499 map_copy_keys(map, &amp;m-&gt;<a class="code" href="structmap__node__int64.html#o0">n</a>);
-00500
-00501 <span class="comment">/* set the value */</span>
-00502 m-&gt;<a class="code" href="structmap__node__int64.html#o1">val</a> = val;
-00503 } <span class="keywordflow">else</span> {
-00504 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o6">key</a> == NULL)
-00505 return;
-00506
-00507 if (val) {
-00508 m = (<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>;
-00509 <span class="keywordflow">if</span> (add)
-00510 m-&gt;val += val;
-00511 else
-00512 m-&gt;val = val;
-00513 } else if (!add) {
-00514 <span class="comment">/* setting value to 0 is the same as deleting */</span>
-00515 <a class="code" href="map_8c.html#a5">_stp_map_key_del</a>(map);
-00516 }
-00517 }
-00518 }
-00519 <span class="comment"></span>
-00520 <span class="comment">/** Set the current element's value to an int64.</span>
-00521 <span class="comment"> * This sets the current element's value to an int64. The map must have been created</span>
-00522 <span class="comment"> * to hold int64s using _stp_map_new()</span>
-00523 <span class="comment"> *</span>
-00524 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
-00525 <span class="comment"> * is set for the map, this function does nothing.</span>
-00526 <span class="comment"> * @param map</span>
-00527 <span class="comment"> * @param val new value</span>
-00528 <span class="comment"> * @sa _stp_map_add_int64</span>
-00529 <span class="comment"> */</span>
-<a name="l00530"></a><a class="code" href="map_8c.html#a17">00530</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a17">_stp_map_set_int64</a>(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val)
-00531 {
-00532 __stp_map_set_int64 (map, val, 0);
-00533 }
-00534
-00535 <span class="comment"></span>
-00536 <span class="comment">/** Adds an int64 to the current element's value.</span>
-00537 <span class="comment"> * This adds an int64 to the current element's value. The map must have been created</span>
-00538 <span class="comment"> * to hold int64s using _stp_map_new()</span>
-00539 <span class="comment"> *</span>
-00540 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
-00541 <span class="comment"> * is set for the map, this function does nothing.</span>
-00542 <span class="comment"> * @param map</span>
-00543 <span class="comment"> * @param val value</span>
-00544 <span class="comment"> * @sa _stp_map_set_int64</span>
-00545 <span class="comment"> */</span>
-00546
-<a name="l00547"></a><a class="code" href="map_8c.html#a18">00547</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a18">_stp_map_add_int64</a>(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val)
-00548 {
-00549 __stp_map_set_int64 (map, val, 1);
-00550 }
-00551 <span class="comment"></span>
-00552 <span class="comment">/** Gets the current element's value.</span>
+00476 <span class="keyword">static</span> <span class="keywordtype">void</span> __stp_map_set_int64(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val, <span class="keywordtype">int</span> add)
+00477 {
+00478 <span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *m;
+00479
+00480 <span class="keywordflow">if</span> (map == NULL)
+00481 return;
+00482
+00483 if (map-&gt;create) {
+00484 <span class="keywordflow">if</span> (val == 0)
+00485 return;
+00486
+00487 if (map-&gt;maxnum) {
+00488 <span class="keywordflow">if</span> (list_empty(&amp;map-&gt;<a class="code" href="structmap__root.html#o5">pool</a>)) {
+00489 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o3">no_wrap</a>) {
+00490 <span class="comment">/* ERROR. FIXME */</span>
+00491 <span class="keywordflow">return</span>;
+00492 }
+00493 m = (<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *)map-&gt;<a class="code" href="structmap__root.html#o4">head</a>.next;
+00494 hlist_del_init(&amp;m-&gt;<a class="code" href="structmap__node__int64.html#o0">n</a>.<a class="code" href="structmap__node.html#o1">hnode</a>);
+00495 map_free_strings(map, (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)m);
+00496 dbug (<span class="stringliteral">"got %lx off head\n"</span>, (<span class="keywordtype">long</span>)m);
+00497 } <span class="keywordflow">else</span> {
+00498 m = (<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *)map-&gt;<a class="code" href="structmap__root.html#o5">pool</a>.next;
+00499 dbug (<span class="stringliteral">"got %lx off pool\n"</span>, (<span class="keywordtype">long</span>)m);
+00500 }
+00501 list_move_tail(&amp;m-&gt;<a class="code" href="structmap__node__int64.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>);
+00502 } <span class="keywordflow">else</span> {
+00503 m = (<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *)
+00504 <a class="code" href="group__alloc.html#ga2">_stp_calloc</a>(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> <a class="code" href="structmap__node__int64.html">map_node_int64</a>));
+00505 <span class="comment">/* add node to list */</span>
+00506 list_add_tail(&amp;m-&gt;<a class="code" href="structmap__node__int64.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>);
+00507 }
+00508
+00509 <span class="comment">/* copy the key(s) */</span>
+00510 map_copy_keys(map, &amp;m-&gt;<a class="code" href="structmap__node__int64.html#o0">n</a>);
+00511
+00512 <span class="comment">/* set the value */</span>
+00513 m-&gt;<a class="code" href="structmap__node__int64.html#o1">val</a> = val;
+00514 } <span class="keywordflow">else</span> {
+00515 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o6">key</a> == NULL)
+00516 return;
+00517
+00518 if (val) {
+00519 m = (<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>;
+00520 <span class="keywordflow">if</span> (add)
+00521 m-&gt;val += val;
+00522 else
+00523 m-&gt;val = val;
+00524 } else if (!add) {
+00525 <span class="comment">/* setting value to 0 is the same as deleting */</span>
+00526 <a class="code" href="group__maps.html#ga4">_stp_map_key_del</a>(map);
+00527 }
+00528 }
+00529 }
+00530 <span class="comment"></span>
+00531 <span class="comment">/** Set the current element's value to an int64.</span>
+00532 <span class="comment"> * This sets the current element's value to an int64. The map must have been created</span>
+00533 <span class="comment"> * to hold int64s using _stp_map_new()</span>
+00534 <span class="comment"> *</span>
+00535 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
+00536 <span class="comment"> * is set for the map, this function does nothing.</span>
+00537 <span class="comment"> * @param map</span>
+00538 <span class="comment"> * @param val new value</span>
+00539 <span class="comment"> * @sa _stp_map_add_int64</span>
+00540 <span class="comment"> */</span>
+<a name="l00541"></a><a class="code" href="group__maps.html#ga16">00541</a> <span class="keywordtype">void</span> <a class="code" href="group__maps.html#ga16">_stp_map_set_int64</a>(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val)
+00542 {
+00543 __stp_map_set_int64 (map, val, 0);
+00544 }
+00545
+00546 <span class="comment"></span>
+00547 <span class="comment">/** Adds an int64 to the current element's value.</span>
+00548 <span class="comment"> * This adds an int64 to the current element's value. The map must have been created</span>
+00549 <span class="comment"> * to hold int64s using _stp_map_new()</span>
+00550 <span class="comment"> *</span>
+00551 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
+00552 <span class="comment"> * is set for the map, this function does nothing.</span>
00553 <span class="comment"> * @param map</span>
-00554 <span class="comment"> * @returns The value. If the current element is not set or doesn't exist, returns 0.</span>
-00555 <span class="comment"> */</span>
-00556
-<a name="l00557"></a><a class="code" href="map_8c.html#a19">00557</a> int64_t <a class="code" href="map_8c.html#a19">_stp_map_get_int64</a>(<a class="code" href="structmap__root.html">MAP</a> map)
-00558 {
-00559 <span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *m;
-00560 <span class="keywordflow">if</span> (map == NULL || map-&gt;<a class="code" href="structmap__root.html#o7">create</a> || map-&gt;<a class="code" href="structmap__root.html#o6">key</a> == NULL)
-00561 <span class="keywordflow">return</span> 0;
-00562 dbug (<span class="stringliteral">"%lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
-00563 m = (<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>;
-00564 <span class="keywordflow">return</span> m-&gt;<a class="code" href="structmap__node__int64.html#o1">val</a>;
-00565 }
-00566 <span class="comment"></span>
-00567 <span class="comment">/** Set the current element's value to a string.</span>
-00568 <span class="comment"> * This sets the current element's value to an string. The map must have been created</span>
-00569 <span class="comment"> * to hold int64s using &lt;i&gt;_stp_map_new(xxx, STRING)&lt;/i&gt;</span>
-00570 <span class="comment"> *</span>
-00571 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
-00572 <span class="comment"> * is set for the map, this function does nothing.</span>
-00573 <span class="comment"> * @param map</span>
-00574 <span class="comment"> * @param val new string</span>
-00575 <span class="comment"> */</span>
-00576
-<a name="l00577"></a><a class="code" href="map_8c.html#a20">00577</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a20">_stp_map_set_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *val)
-00578 {
-00579 <span class="keyword">struct </span>map_node_str *m;
-00580
-00581 <span class="keywordflow">if</span> (map == NULL)
-00582 <span class="keywordflow">return</span>;
-00583
-00584 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o7">create</a>) {
-00585 <span class="keywordflow">if</span> (val == NULL)
-00586 <span class="keywordflow">return</span>;
+00554 <span class="comment"> * @param val value</span>
+00555 <span class="comment"> * @sa _stp_map_set_int64</span>
+00556 <span class="comment"> */</span>
+00557
+<a name="l00558"></a><a class="code" href="group__maps.html#ga17">00558</a> <span class="keywordtype">void</span> <a class="code" href="group__maps.html#ga17">_stp_map_add_int64</a>(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val)
+00559 {
+00560 __stp_map_set_int64 (map, val, 1);
+00561 }
+00562 <span class="comment"></span>
+00563 <span class="comment">/** Gets the current element's value.</span>
+00564 <span class="comment"> * @param map</span>
+00565 <span class="comment"> * @returns The value. If the current element is not set or doesn't exist, returns 0.</span>
+00566 <span class="comment"> */</span>
+00567
+<a name="l00568"></a><a class="code" href="group__maps.html#ga18">00568</a> int64_t <a class="code" href="group__maps.html#ga18">_stp_map_get_int64</a>(<a class="code" href="structmap__root.html">MAP</a> map)
+00569 {
+00570 <span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *m;
+00571 <span class="keywordflow">if</span> (map == NULL || map-&gt;<a class="code" href="structmap__root.html#o7">create</a> || map-&gt;<a class="code" href="structmap__root.html#o6">key</a> == NULL)
+00572 <span class="keywordflow">return</span> 0;
+00573 dbug (<span class="stringliteral">"%lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
+00574 m = (<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>;
+00575 <span class="keywordflow">return</span> m-&gt;<a class="code" href="structmap__node__int64.html#o1">val</a>;
+00576 }
+00577 <span class="comment"></span>
+00578 <span class="comment">/** Set the current element's value to a string.</span>
+00579 <span class="comment"> * This sets the current element's value to an string. The map must have been created</span>
+00580 <span class="comment"> * to hold int64s using &lt;i&gt;_stp_map_new(xxx, STRING)&lt;/i&gt;</span>
+00581 <span class="comment"> *</span>
+00582 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
+00583 <span class="comment"> * is set for the map, this function does nothing.</span>
+00584 <span class="comment"> * @param map</span>
+00585 <span class="comment"> * @param val new string</span>
+00586 <span class="comment"> */</span>
00587
-00588 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o1">maxnum</a>) {
-00589 <span class="keywordflow">if</span> (list_empty(&amp;map-&gt;<a class="code" href="structmap__root.html#o5">pool</a>)) {
-00590 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o3">no_wrap</a>) {
-00591 <span class="comment">/* ERROR. FIXME */</span>
-00592 <span class="keywordflow">return</span>;
-00593 }
-00594 m = (<span class="keyword">struct </span>map_node_str *)map-&gt;<a class="code" href="structmap__root.html#o4">head</a>.next;
-00595 hlist_del_init(&amp;m-&gt;<a class="code" href="structmap__node__str.html#o0">n</a>.<a class="code" href="structmap__node.html#o1">hnode</a>);
-00596 map_free_strings(map, (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)m);
-00597 dbug (<span class="stringliteral">"got %lx off head\n"</span>, (<span class="keywordtype">long</span>)m);
-00598 } <span class="keywordflow">else</span> {
-00599 m = (<span class="keyword">struct </span>map_node_str *)map-&gt;<a class="code" href="structmap__root.html#o5">pool</a>.next;
-00600 dbug (<span class="stringliteral">"got %lx off pool\n"</span>, (<span class="keywordtype">long</span>)m);
-00601 }
-00602 list_move_tail(&amp;m-&gt;<a class="code" href="structmap__node__str.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>);
-00603 } <span class="keywordflow">else</span> {
-00604 m = (<span class="keyword">struct </span>map_node_str *)
-00605 <a class="code" href="alloc_8h.html#a4">_stp_calloc</a>(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> map_node_str));
-00606 <span class="comment">/* add node to list */</span>
-00607 list_add_tail(&amp;m-&gt;<a class="code" href="structmap__node__str.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>);
-00608 }
-00609
-00610 <span class="comment">/* copy the key(s) */</span>
-00611 map_copy_keys(map, &amp;m-&gt;<a class="code" href="structmap__node__str.html#o0">n</a>);
-00612
-00613 <span class="comment">/* set the value */</span>
-00614 m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a> = <a class="code" href="alloc_8h.html#a3">_stp_alloc</a>(strlen(val) + 1);
-00615 strcpy(m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a>, val);
-00616 } <span class="keywordflow">else</span> {
-00617 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o6">key</a> == NULL)
-00618 <span class="keywordflow">return</span>;
-00619
-00620 <span class="keywordflow">if</span> (val) {
-00621 m = (<span class="keyword">struct </span>map_node_str *)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>;
-00622 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a>)
-00623 <a class="code" href="alloc_8h.html#a6">_stp_free</a>(m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a>);
-00624 m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a> = <a class="code" href="alloc_8h.html#a3">_stp_alloc</a>(strlen(val) + 1);
-00625 strcpy(m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a>, val);
-00626 } <span class="keywordflow">else</span> {
-00627 <span class="comment">/* setting value to 0 is the same as deleting */</span>
-00628 <a class="code" href="map_8c.html#a5">_stp_map_key_del</a>(map);
-00629 }
-00630 }
-00631 }
-00632 <span class="comment"></span>
-00633 <span class="comment">/** Gets the current element's value.</span>
-00634 <span class="comment"> * @param map</span>
-00635 <span class="comment"> * @returns A string pointer. If the current element is not set or doesn't exist, returns NULL.</span>
-00636 <span class="comment"> */</span>
-00637
-<a name="l00638"></a><a class="code" href="map_8c.html#a21">00638</a> <span class="keywordtype">char</span> *<a class="code" href="map_8c.html#a21">_stp_map_get_str</a>(<a class="code" href="structmap__root.html">MAP</a> map)
-00639 {
-00640 <span class="keyword">struct </span>map_node_str *m;
-00641 <span class="keywordflow">if</span> (map == NULL || map-&gt;<a class="code" href="structmap__root.html#o7">create</a> || map-&gt;<a class="code" href="structmap__root.html#o6">key</a> == NULL)
-00642 <span class="keywordflow">return</span> NULL;
-00643 dbug (<span class="stringliteral">"%lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
-00644 m = (<span class="keyword">struct </span>map_node_str *)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>;
-00645 <span class="keywordflow">return</span> m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a>;
-00646 }
-00647 <span class="comment"></span>
-00648 <span class="comment">/** Set the current element's value to a stat.</span>
-00649 <span class="comment"> * This sets the current element's value to an stat struct. The map must have been created</span>
-00650 <span class="comment"> * to hold stats using &lt;i&gt;_stp_map_new(xxx, STAT)&lt;/i&gt;. This function would only be used</span>
-00651 <span class="comment"> * if we wanted to set stats to something other than the normal initial values (count = 0,</span>
-00652 <span class="comment"> * sum = 0, etc). It may be deleted if it doesn't turn out to be useful.</span>
-00653 <span class="comment"> * @sa _stp_map_stat_add </span>
-00654 <span class="comment"> *</span>
-00655 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
-00656 <span class="comment"> * is set for the map, this function does nothing.</span>
-00657 <span class="comment"> * @param map</span>
-00658 <span class="comment"> * @param stats pointer to stats struct.</span>
-00659 <span class="comment"> * @todo Histograms don't work yet.</span>
-00660 <span class="comment"> */</span>
-00661
-<a name="l00662"></a><a class="code" href="map_8c.html#a22">00662</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a22">_stp_map_set_stat</a>(<a class="code" href="structmap__root.html">MAP</a> map, <a class="code" href="structstat.html">stat</a> * stats)
-00663 {
-00664 <span class="keyword">struct </span>map_node_stat *m;
-00665
-00666 <span class="keywordflow">if</span> (map == NULL)
-00667 <span class="keywordflow">return</span>;
-00668 dbug (<span class="stringliteral">"set_stat %lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
-00669
-00670 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o7">create</a>) {
-00671 <span class="keywordflow">if</span> (stats == NULL)
-00672 <span class="keywordflow">return</span>;
-00673
-00674 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o1">maxnum</a>) {
-00675 <span class="keywordflow">if</span> (list_empty(&amp;map-&gt;<a class="code" href="structmap__root.html#o5">pool</a>)) {
-00676 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o3">no_wrap</a>) {
-00677 <span class="comment">/* ERROR. FIXME */</span>
-00678 <span class="keywordflow">return</span>;
-00679 }
-00680 m = (<span class="keyword">struct </span>map_node_stat *)map-&gt;<a class="code" href="structmap__root.html#o4">head</a>.next;
-00681 hlist_del_init(&amp;m-&gt;<a class="code" href="structmap__node__stat.html#o0">n</a>.<a class="code" href="structmap__node.html#o1">hnode</a>);
-00682 map_free_strings(map, (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)m);
-00683 dbug (<span class="stringliteral">"got %lx off head\n"</span>, (<span class="keywordtype">long</span>)m);
-00684 } <span class="keywordflow">else</span> {
-00685 m = (<span class="keyword">struct </span>map_node_stat *)map-&gt;<a class="code" href="structmap__root.html#o5">pool</a>.next;
-00686 dbug (<span class="stringliteral">"got %lx off pool\n"</span>, (<span class="keywordtype">long</span>)m);
-00687 }
-00688 list_move_tail(&amp;m-&gt;<a class="code" href="structmap__node__stat.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>);
-00689 } <span class="keywordflow">else</span> {
-00690 m = (<span class="keyword">struct </span>map_node_stat *)
-00691 <a class="code" href="alloc_8h.html#a4">_stp_calloc</a>(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> map_node_stat));
-00692 <span class="comment">/* add node to list */</span>
-00693 list_add_tail(&amp;m-&gt;<a class="code" href="structmap__node__stat.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>);
-00694 }
-00695
-00696 <span class="comment">/* copy the key(s) */</span>
-00697 map_copy_keys(map, &amp;m-&gt;<a class="code" href="structmap__node__stat.html#o0">n</a>);
-00698
-00699 <span class="comment">/* set the value */</span>
-00700 memcpy(&amp;m-&gt;<a class="code" href="structmap__node__stat.html#o1">stats</a>, stats, <span class="keyword">sizeof</span>(<a class="code" href="structstat.html">stat</a>));
-00701 } <span class="keywordflow">else</span> {
-00702 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o6">key</a> == NULL)
-00703 <span class="keywordflow">return</span>;
-00704
-00705 <span class="keywordflow">if</span> (stats) {
-00706 m = (<span class="keyword">struct </span>map_node_stat *)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>;
-00707 memcpy(&amp;m-&gt;<a class="code" href="structmap__node__stat.html#o1">stats</a>, stats, <span class="keyword">sizeof</span>(<a class="code" href="structstat.html">stat</a>));
-00708 } <span class="keywordflow">else</span> {
-00709 <span class="comment">/* setting value to NULL is the same as deleting */</span>
-00710 <a class="code" href="map_8c.html#a5">_stp_map_key_del</a>(map);
-00711 }
-00712 }
-00713 }
-00714 <span class="comment"></span>
-00715 <span class="comment">/** Gets the current element's value.</span>
-00716 <span class="comment"> * @param map</span>
-00717 <span class="comment"> * @returns A pointer to the stats struct. If the current element is not set </span>
-00718 <span class="comment"> * or doesn't exist, returns NULL.</span>
-00719 <span class="comment"> */</span>
-00720
-<a name="l00721"></a><a class="code" href="map_8c.html#a23">00721</a> <a class="code" href="structstat.html">stat</a> *<a class="code" href="map_8c.html#a23">_stp_map_get_stat</a>(<a class="code" href="structmap__root.html">MAP</a> map)
-00722 {
-00723 <span class="keyword">struct </span>map_node_stat *m;
-00724 <span class="keywordflow">if</span> (map == NULL || map-&gt;<a class="code" href="structmap__root.html#o7">create</a> || map-&gt;<a class="code" href="structmap__root.html#o6">key</a> == NULL)
-00725 <span class="keywordflow">return</span> NULL;
-00726 dbug (<span class="stringliteral">"%lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
-00727 m = (<span class="keyword">struct </span>map_node_stat *)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>;
-00728 <span class="keywordflow">return</span> &amp;m-&gt;<a class="code" href="structmap__node__stat.html#o1">stats</a>;
-00729 }
-00730 <span class="comment"></span>
-00731 <span class="comment">/** Add to the current element's statistics.</span>
-00732 <span class="comment"> * Increments the statistics counter by one and the sum by &lt;i&gt;val&lt;/i&gt;.</span>
-00733 <span class="comment"> * Adjusts minimum, maximum, and histogram.</span>
-00734 <span class="comment"> *</span>
-00735 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
-00736 <span class="comment"> * is set for the map, this function does nothing.</span>
-00737 <span class="comment"> * @param map</span>
-00738 <span class="comment"> * @param val value to add to the statistics</span>
-00739 <span class="comment"> * @todo Histograms don't work yet.</span>
-00740 <span class="comment"> */</span>
-00741
-<a name="l00742"></a><a class="code" href="map_8c.html#a24">00742</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a24">_stp_map_stat_add</a>(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val)
-00743 {
-00744 <span class="keyword">struct </span>map_node_stat *m;
-00745 <span class="keywordflow">if</span> (map == NULL)
-00746 <span class="keywordflow">return</span>;
-00747
-00748 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o7">create</a>) {
-00749 <a class="code" href="structstat.html">stat</a> st = { 1, val, val, val };
-00750 <span class="comment">/* histogram */</span>
-00751 <a class="code" href="map_8c.html#a22">_stp_map_set_stat</a>(map, &amp;st);
-00752 <span class="keywordflow">return</span>;
-00753 }
-00754
-00755 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o6">key</a> == NULL)
-00756 <span class="keywordflow">return</span>;
-00757
-00758 dbug (<span class="stringliteral">"add_stat %lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
-00759 m = (<span class="keyword">struct </span>map_node_stat *)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>;
-00760 m-&gt;<a class="code" href="structmap__node__stat.html#o1">stats</a>.<a class="code" href="structstat.html#o0">count</a>++;
-00761 m-&gt;<a class="code" href="structmap__node__stat.html#o1">stats</a>.<a class="code" href="structstat.html#o1">sum</a> += val;
-00762 <span class="keywordflow">if</span> (val &gt; m-&gt;<a class="code" href="structmap__node__stat.html#o1">stats</a>.<a class="code" href="structstat.html#o3">max</a>)
-00763 m-&gt;<a class="code" href="structmap__node__stat.html#o1">stats</a>.<a class="code" href="structstat.html#o3">max</a> = val;
-00764 <span class="keywordflow">if</span> (val &lt; m-&gt;stats.min)
-00765 m-&gt;<a class="code" href="structmap__node__stat.html#o1">stats</a>.<a class="code" href="structstat.html#o2">min</a> = val;
-00766 <span class="comment">/* histogram */</span>
-00767 }
+<a name="l00588"></a><a class="code" href="group__maps.html#ga19">00588</a> <span class="keywordtype">void</span> <a class="code" href="group__maps.html#ga19">_stp_map_set_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *val)
+00589 {
+00590 <span class="keyword">struct </span>map_node_str *m;
+00591
+00592 <span class="keywordflow">if</span> (map == NULL)
+00593 <span class="keywordflow">return</span>;
+00594
+00595 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o7">create</a>) {
+00596 <span class="keywordflow">if</span> (val == NULL)
+00597 <span class="keywordflow">return</span>;
+00598
+00599 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o1">maxnum</a>) {
+00600 <span class="keywordflow">if</span> (list_empty(&amp;map-&gt;<a class="code" href="structmap__root.html#o5">pool</a>)) {
+00601 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o3">no_wrap</a>) {
+00602 <span class="comment">/* ERROR. FIXME */</span>
+00603 <span class="keywordflow">return</span>;
+00604 }
+00605 m = (<span class="keyword">struct </span>map_node_str *)map-&gt;<a class="code" href="structmap__root.html#o4">head</a>.next;
+00606 hlist_del_init(&amp;m-&gt;<a class="code" href="structmap__node__str.html#o0">n</a>.<a class="code" href="structmap__node.html#o1">hnode</a>);
+00607 map_free_strings(map, (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)m);
+00608 dbug (<span class="stringliteral">"got %lx off head\n"</span>, (<span class="keywordtype">long</span>)m);
+00609 } <span class="keywordflow">else</span> {
+00610 m = (<span class="keyword">struct </span>map_node_str *)map-&gt;<a class="code" href="structmap__root.html#o5">pool</a>.next;
+00611 dbug (<span class="stringliteral">"got %lx off pool\n"</span>, (<span class="keywordtype">long</span>)m);
+00612 }
+00613 list_move_tail(&amp;m-&gt;<a class="code" href="structmap__node__str.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>);
+00614 } <span class="keywordflow">else</span> {
+00615 m = (<span class="keyword">struct </span>map_node_str *)
+00616 <a class="code" href="group__alloc.html#ga2">_stp_calloc</a>(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> map_node_str));
+00617 <span class="comment">/* add node to list */</span>
+00618 list_add_tail(&amp;m-&gt;<a class="code" href="structmap__node__str.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>);
+00619 }
+00620
+00621 <span class="comment">/* copy the key(s) */</span>
+00622 map_copy_keys(map, &amp;m-&gt;<a class="code" href="structmap__node__str.html#o0">n</a>);
+00623
+00624 <span class="comment">/* set the value */</span>
+00625 m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a> = <a class="code" href="group__alloc.html#ga1">_stp_alloc</a>(strlen(val) + 1);
+00626 strcpy(m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a>, val);
+00627 } <span class="keywordflow">else</span> {
+00628 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o6">key</a> == NULL)
+00629 <span class="keywordflow">return</span>;
+00630
+00631 <span class="keywordflow">if</span> (val) {
+00632 m = (<span class="keyword">struct </span>map_node_str *)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>;
+00633 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a>)
+00634 <a class="code" href="group__alloc.html#ga4">_stp_free</a>(m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a>);
+00635 m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a> = <a class="code" href="group__alloc.html#ga1">_stp_alloc</a>(strlen(val) + 1);
+00636 strcpy(m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a>, val);
+00637 } <span class="keywordflow">else</span> {
+00638 <span class="comment">/* setting value to 0 is the same as deleting */</span>
+00639 <a class="code" href="group__maps.html#ga4">_stp_map_key_del</a>(map);
+00640 }
+00641 }
+00642 }
+00643 <span class="comment"></span>
+00644 <span class="comment">/** Gets the current element's value.</span>
+00645 <span class="comment"> * @param map</span>
+00646 <span class="comment"> * @returns A string pointer. If the current element is not set or doesn't exist, returns NULL.</span>
+00647 <span class="comment"> */</span>
+00648
+<a name="l00649"></a><a class="code" href="group__maps.html#ga20">00649</a> <span class="keywordtype">char</span> *<a class="code" href="group__maps.html#ga20">_stp_map_get_str</a>(<a class="code" href="structmap__root.html">MAP</a> map)
+00650 {
+00651 <span class="keyword">struct </span>map_node_str *m;
+00652 <span class="keywordflow">if</span> (map == NULL || map-&gt;<a class="code" href="structmap__root.html#o7">create</a> || map-&gt;<a class="code" href="structmap__root.html#o6">key</a> == NULL)
+00653 <span class="keywordflow">return</span> NULL;
+00654 dbug (<span class="stringliteral">"%lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
+00655 m = (<span class="keyword">struct </span>map_node_str *)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>;
+00656 <span class="keywordflow">return</span> m-&gt;<a class="code" href="structmap__node__str.html#o1">str</a>;
+00657 }
+00658 <span class="comment"></span>
+00659 <span class="comment">/** Set the current element's value to a stat.</span>
+00660 <span class="comment"> * This sets the current element's value to an stat struct. The map must have been created</span>
+00661 <span class="comment"> * to hold stats using &lt;i&gt;_stp_map_new(xxx, STAT)&lt;/i&gt;. This function would only be used</span>
+00662 <span class="comment"> * if we wanted to set stats to something other than the normal initial values (count = 0,</span>
+00663 <span class="comment"> * sum = 0, etc). It may be deleted if it doesn't turn out to be useful.</span>
+00664 <span class="comment"> * @sa _stp_map_stat_add </span>
+00665 <span class="comment"> *</span>
+00666 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
+00667 <span class="comment"> * is set for the map, this function does nothing.</span>
+00668 <span class="comment"> * @param map</span>
+00669 <span class="comment"> * @param stats pointer to stats struct.</span>
+00670 <span class="comment"> * @todo Histograms don't work yet.</span>
+00671 <span class="comment"> */</span>
+00672
+<a name="l00673"></a><a class="code" href="group__maps.html#ga21">00673</a> <span class="keywordtype">void</span> <a class="code" href="group__maps.html#ga21">_stp_map_set_stat</a>(<a class="code" href="structmap__root.html">MAP</a> map, <a class="code" href="structstat.html">stat</a> * stats)
+00674 {
+00675 <span class="keyword">struct </span>map_node_stat *m;
+00676
+00677 <span class="keywordflow">if</span> (map == NULL)
+00678 <span class="keywordflow">return</span>;
+00679 dbug (<span class="stringliteral">"set_stat %lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
+00680
+00681 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o7">create</a>) {
+00682 <span class="keywordflow">if</span> (stats == NULL)
+00683 <span class="keywordflow">return</span>;
+00684
+00685 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o1">maxnum</a>) {
+00686 <span class="keywordflow">if</span> (list_empty(&amp;map-&gt;<a class="code" href="structmap__root.html#o5">pool</a>)) {
+00687 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o3">no_wrap</a>) {
+00688 <span class="comment">/* ERROR. FIXME */</span>
+00689 <span class="keywordflow">return</span>;
+00690 }
+00691 m = (<span class="keyword">struct </span>map_node_stat *)map-&gt;<a class="code" href="structmap__root.html#o4">head</a>.next;
+00692 hlist_del_init(&amp;m-&gt;<a class="code" href="structmap__node__stat.html#o0">n</a>.<a class="code" href="structmap__node.html#o1">hnode</a>);
+00693 map_free_strings(map, (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)m);
+00694 dbug (<span class="stringliteral">"got %lx off head\n"</span>, (<span class="keywordtype">long</span>)m);
+00695 } <span class="keywordflow">else</span> {
+00696 m = (<span class="keyword">struct </span>map_node_stat *)map-&gt;<a class="code" href="structmap__root.html#o5">pool</a>.next;
+00697 dbug (<span class="stringliteral">"got %lx off pool\n"</span>, (<span class="keywordtype">long</span>)m);
+00698 }
+00699 list_move_tail(&amp;m-&gt;<a class="code" href="structmap__node__stat.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>);
+00700 } <span class="keywordflow">else</span> {
+00701 m = (<span class="keyword">struct </span>map_node_stat *)
+00702 <a class="code" href="group__alloc.html#ga2">_stp_calloc</a>(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> map_node_stat));
+00703 <span class="comment">/* add node to list */</span>
+00704 list_add_tail(&amp;m-&gt;<a class="code" href="structmap__node__stat.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>);
+00705 }
+00706
+00707 <span class="comment">/* copy the key(s) */</span>
+00708 map_copy_keys(map, &amp;m-&gt;<a class="code" href="structmap__node__stat.html#o0">n</a>);
+00709
+00710 <span class="comment">/* set the value */</span>
+00711 memcpy(&amp;m-&gt;<a class="code" href="structmap__node__stat.html#o1">stats</a>, stats, <span class="keyword">sizeof</span>(<a class="code" href="structstat.html">stat</a>));
+00712 } <span class="keywordflow">else</span> {
+00713 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o6">key</a> == NULL)
+00714 <span class="keywordflow">return</span>;
+00715
+00716 <span class="keywordflow">if</span> (stats) {
+00717 m = (<span class="keyword">struct </span>map_node_stat *)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>;
+00718 memcpy(&amp;m-&gt;<a class="code" href="structmap__node__stat.html#o1">stats</a>, stats, <span class="keyword">sizeof</span>(<a class="code" href="structstat.html">stat</a>));
+00719 } <span class="keywordflow">else</span> {
+00720 <span class="comment">/* setting value to NULL is the same as deleting */</span>
+00721 <a class="code" href="group__maps.html#ga4">_stp_map_key_del</a>(map);
+00722 }
+00723 }
+00724 }
+00725 <span class="comment"></span>
+00726 <span class="comment">/** Gets the current element's value.</span>
+00727 <span class="comment"> * @param map</span>
+00728 <span class="comment"> * @returns A pointer to the stats struct. If the current element is not set </span>
+00729 <span class="comment"> * or doesn't exist, returns NULL.</span>
+00730 <span class="comment"> */</span>
+00731
+<a name="l00732"></a><a class="code" href="group__maps.html#ga22">00732</a> <a class="code" href="structstat.html">stat</a> *<a class="code" href="group__maps.html#ga22">_stp_map_get_stat</a>(<a class="code" href="structmap__root.html">MAP</a> map)
+00733 {
+00734 <span class="keyword">struct </span>map_node_stat *m;
+00735 <span class="keywordflow">if</span> (map == NULL || map-&gt;<a class="code" href="structmap__root.html#o7">create</a> || map-&gt;<a class="code" href="structmap__root.html#o6">key</a> == NULL)
+00736 <span class="keywordflow">return</span> NULL;
+00737 dbug (<span class="stringliteral">"%lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
+00738 m = (<span class="keyword">struct </span>map_node_stat *)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>;
+00739 <span class="keywordflow">return</span> &amp;m-&gt;<a class="code" href="structmap__node__stat.html#o1">stats</a>;
+00740 }
+00741 <span class="comment"></span>
+00742 <span class="comment">/** Add to the current element's statistics.</span>
+00743 <span class="comment"> * Increments the statistics counter by one and the sum by &lt;i&gt;val&lt;/i&gt;.</span>
+00744 <span class="comment"> * Adjusts minimum, maximum, and histogram.</span>
+00745 <span class="comment"> *</span>
+00746 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
+00747 <span class="comment"> * is set for the map, this function does nothing.</span>
+00748 <span class="comment"> * @param map</span>
+00749 <span class="comment"> * @param val value to add to the statistics</span>
+00750 <span class="comment"> * @todo Histograms don't work yet.</span>
+00751 <span class="comment"> */</span>
+00752
+<a name="l00753"></a><a class="code" href="group__maps.html#ga23">00753</a> <span class="keywordtype">void</span> <a class="code" href="group__maps.html#ga23">_stp_map_stat_add</a>(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val)
+00754 {
+00755 <span class="keyword">struct </span>map_node_stat *m;
+00756 <span class="keywordflow">if</span> (map == NULL)
+00757 <span class="keywordflow">return</span>;
+00758
+00759 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o7">create</a>) {
+00760 <a class="code" href="structstat.html">stat</a> st = { 1, val, val, val };
+00761 <span class="comment">/* histogram */</span>
+00762 <a class="code" href="group__maps.html#ga21">_stp_map_set_stat</a>(map, &amp;st);
+00763 <span class="keywordflow">return</span>;
+00764 }
+00765
+00766 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o6">key</a> == NULL)
+00767 <span class="keywordflow">return</span>;
00768
-00769 <span class="comment">/********************** List Functions *********************/</span>
-00770 <span class="comment"></span>
-00771 <span class="comment">/** Create a new list.</span>
-00772 <span class="comment"> * A list is a map that internally has an incrementing long key for each member.</span>
-00773 <span class="comment"> * Lists do not wrap if elements are added to exceed their maximum size.</span>
-00774 <span class="comment"> * @param max_entries The maximum number of entries allowed. Currently that number will</span>
-00775 <span class="comment"> * be preallocated. If max_entries is 0, there will be no maximum and entries</span>
-00776 <span class="comment"> * will be allocated dynamically.</span>
-00777 <span class="comment"> * @param type Type of values stored in this list. </span>
-00778 <span class="comment"> * @return A MAP on success or NULL on failure.</span>
-00779 <span class="comment"> * @sa foreach</span>
-00780 <span class="comment"> */</span>
+00769 dbug (<span class="stringliteral">"add_stat %lx\n"</span>, (<span class="keywordtype">long</span>)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>);
+00770 m = (<span class="keyword">struct </span>map_node_stat *)map-&gt;<a class="code" href="structmap__root.html#o6">key</a>;
+00771 m-&gt;<a class="code" href="structmap__node__stat.html#o1">stats</a>.<a class="code" href="structstat.html#o0">count</a>++;
+00772 m-&gt;<a class="code" href="structmap__node__stat.html#o1">stats</a>.<a class="code" href="structstat.html#o1">sum</a> += val;
+00773 <span class="keywordflow">if</span> (val &gt; m-&gt;<a class="code" href="structmap__node__stat.html#o1">stats</a>.<a class="code" href="structstat.html#o3">max</a>)
+00774 m-&gt;<a class="code" href="structmap__node__stat.html#o1">stats</a>.<a class="code" href="structstat.html#o3">max</a> = val;
+00775 <span class="keywordflow">if</span> (val &lt; m-&gt;stats.min)
+00776 m-&gt;<a class="code" href="structmap__node__stat.html#o1">stats</a>.<a class="code" href="structstat.html#o2">min</a> = val;
+00777 <span class="comment">/* histogram */</span>
+00778 }
+00779 <span class="comment"></span>
+00780 <span class="comment">/** @} */</span>
00781
-<a name="l00782"></a><a class="code" href="map_8c.html#a25">00782</a> <a class="code" href="structmap__root.html">MAP</a> <a class="code" href="map_8c.html#a25">_stp_list_new</a>(<span class="keywordtype">unsigned</span> max_entries, <span class="keyword">enum</span> valtype type)
-00783 {
-00784 <a class="code" href="structmap__root.html">MAP</a> map = <a class="code" href="map_8c.html#a3">_stp_map_new</a> (max_entries, type);
-00785 map-&gt;<a class="code" href="structmap__root.html#o3">no_wrap</a> = 1;
-00786 <span class="keywordflow">return</span> map;
-00787 }
-00788 <span class="comment"></span>
-00789 <span class="comment">/** Clears a list.</span>
-00790 <span class="comment"> * All elements in the list are deleted.</span>
-00791 <span class="comment"> * @param map </span>
-00792 <span class="comment"> */</span>
-00793
-<a name="l00794"></a><a class="code" href="map_8c.html#a26">00794</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a26">_stp_list_clear</a>(<a class="code" href="structmap__root.html">MAP</a> map)
-00795 {
-00796 <span class="keywordflow">if</span> (map == NULL)
-00797 <span class="keywordflow">return</span>;
-00798
-00799 <span class="keywordflow">if</span> (!list_empty(&amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>)) {
-00800 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *ptr = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)map-&gt;<a class="code" href="structmap__root.html#o4">head</a>.next;
-00801
-00802 <span class="keywordflow">while</span> (ptr &amp;&amp; ptr != (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)&amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>) {
-00803 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *next = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)ptr-&gt;<a class="code" href="structmap__node.html#o0">lnode</a>.next;
-00804
-00805 <span class="comment">/* remove node from old hash list */</span>
-00806 hlist_del_init(&amp;ptr-&gt;<a class="code" href="structmap__node.html#o1">hnode</a>);
-00807
-00808 <span class="comment">/* remove from entry list */</span>
-00809 list_del(&amp;ptr-&gt;<a class="code" href="structmap__node.html#o0">lnode</a>);
-00810
-00811 <span class="comment">/* remove any allocated string storage */</span>
-00812 map_free_strings(map, ptr);
-00813
-00814 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o1">maxnum</a>)
-00815 list_add(&amp;ptr-&gt;<a class="code" href="structmap__node.html#o0">lnode</a>, &amp;map-&gt;<a class="code" href="structmap__root.html#o5">pool</a>);
-00816 <span class="keywordflow">else</span>
-00817 <a class="code" href="alloc_8h.html#a6">_stp_free</a>(ptr);
-00818
-00819 map-&gt;<a class="code" href="structmap__root.html#o2">num</a>--;
-00820 ptr = next;
-00821 }
-00822 }
+00782 <span class="comment">/********************** List Functions *********************/</span>
+00783 <span class="comment"></span>
+00784 <span class="comment">/** @addtogroup lists</span>
+00785 <span class="comment"> * Lists are special cases of maps.</span>
+00786 <span class="comment"> * @b Example:</span>
+00787 <span class="comment"> * @include list.c</span>
+00788 <span class="comment"> * @{ */</span>
+00789 <span class="comment"></span>
+00790 <span class="comment">/** Create a new list.</span>
+00791 <span class="comment"> * A list is a map that internally has an incrementing long key for each member.</span>
+00792 <span class="comment"> * Lists do not wrap if elements are added to exceed their maximum size.</span>
+00793 <span class="comment"> * @param max_entries The maximum number of entries allowed. Currently that number will</span>
+00794 <span class="comment"> * be preallocated. If max_entries is 0, there will be no maximum and entries</span>
+00795 <span class="comment"> * will be allocated dynamically.</span>
+00796 <span class="comment"> * @param type Type of values stored in this list. </span>
+00797 <span class="comment"> * @return A MAP on success or NULL on failure.</span>
+00798 <span class="comment"> * @sa foreach</span>
+00799 <span class="comment"> */</span>
+00800
+<a name="l00801"></a><a class="code" href="group__lists.html#ga0">00801</a> <a class="code" href="structmap__root.html">MAP</a> <a class="code" href="group__lists.html#ga0">_stp_list_new</a>(<span class="keywordtype">unsigned</span> max_entries, <span class="keyword">enum</span> valtype type)
+00802 {
+00803 <a class="code" href="structmap__root.html">MAP</a> map = <a class="code" href="group__maps.html#ga2">_stp_map_new</a> (max_entries, type);
+00804 map-&gt;<a class="code" href="structmap__root.html#o3">no_wrap</a> = 1;
+00805 <span class="keywordflow">return</span> map;
+00806 }
+00807 <span class="comment"></span>
+00808 <span class="comment">/** Clears a list.</span>
+00809 <span class="comment"> * All elements in the list are deleted.</span>
+00810 <span class="comment"> * @param map </span>
+00811 <span class="comment"> */</span>
+00812
+<a name="l00813"></a><a class="code" href="group__lists.html#ga1">00813</a> <span class="keywordtype">void</span> <a class="code" href="group__lists.html#ga1">_stp_list_clear</a>(<a class="code" href="structmap__root.html">MAP</a> map)
+00814 {
+00815 <span class="keywordflow">if</span> (map == NULL)
+00816 <span class="keywordflow">return</span>;
+00817
+00818 <span class="keywordflow">if</span> (!list_empty(&amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>)) {
+00819 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *ptr = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)map-&gt;<a class="code" href="structmap__root.html#o4">head</a>.next;
+00820
+00821 <span class="keywordflow">while</span> (ptr &amp;&amp; ptr != (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)&amp;map-&gt;<a class="code" href="structmap__root.html#o4">head</a>) {
+00822 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *next = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)ptr-&gt;<a class="code" href="structmap__node.html#o0">lnode</a>.next;
00823
-00824 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o2">num</a> != 0) {
-00825 <a class="code" href="io_8c.html#a4">dlog</a> (<span class="stringliteral">"ERROR: list is supposed to be empty (has %d)\n"</span>, map-&gt;<a class="code" href="structmap__root.html#o2">num</a>);
-00826 }
-00827 }
-00828 <span class="comment"></span>
-00829 <span class="comment">/** Adds a string to a list.</span>
-00830 <span class="comment"> * @param map</span>
-00831 <span class="comment"> * @param str</span>
-00832 <span class="comment"> */</span>
-00833
-<a name="l00834"></a><a class="code" href="map_8c.html#a27">00834</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a27">_stp_list_add_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *str)
-00835 {
-00836 <a class="code" href="map_8c.html#a14">_stp_map_key_long</a>(map, map-&gt;<a class="code" href="structmap__root.html#o2">num</a>);
-00837 <a class="code" href="map_8c.html#a20">_stp_map_set_str</a>(map, str);
-00838 }
-00839 <span class="comment"></span>
-00840 <span class="comment">/** Adds an int64 to a list.</span>
-00841 <span class="comment"> * @param map</span>
-00842 <span class="comment"> * @param val</span>
-00843 <span class="comment"> */</span>
-00844
-<a name="l00845"></a><a class="code" href="map_8c.html#a28">00845</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a28">_stp_list_add_int64</a>(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val)
-00846 {
-00847 <a class="code" href="map_8c.html#a14">_stp_map_key_long</a>(map, map-&gt;<a class="code" href="structmap__root.html#o2">num</a>);
-00848 <a class="code" href="map_8c.html#a17">_stp_map_set_int64</a>(map, val);
-00849 }
-00850 <span class="comment"></span>
-00851 <span class="comment">/** Get the number of elements in a list.</span>
-00852 <span class="comment"> * @param map</span>
-00853 <span class="comment"> * @returns The number of elements in a list.</span>
-00854 <span class="comment"> */</span>
-00855
-<a name="l00856"></a><a class="code" href="map_8c.html#a29">00856</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="map_8c.html#a29">_stp_list_size</a>(<a class="code" href="structmap__root.html">MAP</a> map)
-00857 {
-00858 <span class="keywordflow">return</span> map-&gt;<a class="code" href="structmap__root.html#o2">num</a>;
-00859 }
-</pre></div><hr size="1"><address style="align: right;"><small>
-Generated on Tue Mar 22 10:27:36 2005 for SystemTap.</small></body>
-</html>
+00824 <span class="comment">/* remove node from old hash list */</span>
+00825 hlist_del_init(&amp;ptr-&gt;<a class="code" href="structmap__node.html#o1">hnode</a>);
+00826
+00827 <span class="comment">/* remove from entry list */</span>
+00828 list_del(&amp;ptr-&gt;<a class="code" href="structmap__node.html#o0">lnode</a>);
+00829
+00830 <span class="comment">/* remove any allocated string storage */</span>
+00831 map_free_strings(map, ptr);
+00832
+00833 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o1">maxnum</a>)
+00834 list_add(&amp;ptr-&gt;<a class="code" href="structmap__node.html#o0">lnode</a>, &amp;map-&gt;<a class="code" href="structmap__root.html#o5">pool</a>);
+00835 <span class="keywordflow">else</span>
+00836 <a class="code" href="group__alloc.html#ga4">_stp_free</a>(ptr);
+00837
+00838 map-&gt;<a class="code" href="structmap__root.html#o2">num</a>--;
+00839 ptr = next;
+00840 }
+00841 }
+00842
+00843 <span class="keywordflow">if</span> (map-&gt;<a class="code" href="structmap__root.html#o2">num</a> != 0) {
+00844 <a class="code" href="group__io.html#ga0">dlog</a> (<span class="stringliteral">"ERROR: list is supposed to be empty (has %d)\n"</span>, map-&gt;<a class="code" href="structmap__root.html#o2">num</a>);
+00845 }
+00846 }
+00847 <span class="comment"></span>
+00848 <span class="comment">/** Adds a string to a list.</span>
+00849 <span class="comment"> * @param map</span>
+00850 <span class="comment"> * @param str</span>
+00851 <span class="comment"> */</span>
+00852
+<a name="l00853"></a><a class="code" href="group__lists.html#ga2">00853</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__lists.html#ga2">_stp_list_add_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *str)
+00854 {
+00855 <a class="code" href="group__maps.html#ga13">_stp_map_key_long</a>(map, map-&gt;<a class="code" href="structmap__root.html#o2">num</a>);
+00856 <a class="code" href="group__maps.html#ga19">_stp_map_set_str</a>(map, str);
+00857 }
+00858 <span class="comment"></span>
+00859 <span class="comment">/** Adds an int64 to a list.</span>
+00860 <span class="comment"> * @param map</span>
+00861 <span class="comment"> * @param val</span>
+00862 <span class="comment"> */</span>
+00863
+<a name="l00864"></a><a class="code" href="group__lists.html#ga3">00864</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__lists.html#ga3">_stp_list_add_int64</a>(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val)
+00865 {
+00866 <a class="code" href="group__maps.html#ga13">_stp_map_key_long</a>(map, map-&gt;<a class="code" href="structmap__root.html#o2">num</a>);
+00867 <a class="code" href="group__maps.html#ga16">_stp_map_set_int64</a>(map, val);
+00868 }
+00869 <span class="comment"></span>
+00870 <span class="comment">/** Get the number of elements in a list.</span>
+00871 <span class="comment"> * @param map</span>
+00872 <span class="comment"> * @returns The number of elements in a list.</span>
+00873 <span class="comment"> */</span>
+00874
+<a name="l00875"></a><a class="code" href="group__lists.html#ga4">00875</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__lists.html#ga4">_stp_list_size</a>(<a class="code" href="structmap__root.html">MAP</a> map)
+00876 {
+00877 <span class="keywordflow">return</span> map-&gt;<a class="code" href="structmap__root.html#o2">num</a>;
+00878 }<span class="comment"></span>
+00879 <span class="comment">/** @} */</span>
+00880 <span class="preprocessor">#endif </span><span class="comment">/* _MAP_C_ */</span>
+</pre></div></body></html>