KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21573/root/usr/share/devhelp/books/dbus/api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21573/root/usr/share/devhelp/books/dbus/api/dbus-dataslot_8c-source.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>D-Bus: dbus-dataslot.c Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
    <li id="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul></div>
<h1>dbus-dataslot.c</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */</span>
<a name="l00002"></a>00002 <span class="comment">/* dbus-dataslot.c  storing data on objects</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2003 Red Hat, Inc.</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * Licensed under the Academic Free License version 2.1</span>
<a name="l00007"></a>00007 <span class="comment"> * </span>
<a name="l00008"></a>00008 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
<a name="l00009"></a>00009 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
<a name="l00010"></a>00010 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00011"></a>00011 <span class="comment"> * (at your option) any later version.</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
<a name="l00014"></a>00014 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00015"></a>00015 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00016"></a>00016 <span class="comment"> * GNU General Public License for more details.</span>
<a name="l00017"></a>00017 <span class="comment"> * </span>
<a name="l00018"></a>00018 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
<a name="l00019"></a>00019 <span class="comment"> * along with this program; if not, write to the Free Software</span>
<a name="l00020"></a>00020 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</span>
<a name="l00021"></a>00021 <span class="comment"> *</span>
<a name="l00022"></a>00022 <span class="comment"> */</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include "dbus-dataslot.h"</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include "dbus-threads-internal.h"</span>
<a name="l00025"></a>00025 
<a name="l00043"></a>00043 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l00044"></a><a class="code" href="group__DBusDataSlot.html#g5edceab2f5849ff8a6f6cee5d1afc906">00044</a> <a class="code" href="group__DBusDataSlot.html#g5edceab2f5849ff8a6f6cee5d1afc906">_dbus_data_slot_allocator_init</a> (<a class="code" href="structDBusDataSlotAllocator.html">DBusDataSlotAllocator</a> *allocator)
<a name="l00045"></a>00045 {
<a name="l00046"></a>00046   allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00047"></a>00047   allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#57702eaf2d6558cc15f12205aca90dda">n_allocated_slots</a> = 0;
<a name="l00048"></a>00048   allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#d68b0989a821eb266983052f8a402a4a">n_used_slots</a> = 0;
<a name="l00049"></a>00049   allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#b85a00ac97c3d0148de0168f1c1439dc">lock_loc</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00050"></a>00050   
<a name="l00051"></a>00051   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;
<a name="l00052"></a>00052 }
<a name="l00053"></a>00053 
<a name="l00066"></a>00066 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l00067"></a><a class="code" href="group__DBusDataSlot.html#g941a12182e69c185bd27f6efbfbd0f86">00067</a> <a class="code" href="group__DBusDataSlot.html#g941a12182e69c185bd27f6efbfbd0f86">_dbus_data_slot_allocator_alloc</a> (<a class="code" href="structDBusDataSlotAllocator.html">DBusDataSlotAllocator</a> *allocator,
<a name="l00068"></a>00068                                  <a class="code" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a>             **mutex_loc,
<a name="l00069"></a>00069                                  <a class="code" href="group__DBusTypes.html#gb18afa60e9b17b6e322735bda3d863d8">dbus_int32_t</a>          *slot_id_p)
<a name="l00070"></a>00070 {
<a name="l00071"></a>00071   <a class="code" href="group__DBusTypes.html#gb18afa60e9b17b6e322735bda3d863d8">dbus_int32_t</a> slot;
<a name="l00072"></a>00072 
<a name="l00073"></a>00073   <a class="code" href="group__DBusThreadsInternals.html#ge6eafe138e9c317bfb25971d1d8bef2d">_dbus_mutex_lock</a> (*mutex_loc);
<a name="l00074"></a>00074 
<a name="l00075"></a>00075   <span class="keywordflow">if</span> (allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#57702eaf2d6558cc15f12205aca90dda">n_allocated_slots</a> == 0)
<a name="l00076"></a>00076     {
<a name="l00077"></a>00077       <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#b85a00ac97c3d0148de0168f1c1439dc">lock_loc</a> == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00078"></a>00078       allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#b85a00ac97c3d0148de0168f1c1439dc">lock_loc</a> = mutex_loc;
<a name="l00079"></a>00079     }
<a name="l00080"></a>00080   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#b85a00ac97c3d0148de0168f1c1439dc">lock_loc</a> != mutex_loc)
<a name="l00081"></a>00081     {
<a name="l00082"></a>00082       <a class="code" href="group__DBusInternalsUtils.html#g63f2f8a068454b781f214ba596e313b4">_dbus_warn_check_failed</a> (<span class="stringliteral">"D-Bus threads were initialized after first using the D-Bus library. If your application does not directly initialize threads or use D-Bus, keep in mind that some library or plugin may have used D-Bus or initialized threads behind your back. You can often fix this problem by calling dbus_init_threads() or dbus_g_threads_init() early in your main() method, before D-Bus is used.\n"</span>);
<a name="l00083"></a>00083       <a class="code" href="group__DBusInternalsUtils.html#g0c4961ec784874f1b1f3aeccea8d3da1">_dbus_assert_not_reached</a> (<span class="stringliteral">"exiting"</span>);
<a name="l00084"></a>00084     }
<a name="l00085"></a>00085 
<a name="l00086"></a>00086   <span class="keywordflow">if</span> (*slot_id_p &gt;= 0)
<a name="l00087"></a>00087     {
<a name="l00088"></a>00088       slot = *slot_id_p;
<a name="l00089"></a>00089       
<a name="l00090"></a>00090       <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (slot &lt; allocator-&gt;n_allocated_slots);
<a name="l00091"></a>00091       <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>[slot].<a class="code" href="structDBusAllocatedSlot.html#849e5f8d951d159c45172ce825fb3a1e">slot_id</a> == slot);
<a name="l00092"></a>00092       
<a name="l00093"></a>00093       allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>[slot].<a class="code" href="structDBusAllocatedSlot.html#554eaffc3334a90a86f618eaa713410c">refcount</a> += 1;
<a name="l00094"></a>00094 
<a name="l00095"></a>00095       <span class="keywordflow">goto</span> out;
<a name="l00096"></a>00096     }
<a name="l00097"></a>00097 
<a name="l00098"></a>00098   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (*slot_id_p &lt; 0);
<a name="l00099"></a>00099   
<a name="l00100"></a>00100   <span class="keywordflow">if</span> (allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#d68b0989a821eb266983052f8a402a4a">n_used_slots</a> &lt; allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#57702eaf2d6558cc15f12205aca90dda">n_allocated_slots</a>)
<a name="l00101"></a>00101     {
<a name="l00102"></a>00102       slot = 0;
<a name="l00103"></a>00103       <span class="keywordflow">while</span> (slot &lt; allocator-&gt;n_allocated_slots)
<a name="l00104"></a>00104         {
<a name="l00105"></a>00105           <span class="keywordflow">if</span> (allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>[slot].<a class="code" href="structDBusAllocatedSlot.html#849e5f8d951d159c45172ce825fb3a1e">slot_id</a> &lt; 0)
<a name="l00106"></a>00106             {
<a name="l00107"></a>00107               allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>[slot].<a class="code" href="structDBusAllocatedSlot.html#849e5f8d951d159c45172ce825fb3a1e">slot_id</a> = slot;
<a name="l00108"></a>00108               allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>[slot].<a class="code" href="structDBusAllocatedSlot.html#554eaffc3334a90a86f618eaa713410c">refcount</a> = 1;
<a name="l00109"></a>00109               allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#d68b0989a821eb266983052f8a402a4a">n_used_slots</a> += 1;
<a name="l00110"></a>00110               <span class="keywordflow">break</span>;
<a name="l00111"></a>00111             }
<a name="l00112"></a>00112           ++slot;
<a name="l00113"></a>00113         }
<a name="l00114"></a>00114 
<a name="l00115"></a>00115       <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (slot &lt; allocator-&gt;n_allocated_slots);
<a name="l00116"></a>00116     }
<a name="l00117"></a>00117   <span class="keywordflow">else</span>
<a name="l00118"></a>00118     {
<a name="l00119"></a>00119       <a class="code" href="structDBusAllocatedSlot.html">DBusAllocatedSlot</a> *tmp;
<a name="l00120"></a>00120       
<a name="l00121"></a>00121       slot = -1;
<a name="l00122"></a>00122       tmp = <a class="code" href="group__DBusMemory.html#g621d9ba15ea8ae44501b0fbf756cbeac">dbus_realloc</a> (allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>,
<a name="l00123"></a>00123                           sizeof (<a class="code" href="structDBusAllocatedSlot.html">DBusAllocatedSlot</a>) * (allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#57702eaf2d6558cc15f12205aca90dda">n_allocated_slots</a> + 1));
<a name="l00124"></a>00124       <span class="keywordflow">if</span> (tmp == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00125"></a>00125         <span class="keywordflow">goto</span> out;
<a name="l00126"></a>00126 
<a name="l00127"></a>00127       allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a> = tmp;
<a name="l00128"></a>00128       slot = allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#57702eaf2d6558cc15f12205aca90dda">n_allocated_slots</a>;
<a name="l00129"></a>00129       allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#57702eaf2d6558cc15f12205aca90dda">n_allocated_slots</a> += 1;
<a name="l00130"></a>00130       allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#d68b0989a821eb266983052f8a402a4a">n_used_slots</a> += 1;
<a name="l00131"></a>00131       allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>[slot].<a class="code" href="structDBusAllocatedSlot.html#849e5f8d951d159c45172ce825fb3a1e">slot_id</a> = slot;
<a name="l00132"></a>00132       allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>[slot].<a class="code" href="structDBusAllocatedSlot.html#554eaffc3334a90a86f618eaa713410c">refcount</a> = 1;
<a name="l00133"></a>00133     }
<a name="l00134"></a>00134 
<a name="l00135"></a>00135   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (slot &gt;= 0);
<a name="l00136"></a>00136   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (slot &lt; allocator-&gt;n_allocated_slots);
<a name="l00137"></a>00137   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (*slot_id_p &lt; 0);
<a name="l00138"></a>00138   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>[slot].<a class="code" href="structDBusAllocatedSlot.html#849e5f8d951d159c45172ce825fb3a1e">slot_id</a> == slot);
<a name="l00139"></a>00139   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>[slot].<a class="code" href="structDBusAllocatedSlot.html#554eaffc3334a90a86f618eaa713410c">refcount</a> == 1);
<a name="l00140"></a>00140   
<a name="l00141"></a>00141   *slot_id_p = slot;
<a name="l00142"></a>00142   
<a name="l00143"></a>00143   _dbus_verbose (<span class="stringliteral">"Allocated slot %d on allocator %p total %d slots allocated %d used\n"</span>,
<a name="l00144"></a>00144                  slot, allocator, allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#57702eaf2d6558cc15f12205aca90dda">n_allocated_slots</a>, allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#d68b0989a821eb266983052f8a402a4a">n_used_slots</a>);
<a name="l00145"></a>00145   
<a name="l00146"></a>00146  out:
<a name="l00147"></a>00147   <a class="code" href="group__DBusThreadsInternals.html#g94dcc555488e5d677f10bd3898d61c00">_dbus_mutex_unlock</a> (*(allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#b85a00ac97c3d0148de0168f1c1439dc">lock_loc</a>));
<a name="l00148"></a>00148   <span class="keywordflow">return</span> slot &gt;= 0;
<a name="l00149"></a>00149 }
<a name="l00150"></a>00150 
<a name="l00162"></a>00162 <span class="keywordtype">void</span>
<a name="l00163"></a><a class="code" href="group__DBusDataSlot.html#g059c50a24cd9fc984e918e6159841633">00163</a> <a class="code" href="group__DBusDataSlot.html#g059c50a24cd9fc984e918e6159841633">_dbus_data_slot_allocator_free</a> (<a class="code" href="structDBusDataSlotAllocator.html">DBusDataSlotAllocator</a> *allocator,
<a name="l00164"></a>00164                                 <a class="code" href="group__DBusTypes.html#gb18afa60e9b17b6e322735bda3d863d8">dbus_int32_t</a>          *slot_id_p)
<a name="l00165"></a>00165 {
<a name="l00166"></a>00166   <a class="code" href="group__DBusThreadsInternals.html#ge6eafe138e9c317bfb25971d1d8bef2d">_dbus_mutex_lock</a> (*(allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#b85a00ac97c3d0148de0168f1c1439dc">lock_loc</a>));
<a name="l00167"></a>00167   
<a name="l00168"></a>00168   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (*slot_id_p &lt; allocator-&gt;n_allocated_slots);
<a name="l00169"></a>00169   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>[*slot_id_p].<a class="code" href="structDBusAllocatedSlot.html#849e5f8d951d159c45172ce825fb3a1e">slot_id</a> == *slot_id_p);
<a name="l00170"></a>00170   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>[*slot_id_p].<a class="code" href="structDBusAllocatedSlot.html#554eaffc3334a90a86f618eaa713410c">refcount</a> &gt; 0);
<a name="l00171"></a>00171 
<a name="l00172"></a>00172   allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>[*slot_id_p].<a class="code" href="structDBusAllocatedSlot.html#554eaffc3334a90a86f618eaa713410c">refcount</a> -= 1;
<a name="l00173"></a>00173 
<a name="l00174"></a>00174   <span class="keywordflow">if</span> (allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>[*slot_id_p].<a class="code" href="structDBusAllocatedSlot.html#554eaffc3334a90a86f618eaa713410c">refcount</a> &gt; 0)
<a name="l00175"></a>00175     {
<a name="l00176"></a>00176       <a class="code" href="group__DBusThreadsInternals.html#g94dcc555488e5d677f10bd3898d61c00">_dbus_mutex_unlock</a> (*(allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#b85a00ac97c3d0148de0168f1c1439dc">lock_loc</a>));
<a name="l00177"></a>00177       <span class="keywordflow">return</span>;
<a name="l00178"></a>00178     }
<a name="l00179"></a>00179 
<a name="l00180"></a>00180   <span class="comment">/* refcount is 0, free the slot */</span>
<a name="l00181"></a>00181   _dbus_verbose (<span class="stringliteral">"Freeing slot %d on allocator %p total %d allocated %d used\n"</span>,
<a name="l00182"></a>00182                  *slot_id_p, allocator, allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#57702eaf2d6558cc15f12205aca90dda">n_allocated_slots</a>, allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#d68b0989a821eb266983052f8a402a4a">n_used_slots</a>);
<a name="l00183"></a>00183   
<a name="l00184"></a>00184   allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>[*slot_id_p].<a class="code" href="structDBusAllocatedSlot.html#849e5f8d951d159c45172ce825fb3a1e">slot_id</a> = -1;
<a name="l00185"></a>00185   *slot_id_p = -1;
<a name="l00186"></a>00186   
<a name="l00187"></a>00187   allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#d68b0989a821eb266983052f8a402a4a">n_used_slots</a> -= 1;
<a name="l00188"></a>00188   
<a name="l00189"></a>00189   <span class="keywordflow">if</span> (allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#d68b0989a821eb266983052f8a402a4a">n_used_slots</a> == 0)
<a name="l00190"></a>00190     {
<a name="l00191"></a>00191       <a class="code" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> **mutex_loc = allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#b85a00ac97c3d0148de0168f1c1439dc">lock_loc</a>;
<a name="l00192"></a>00192       
<a name="l00193"></a>00193       <a class="code" href="group__DBusMemory.html#g488c6b08cc8c1ddf0203243c4b27a13c">dbus_free</a> (allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>);
<a name="l00194"></a>00194       allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00195"></a>00195       allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#57702eaf2d6558cc15f12205aca90dda">n_allocated_slots</a> = 0;
<a name="l00196"></a>00196       allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#b85a00ac97c3d0148de0168f1c1439dc">lock_loc</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00197"></a>00197 
<a name="l00198"></a>00198       <a class="code" href="group__DBusThreadsInternals.html#g94dcc555488e5d677f10bd3898d61c00">_dbus_mutex_unlock</a> (*mutex_loc);
<a name="l00199"></a>00199     }
<a name="l00200"></a>00200   <span class="keywordflow">else</span>
<a name="l00201"></a>00201     {
<a name="l00202"></a>00202       <a class="code" href="group__DBusThreadsInternals.html#g94dcc555488e5d677f10bd3898d61c00">_dbus_mutex_unlock</a> (*(allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#b85a00ac97c3d0148de0168f1c1439dc">lock_loc</a>));
<a name="l00203"></a>00203     }
<a name="l00204"></a>00204 }
<a name="l00205"></a>00205 
<a name="l00210"></a>00210 <span class="keywordtype">void</span>
<a name="l00211"></a><a class="code" href="group__DBusDataSlot.html#g6de49b3a1210202215d40a5a19806992">00211</a> <a class="code" href="group__DBusDataSlot.html#g6de49b3a1210202215d40a5a19806992">_dbus_data_slot_list_init</a> (<a class="code" href="structDBusDataSlotList.html">DBusDataSlotList</a> *list)
<a name="l00212"></a>00212 {
<a name="l00213"></a>00213   list-&gt;<a class="code" href="structDBusDataSlotList.html#4dd0fc6cc10b9c48dd53f34335abd08e">slots</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00214"></a>00214   list-&gt;<a class="code" href="structDBusDataSlotList.html#2d6cb7670a940bc886c99cb892b44502">n_slots</a> = 0;
<a name="l00215"></a>00215 }
<a name="l00216"></a>00216 
<a name="l00234"></a>00234 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l00235"></a><a class="code" href="group__DBusDataSlot.html#gd2952f9f686d96e7114fc49ab7452e1a">00235</a> <a class="code" href="group__DBusDataSlot.html#gd2952f9f686d96e7114fc49ab7452e1a">_dbus_data_slot_list_set</a>  (<a class="code" href="structDBusDataSlotAllocator.html">DBusDataSlotAllocator</a> *allocator,
<a name="l00236"></a>00236                            <a class="code" href="structDBusDataSlotList.html">DBusDataSlotList</a>      *list,
<a name="l00237"></a>00237                            <span class="keywordtype">int</span>                    slot,
<a name="l00238"></a>00238                            <span class="keywordtype">void</span>                  *data,
<a name="l00239"></a>00239                            <a class="code" href="group__DBusMemory.html#g8792ec2b2b8626ca28022faf51ec415a">DBusFreeFunction</a>       free_data_func,
<a name="l00240"></a>00240                            <a class="code" href="group__DBusMemory.html#g8792ec2b2b8626ca28022faf51ec415a">DBusFreeFunction</a>      *old_free_func,
<a name="l00241"></a>00241                            <span class="keywordtype">void</span>                 **old_data)
<a name="l00242"></a>00242 {
<a name="l00243"></a>00243 <span class="preprocessor">#ifndef DBUS_DISABLE_ASSERT</span>
<a name="l00244"></a>00244 <span class="preprocessor"></span>  <span class="comment">/* We need to take the allocator lock here, because the allocator could</span>
<a name="l00245"></a>00245 <span class="comment">   * be e.g. realloc()ing allocated_slots. We avoid doing this if asserts</span>
<a name="l00246"></a>00246 <span class="comment">   * are disabled, since then the asserts are empty.</span>
<a name="l00247"></a>00247 <span class="comment">   */</span>
<a name="l00248"></a>00248   <a class="code" href="group__DBusThreadsInternals.html#ge6eafe138e9c317bfb25971d1d8bef2d">_dbus_mutex_lock</a> (*(allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#b85a00ac97c3d0148de0168f1c1439dc">lock_loc</a>));
<a name="l00249"></a>00249   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (slot &lt; allocator-&gt;n_allocated_slots);
<a name="l00250"></a>00250   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>[slot].<a class="code" href="structDBusAllocatedSlot.html#849e5f8d951d159c45172ce825fb3a1e">slot_id</a> == slot);
<a name="l00251"></a>00251   <a class="code" href="group__DBusThreadsInternals.html#g94dcc555488e5d677f10bd3898d61c00">_dbus_mutex_unlock</a> (*(allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#b85a00ac97c3d0148de0168f1c1439dc">lock_loc</a>));
<a name="l00252"></a>00252 <span class="preprocessor">#endif</span>
<a name="l00253"></a>00253 <span class="preprocessor"></span>  
<a name="l00254"></a>00254   <span class="keywordflow">if</span> (slot &gt;= list-&gt;<a class="code" href="structDBusDataSlotList.html#2d6cb7670a940bc886c99cb892b44502">n_slots</a>)
<a name="l00255"></a>00255     {
<a name="l00256"></a>00256       <a class="code" href="structDBusDataSlot.html">DBusDataSlot</a> *tmp;
<a name="l00257"></a>00257       <span class="keywordtype">int</span> i;
<a name="l00258"></a>00258       
<a name="l00259"></a>00259       tmp = <a class="code" href="group__DBusMemory.html#g621d9ba15ea8ae44501b0fbf756cbeac">dbus_realloc</a> (list-&gt;<a class="code" href="structDBusDataSlotList.html#4dd0fc6cc10b9c48dd53f34335abd08e">slots</a>,
<a name="l00260"></a>00260                           sizeof (<a class="code" href="structDBusDataSlot.html">DBusDataSlot</a>) * (slot + 1));
<a name="l00261"></a>00261       <span class="keywordflow">if</span> (tmp == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00262"></a>00262         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>;
<a name="l00263"></a>00263       
<a name="l00264"></a>00264       list-&gt;<a class="code" href="structDBusDataSlotList.html#4dd0fc6cc10b9c48dd53f34335abd08e">slots</a> = tmp;
<a name="l00265"></a>00265       i = list-&gt;<a class="code" href="structDBusDataSlotList.html#2d6cb7670a940bc886c99cb892b44502">n_slots</a>;
<a name="l00266"></a>00266       list-&gt;<a class="code" href="structDBusDataSlotList.html#2d6cb7670a940bc886c99cb892b44502">n_slots</a> = slot + 1;
<a name="l00267"></a>00267       <span class="keywordflow">while</span> (i &lt; list-&gt;n_slots)
<a name="l00268"></a>00268         {
<a name="l00269"></a>00269           list-&gt;<a class="code" href="structDBusDataSlotList.html#4dd0fc6cc10b9c48dd53f34335abd08e">slots</a>[i].<a class="code" href="structDBusDataSlot.html#883c8c8946f13b6f5f3cf99f230159fd">data</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00270"></a>00270           list-&gt;<a class="code" href="structDBusDataSlotList.html#4dd0fc6cc10b9c48dd53f34335abd08e">slots</a>[i].<a class="code" href="structDBusDataSlot.html#b899f58869942556fb1b381ca3f3e2b2">free_data_func</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00271"></a>00271           ++i;
<a name="l00272"></a>00272         }
<a name="l00273"></a>00273     }
<a name="l00274"></a>00274 
<a name="l00275"></a>00275   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (slot &lt; list-&gt;n_slots);
<a name="l00276"></a>00276 
<a name="l00277"></a>00277   *old_data = list-&gt;<a class="code" href="structDBusDataSlotList.html#4dd0fc6cc10b9c48dd53f34335abd08e">slots</a>[slot].<a class="code" href="structDBusDataSlot.html#883c8c8946f13b6f5f3cf99f230159fd">data</a>;
<a name="l00278"></a>00278   *old_free_func = list-&gt;<a class="code" href="structDBusDataSlotList.html#4dd0fc6cc10b9c48dd53f34335abd08e">slots</a>[slot].<a class="code" href="structDBusDataSlot.html#b899f58869942556fb1b381ca3f3e2b2">free_data_func</a>;
<a name="l00279"></a>00279 
<a name="l00280"></a>00280   list-&gt;<a class="code" href="structDBusDataSlotList.html#4dd0fc6cc10b9c48dd53f34335abd08e">slots</a>[slot].<a class="code" href="structDBusDataSlot.html#883c8c8946f13b6f5f3cf99f230159fd">data</a> = data;
<a name="l00281"></a>00281   list-&gt;<a class="code" href="structDBusDataSlotList.html#4dd0fc6cc10b9c48dd53f34335abd08e">slots</a>[slot].<a class="code" href="structDBusDataSlot.html#b899f58869942556fb1b381ca3f3e2b2">free_data_func</a> = free_data_func;
<a name="l00282"></a>00282 
<a name="l00283"></a>00283   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;
<a name="l00284"></a>00284 }
<a name="l00285"></a>00285 
<a name="l00295"></a>00295 <span class="keywordtype">void</span>*
<a name="l00296"></a><a class="code" href="group__DBusDataSlot.html#g43f741229f0c38788442601e2750ec66">00296</a> <a class="code" href="group__DBusDataSlot.html#g43f741229f0c38788442601e2750ec66">_dbus_data_slot_list_get</a>  (<a class="code" href="structDBusDataSlotAllocator.html">DBusDataSlotAllocator</a> *allocator,
<a name="l00297"></a>00297                            <a class="code" href="structDBusDataSlotList.html">DBusDataSlotList</a>      *list,
<a name="l00298"></a>00298                            <span class="keywordtype">int</span>                    slot)
<a name="l00299"></a>00299 {
<a name="l00300"></a>00300 <span class="preprocessor">#ifndef DBUS_DISABLE_ASSERT</span>
<a name="l00301"></a>00301 <span class="preprocessor"></span>  <span class="comment">/* We need to take the allocator lock here, because the allocator could</span>
<a name="l00302"></a>00302 <span class="comment">   * be e.g. realloc()ing allocated_slots. We avoid doing this if asserts</span>
<a name="l00303"></a>00303 <span class="comment">   * are disabled, since then the asserts are empty.</span>
<a name="l00304"></a>00304 <span class="comment">   */</span>
<a name="l00305"></a>00305   <a class="code" href="group__DBusThreadsInternals.html#ge6eafe138e9c317bfb25971d1d8bef2d">_dbus_mutex_lock</a> (*(allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#b85a00ac97c3d0148de0168f1c1439dc">lock_loc</a>));
<a name="l00306"></a>00306   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (slot &gt;= 0);
<a name="l00307"></a>00307   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (slot &lt; allocator-&gt;n_allocated_slots);
<a name="l00308"></a>00308   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#290fc1a48efc181da4e54dae572306b5">allocated_slots</a>[slot].<a class="code" href="structDBusAllocatedSlot.html#849e5f8d951d159c45172ce825fb3a1e">slot_id</a> == slot);
<a name="l00309"></a>00309   <a class="code" href="group__DBusThreadsInternals.html#g94dcc555488e5d677f10bd3898d61c00">_dbus_mutex_unlock</a> (*(allocator-&gt;<a class="code" href="structDBusDataSlotAllocator.html#b85a00ac97c3d0148de0168f1c1439dc">lock_loc</a>));
<a name="l00310"></a>00310 <span class="preprocessor">#endif</span>
<a name="l00311"></a>00311 <span class="preprocessor"></span>
<a name="l00312"></a>00312   <span class="keywordflow">if</span> (slot &gt;= list-&gt;<a class="code" href="structDBusDataSlotList.html#2d6cb7670a940bc886c99cb892b44502">n_slots</a>)
<a name="l00313"></a>00313     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00314"></a>00314   <span class="keywordflow">else</span>
<a name="l00315"></a>00315     <span class="keywordflow">return</span> list-&gt;<a class="code" href="structDBusDataSlotList.html#4dd0fc6cc10b9c48dd53f34335abd08e">slots</a>[slot].<a class="code" href="structDBusDataSlot.html#883c8c8946f13b6f5f3cf99f230159fd">data</a>;
<a name="l00316"></a>00316 }
<a name="l00317"></a>00317 
<a name="l00324"></a>00324 <span class="keywordtype">void</span>
<a name="l00325"></a><a class="code" href="group__DBusDataSlot.html#g3c96d2ca263ba397b4da2956a49ae282">00325</a> <a class="code" href="group__DBusDataSlot.html#g3c96d2ca263ba397b4da2956a49ae282">_dbus_data_slot_list_clear</a> (<a class="code" href="structDBusDataSlotList.html">DBusDataSlotList</a> *list)
<a name="l00326"></a>00326 {
<a name="l00327"></a>00327   <span class="keywordtype">int</span> i;
<a name="l00328"></a>00328 
<a name="l00329"></a>00329   i = 0;
<a name="l00330"></a>00330   <span class="keywordflow">while</span> (i &lt; list-&gt;n_slots)
<a name="l00331"></a>00331     {
<a name="l00332"></a>00332       <span class="keywordflow">if</span> (list-&gt;<a class="code" href="structDBusDataSlotList.html#4dd0fc6cc10b9c48dd53f34335abd08e">slots</a>[i].<a class="code" href="structDBusDataSlot.html#b899f58869942556fb1b381ca3f3e2b2">free_data_func</a>)
<a name="l00333"></a>00333         (* list-&gt;<a class="code" href="structDBusDataSlotList.html#4dd0fc6cc10b9c48dd53f34335abd08e">slots</a>[i].<a class="code" href="structDBusDataSlot.html#b899f58869942556fb1b381ca3f3e2b2">free_data_func</a>) (list-&gt;<a class="code" href="structDBusDataSlotList.html#4dd0fc6cc10b9c48dd53f34335abd08e">slots</a>[i].<a class="code" href="structDBusDataSlot.html#883c8c8946f13b6f5f3cf99f230159fd">data</a>);
<a name="l00334"></a>00334       list-&gt;<a class="code" href="structDBusDataSlotList.html#4dd0fc6cc10b9c48dd53f34335abd08e">slots</a>[i].<a class="code" href="structDBusDataSlot.html#883c8c8946f13b6f5f3cf99f230159fd">data</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00335"></a>00335       list-&gt;<a class="code" href="structDBusDataSlotList.html#4dd0fc6cc10b9c48dd53f34335abd08e">slots</a>[i].<a class="code" href="structDBusDataSlot.html#b899f58869942556fb1b381ca3f3e2b2">free_data_func</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00336"></a>00336       ++i;
<a name="l00337"></a>00337     }
<a name="l00338"></a>00338 }
<a name="l00339"></a>00339 
<a name="l00347"></a>00347 <span class="keywordtype">void</span>
<a name="l00348"></a><a class="code" href="group__DBusDataSlot.html#gbc399733376c462c3010271a2d431e73">00348</a> <a class="code" href="group__DBusDataSlot.html#gbc399733376c462c3010271a2d431e73">_dbus_data_slot_list_free</a> (<a class="code" href="structDBusDataSlotList.html">DBusDataSlotList</a> *list)
<a name="l00349"></a>00349 {
<a name="l00350"></a>00350   <a class="code" href="group__DBusDataSlot.html#g3c96d2ca263ba397b4da2956a49ae282">_dbus_data_slot_list_clear</a> (list);
<a name="l00351"></a>00351   
<a name="l00352"></a>00352   <a class="code" href="group__DBusMemory.html#g488c6b08cc8c1ddf0203243c4b27a13c">dbus_free</a> (list-&gt;<a class="code" href="structDBusDataSlotList.html#4dd0fc6cc10b9c48dd53f34335abd08e">slots</a>);
<a name="l00353"></a>00353   list-&gt;<a class="code" href="structDBusDataSlotList.html#4dd0fc6cc10b9c48dd53f34335abd08e">slots</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00354"></a>00354   list-&gt;<a class="code" href="structDBusDataSlotList.html#2d6cb7670a940bc886c99cb892b44502">n_slots</a> = 0;
<a name="l00355"></a>00355 }
<a name="l00356"></a>00356 
<a name="l00359"></a>00359 <span class="preprocessor">#ifdef DBUS_BUILD_TESTS</span>
<a name="l00360"></a>00360 <span class="preprocessor"></span><span class="preprocessor">#include "dbus-test.h"</span>
<a name="l00361"></a>00361 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00362"></a>00362 
<a name="l00363"></a>00363 <span class="keyword">static</span> <span class="keywordtype">int</span> free_counter;
<a name="l00364"></a>00364 
<a name="l00365"></a>00365 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l00366"></a>00366 test_free_slot_data_func (<span class="keywordtype">void</span> *data)
<a name="l00367"></a>00367 {
<a name="l00368"></a>00368   <span class="keywordtype">int</span> i = <a class="code" href="group__DBusInternalsUtils.html#gbbd3526a2ecd65da80b9f74ac286273d">_DBUS_POINTER_TO_INT</a> (data);
<a name="l00369"></a>00369 
<a name="l00370"></a>00370   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (free_counter == i);
<a name="l00371"></a>00371   ++free_counter;
<a name="l00372"></a>00372 }
<a name="l00373"></a>00373 
<a name="l00377"></a>00377 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l00378"></a>00378 _dbus_data_slot_test (<span class="keywordtype">void</span>)
<a name="l00379"></a>00379 {
<a name="l00380"></a>00380   <a class="code" href="structDBusDataSlotAllocator.html">DBusDataSlotAllocator</a> allocator;
<a name="l00381"></a>00381   <a class="code" href="structDBusDataSlotList.html">DBusDataSlotList</a> list;
<a name="l00382"></a>00382   <span class="keywordtype">int</span> i;
<a name="l00383"></a>00383   <a class="code" href="group__DBusMemory.html#g8792ec2b2b8626ca28022faf51ec415a">DBusFreeFunction</a> old_free_func;
<a name="l00384"></a>00384   <span class="keywordtype">void</span> *old_data;
<a name="l00385"></a>00385   <a class="code" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *mutex;
<a name="l00386"></a>00386   
<a name="l00387"></a>00387   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusDataSlot.html#g5edceab2f5849ff8a6f6cee5d1afc906">_dbus_data_slot_allocator_init</a> (&amp;allocator))
<a name="l00388"></a>00388     <a class="code" href="group__DBusInternalsUtils.html#g0c4961ec784874f1b1f3aeccea8d3da1">_dbus_assert_not_reached</a> (<span class="stringliteral">"no memory for allocator"</span>);
<a name="l00389"></a>00389 
<a name="l00390"></a>00390   <a class="code" href="group__DBusDataSlot.html#g6de49b3a1210202215d40a5a19806992">_dbus_data_slot_list_init</a> (&amp;list);
<a name="l00391"></a>00391 
<a name="l00392"></a>00392   <a class="code" href="group__DBusThreadsInternals.html#g5b22688470ddee6e7b9c9b6eb751fa2e">_dbus_mutex_new_at_location</a> (&amp;mutex);
<a name="l00393"></a>00393   <span class="keywordflow">if</span> (mutex == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00394"></a>00394     <a class="code" href="group__DBusInternalsUtils.html#g0c4961ec784874f1b1f3aeccea8d3da1">_dbus_assert_not_reached</a> (<span class="stringliteral">"failed to alloc mutex"</span>);
<a name="l00395"></a>00395   
<a name="l00396"></a>00396 <span class="preprocessor">#define N_SLOTS 100</span>
<a name="l00397"></a>00397 <span class="preprocessor"></span>
<a name="l00398"></a>00398   i = 0;
<a name="l00399"></a>00399   <span class="keywordflow">while</span> (i &lt; N_SLOTS)
<a name="l00400"></a>00400     {
<a name="l00401"></a>00401       <span class="comment">/* we don't really want apps to rely on this ordered</span>
<a name="l00402"></a>00402 <span class="comment">       * allocation, but it simplifies things to rely on it</span>
<a name="l00403"></a>00403 <span class="comment">       * here.</span>
<a name="l00404"></a>00404 <span class="comment">       */</span>
<a name="l00405"></a>00405       <a class="code" href="group__DBusTypes.html#gb18afa60e9b17b6e322735bda3d863d8">dbus_int32_t</a> tmp = -1;
<a name="l00406"></a>00406       
<a name="l00407"></a>00407       <a class="code" href="group__DBusDataSlot.html#g941a12182e69c185bd27f6efbfbd0f86">_dbus_data_slot_allocator_alloc</a> (&amp;allocator, &amp;mutex, &amp;tmp);
<a name="l00408"></a>00408 
<a name="l00409"></a>00409       <span class="keywordflow">if</span> (tmp != i)
<a name="l00410"></a>00410         <a class="code" href="group__DBusInternalsUtils.html#g0c4961ec784874f1b1f3aeccea8d3da1">_dbus_assert_not_reached</a> (<span class="stringliteral">"did not allocate slots in numeric order\n"</span>);
<a name="l00411"></a>00411 
<a name="l00412"></a>00412       ++i;
<a name="l00413"></a>00413     }
<a name="l00414"></a>00414 
<a name="l00415"></a>00415   i = 0;
<a name="l00416"></a>00416   <span class="keywordflow">while</span> (i &lt; N_SLOTS)
<a name="l00417"></a>00417     {
<a name="l00418"></a>00418       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusDataSlot.html#gd2952f9f686d96e7114fc49ab7452e1a">_dbus_data_slot_list_set</a> (&amp;allocator, &amp;list,
<a name="l00419"></a>00419                                      i,
<a name="l00420"></a>00420                                      <a class="code" href="group__DBusInternalsUtils.html#g05e902d8504a8a0e0b183fd2e20e329f">_DBUS_INT_TO_POINTER</a> (i), 
<a name="l00421"></a>00421                                      test_free_slot_data_func,
<a name="l00422"></a>00422                                      &amp;old_free_func, &amp;old_data))
<a name="l00423"></a>00423         <a class="code" href="group__DBusInternalsUtils.html#g0c4961ec784874f1b1f3aeccea8d3da1">_dbus_assert_not_reached</a> (<span class="stringliteral">"no memory to set data"</span>);
<a name="l00424"></a>00424 
<a name="l00425"></a>00425       <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (old_free_func == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00426"></a>00426       <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (old_data == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00427"></a>00427 
<a name="l00428"></a>00428       <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (<a class="code" href="group__DBusDataSlot.html#g43f741229f0c38788442601e2750ec66">_dbus_data_slot_list_get</a> (&amp;allocator, &amp;list, i) ==
<a name="l00429"></a>00429                     <a class="code" href="group__DBusInternalsUtils.html#g05e902d8504a8a0e0b183fd2e20e329f">_DBUS_INT_TO_POINTER</a> (i));
<a name="l00430"></a>00430       
<a name="l00431"></a>00431       ++i;
<a name="l00432"></a>00432     }
<a name="l00433"></a>00433 
<a name="l00434"></a>00434   free_counter = 0;
<a name="l00435"></a>00435   i = 0;
<a name="l00436"></a>00436   <span class="keywordflow">while</span> (i &lt; N_SLOTS)
<a name="l00437"></a>00437     {
<a name="l00438"></a>00438       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusDataSlot.html#gd2952f9f686d96e7114fc49ab7452e1a">_dbus_data_slot_list_set</a> (&amp;allocator, &amp;list,
<a name="l00439"></a>00439                                      i,
<a name="l00440"></a>00440                                      <a class="code" href="group__DBusInternalsUtils.html#g05e902d8504a8a0e0b183fd2e20e329f">_DBUS_INT_TO_POINTER</a> (i), 
<a name="l00441"></a>00441                                      test_free_slot_data_func,
<a name="l00442"></a>00442                                      &amp;old_free_func, &amp;old_data))
<a name="l00443"></a>00443         <a class="code" href="group__DBusInternalsUtils.html#g0c4961ec784874f1b1f3aeccea8d3da1">_dbus_assert_not_reached</a> (<span class="stringliteral">"no memory to set data"</span>);
<a name="l00444"></a>00444 
<a name="l00445"></a>00445       <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (old_free_func == test_free_slot_data_func);
<a name="l00446"></a>00446       <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (<a class="code" href="group__DBusInternalsUtils.html#gbbd3526a2ecd65da80b9f74ac286273d">_DBUS_POINTER_TO_INT</a> (old_data) == i);
<a name="l00447"></a>00447 
<a name="l00448"></a>00448       (* old_free_func) (old_data);
<a name="l00449"></a>00449       <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (i == (free_counter - 1));
<a name="l00450"></a>00450 
<a name="l00451"></a>00451       <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (<a class="code" href="group__DBusDataSlot.html#g43f741229f0c38788442601e2750ec66">_dbus_data_slot_list_get</a> (&amp;allocator, &amp;list, i) ==
<a name="l00452"></a>00452                     <a class="code" href="group__DBusInternalsUtils.html#g05e902d8504a8a0e0b183fd2e20e329f">_DBUS_INT_TO_POINTER</a> (i));
<a name="l00453"></a>00453       
<a name="l00454"></a>00454       ++i;
<a name="l00455"></a>00455     }
<a name="l00456"></a>00456 
<a name="l00457"></a>00457   free_counter = 0;
<a name="l00458"></a>00458   <a class="code" href="group__DBusDataSlot.html#gbc399733376c462c3010271a2d431e73">_dbus_data_slot_list_free</a> (&amp;list);
<a name="l00459"></a>00459 
<a name="l00460"></a>00460   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (N_SLOTS == free_counter);
<a name="l00461"></a>00461 
<a name="l00462"></a>00462   i = 0;
<a name="l00463"></a>00463   <span class="keywordflow">while</span> (i &lt; N_SLOTS)
<a name="l00464"></a>00464     {
<a name="l00465"></a>00465       <a class="code" href="group__DBusTypes.html#gb18afa60e9b17b6e322735bda3d863d8">dbus_int32_t</a> tmp = i;
<a name="l00466"></a>00466       
<a name="l00467"></a>00467       <a class="code" href="group__DBusDataSlot.html#g059c50a24cd9fc984e918e6159841633">_dbus_data_slot_allocator_free</a> (&amp;allocator, &amp;tmp);
<a name="l00468"></a>00468       <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (tmp == -1);
<a name="l00469"></a>00469       ++i;
<a name="l00470"></a>00470     }
<a name="l00471"></a>00471 
<a name="l00472"></a>00472   <a class="code" href="group__DBusThreadsInternals.html#gfd7f94bf0c265660749ffa690e76248a">_dbus_mutex_free_at_location</a> (&amp;mutex);
<a name="l00473"></a>00473   
<a name="l00474"></a>00474   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;
<a name="l00475"></a>00475 }
<a name="l00476"></a>00476 
<a name="l00477"></a>00477 <span class="preprocessor">#endif </span><span class="comment">/* DBUS_BUILD_TESTS */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Dec 14 22:26:11 2009 for D-Bus by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>

Anon7 - 2021