<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>dbus-list.c Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.2.15 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="pages.html">Related Pages</a> </center> <hr><h1>dbus-list.c</h1><div class="fragment"><pre>00001 <font class="comment">/* -*- mode: C; c-file-style: "gnu" -*- */</font> 00002 <font class="comment">/* dbus-list.c Generic linked list utility (internal to D-BUS implementation)</font> 00003 <font class="comment"> * </font> 00004 <font class="comment"> * Copyright (C) 2002 Red Hat, Inc.</font> 00005 <font class="comment"> *</font> 00006 <font class="comment"> * Licensed under the Academic Free License version 2.0</font> 00007 <font class="comment"> * </font> 00008 <font class="comment"> * This program is free software; you can redistribute it and/or modify</font> 00009 <font class="comment"> * it under the terms of the GNU General Public License as published by</font> 00010 <font class="comment"> * the Free Software Foundation; either version 2 of the License, or</font> 00011 <font class="comment"> * (at your option) any later version.</font> 00012 <font class="comment"> *</font> 00013 <font class="comment"> * This program is distributed in the hope that it will be useful,</font> 00014 <font class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</font> 00015 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</font> 00016 <font class="comment"> * GNU General Public License for more details.</font> 00017 <font class="comment"> * </font> 00018 <font class="comment"> * You should have received a copy of the GNU General Public License</font> 00019 <font class="comment"> * along with this program; if not, write to the Free Software</font> 00020 <font class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</font> 00021 <font class="comment"> *</font> 00022 <font class="comment"> */</font> 00023 00024 <font class="preprocessor">#include "dbus-internals.h"</font> 00025 <font class="preprocessor">#include "dbus-list.h"</font> 00026 <font class="preprocessor">#include "dbus-mempool.h"</font> 00027 <font class="preprocessor">#include "dbus-threads.h"</font> 00028 00037 <font class="keyword">static</font> <a class="code" href="structDBusMemPool.html">DBusMemPool</a> *list_pool; 00038 _DBUS_DEFINE_GLOBAL_LOCK (list); 00039 00050 <font class="comment">/* the mem pool is probably a speed hit, with the thread</font> 00051 <font class="comment"> * lock, though it does still save memory - unknown.</font> 00052 <font class="comment"> */</font> 00053 <font class="keyword">static</font> <a class="code" href="structDBusList.html">DBusList</a>* 00054 alloc_link (<font class="keywordtype">void</font> *data) 00055 { 00056 <a class="code" href="structDBusList.html">DBusList</a> *link; 00057 00058 <font class="keywordflow">if</font> (!_DBUS_LOCK (list)) 00059 <font class="keywordflow">return</font> NULL; 00060 00061 <font class="keywordflow">if</font> (list_pool == NULL) 00062 { 00063 list_pool = _dbus_mem_pool_new (<font class="keyword">sizeof</font> (<a class="code" href="structDBusList.html">DBusList</a>), TRUE); 00064 00065 <font class="keywordflow">if</font> (list_pool == NULL) 00066 { 00067 _DBUS_UNLOCK (list); 00068 <font class="keywordflow">return</font> NULL; 00069 } 00070 00071 link = _dbus_mem_pool_alloc (list_pool); 00072 <font class="keywordflow">if</font> (link == NULL) 00073 { 00074 _dbus_mem_pool_free (list_pool); 00075 list_pool = NULL; 00076 _DBUS_UNLOCK (list); 00077 <font class="keywordflow">return</font> NULL; 00078 } 00079 } 00080 <font class="keywordflow">else</font> 00081 { 00082 link = _dbus_mem_pool_alloc (list_pool); 00083 } 00084 00085 <font class="keywordflow">if</font> (link) 00086 link-><a class="code" href="structDBusList.html#m2">data</a> = data; 00087 00088 _DBUS_UNLOCK (list); 00089 00090 <font class="keywordflow">return</font> link; 00091 } 00092 00093 <font class="keyword">static</font> <font class="keywordtype">void</font> 00094 free_link (<a class="code" href="structDBusList.html">DBusList</a> *link) 00095 { 00096 _DBUS_LOCK (list); 00097 <font class="keywordflow">if</font> (_dbus_mem_pool_dealloc (list_pool, link)) 00098 { 00099 _dbus_mem_pool_free (list_pool); 00100 list_pool = NULL; 00101 } 00102 00103 _DBUS_UNLOCK (list); 00104 } 00105 00106 <font class="keyword">static</font> <font class="keywordtype">void</font> 00107 link_before (<a class="code" href="structDBusList.html">DBusList</a> **list, 00108 <a class="code" href="structDBusList.html">DBusList</a> *before_this_link, 00109 <a class="code" href="structDBusList.html">DBusList</a> *link) 00110 { 00111 <font class="keywordflow">if</font> (*list == NULL) 00112 { 00113 link-><a class="code" href="structDBusList.html#m0">prev</a> = link; 00114 link-><a class="code" href="structDBusList.html#m1">next</a> = link; 00115 *list = link; 00116 } 00117 <font class="keywordflow">else</font> 00118 { 00119 link-><a class="code" href="structDBusList.html#m1">next</a> = before_this_link; 00120 link-><a class="code" href="structDBusList.html#m0">prev</a> = before_this_link-><a class="code" href="structDBusList.html#m0">prev</a>; 00121 before_this_link-><a class="code" href="structDBusList.html#m0">prev</a> = link; 00122 link-><a class="code" href="structDBusList.html#m0">prev</a>-><a class="code" href="structDBusList.html#m1">next</a> = link; 00123 00124 <font class="keywordflow">if</font> (before_this_link == *list) 00125 *list = link; 00126 } 00127 } 00128 00129 <font class="keyword">static</font> <font class="keywordtype">void</font> 00130 link_after (<a class="code" href="structDBusList.html">DBusList</a> **list, 00131 <a class="code" href="structDBusList.html">DBusList</a> *after_this_link, 00132 <a class="code" href="structDBusList.html">DBusList</a> *link) 00133 { 00134 <font class="keywordflow">if</font> (*list == NULL) 00135 { 00136 link-><a class="code" href="structDBusList.html#m0">prev</a> = link; 00137 link-><a class="code" href="structDBusList.html#m1">next</a> = link; 00138 *list = link; 00139 } 00140 <font class="keywordflow">else</font> 00141 { 00142 link-><a class="code" href="structDBusList.html#m0">prev</a> = after_this_link; 00143 link-><a class="code" href="structDBusList.html#m1">next</a> = after_this_link-><a class="code" href="structDBusList.html#m1">next</a>; 00144 after_this_link-><a class="code" href="structDBusList.html#m1">next</a> = link; 00145 link-><a class="code" href="structDBusList.html#m1">next</a>-><a class="code" href="structDBusList.html#m0">prev</a> = link; 00146 } 00147 } 00148 00218 <a class="code" href="structDBusList.html">DBusList</a>* <a name="l00219"></a><a class="code" href="group__DBusList.html#a0">00219</a> _dbus_list_alloc_link (<font class="keywordtype">void</font> *data) 00220 { 00221 <font class="keywordflow">return</font> alloc_link (data); 00222 } 00223 00230 <font class="keywordtype">void</font> <a name="l00231"></a><a class="code" href="group__DBusList.html#a1">00231</a> _dbus_list_free_link (<a class="code" href="structDBusList.html">DBusList</a> *link) 00232 { 00233 free_link (link); 00234 } 00235 00236 00246 dbus_bool_t <a name="l00247"></a><a class="code" href="group__DBusList.html#a2">00247</a> _dbus_list_append (<a class="code" href="structDBusList.html">DBusList</a> **list, 00248 <font class="keywordtype">void</font> *data) 00249 { 00250 <font class="keywordflow">if</font> (!_dbus_list_prepend (list, data)) 00251 <font class="keywordflow">return</font> FALSE; 00252 00253 <font class="comment">/* Now cycle the list forward one so the prepended node is the tail */</font> 00254 *list = (*list)-><a class="code" href="structDBusList.html#m1">next</a>; 00255 00256 <font class="keywordflow">return</font> TRUE; 00257 } 00258 00268 dbus_bool_t <a name="l00269"></a><a class="code" href="group__DBusList.html#a3">00269</a> _dbus_list_prepend (<a class="code" href="structDBusList.html">DBusList</a> **list, 00270 <font class="keywordtype">void</font> *data) 00271 { 00272 <a class="code" href="structDBusList.html">DBusList</a> *link; 00273 00274 link = alloc_link (data); 00275 <font class="keywordflow">if</font> (link == NULL) 00276 <font class="keywordflow">return</font> FALSE; 00277 00278 link_before (list, *list, link); 00279 00280 <font class="keywordflow">return</font> TRUE; 00281 } 00282 00291 <font class="keywordtype">void</font> <a name="l00292"></a><a class="code" href="group__DBusList.html#a4">00292</a> _dbus_list_append_link (<a class="code" href="structDBusList.html">DBusList</a> **list, 00293 <a class="code" href="structDBusList.html">DBusList</a> *link) 00294 { 00295 _dbus_list_prepend_link (list, link); 00296 00297 <font class="comment">/* Now cycle the list forward one so the prepended node is the tail */</font> 00298 *list = (*list)-><a class="code" href="structDBusList.html#m1">next</a>; 00299 } 00300 00309 <font class="keywordtype">void</font> <a name="l00310"></a><a class="code" href="group__DBusList.html#a5">00310</a> _dbus_list_prepend_link (<a class="code" href="structDBusList.html">DBusList</a> **list, 00311 <a class="code" href="structDBusList.html">DBusList</a> *link) 00312 { 00313 link_before (list, *list, link); 00314 } 00315 00324 dbus_bool_t <a name="l00325"></a><a class="code" href="group__DBusList.html#a6">00325</a> _dbus_list_insert_before (<a class="code" href="structDBusList.html">DBusList</a> **list, 00326 <a class="code" href="structDBusList.html">DBusList</a> *before_this_link, 00327 <font class="keywordtype">void</font> *data) 00328 { 00329 <a class="code" href="structDBusList.html">DBusList</a> *link; 00330 00331 <font class="keywordflow">if</font> (before_this_link == NULL) 00332 <font class="keywordflow">return</font> _dbus_list_append (list, data); 00333 <font class="keywordflow">else</font> 00334 { 00335 link = alloc_link (data); 00336 <font class="keywordflow">if</font> (link == NULL) 00337 <font class="keywordflow">return</font> FALSE; 00338 00339 link_before (list, before_this_link, link); 00340 } 00341 00342 <font class="keywordflow">return</font> TRUE; 00343 } 00344 00353 dbus_bool_t <a name="l00354"></a><a class="code" href="group__DBusList.html#a7">00354</a> _dbus_list_insert_after (<a class="code" href="structDBusList.html">DBusList</a> **list, 00355 <a class="code" href="structDBusList.html">DBusList</a> *after_this_link, 00356 <font class="keywordtype">void</font> *data) 00357 { 00358 <a class="code" href="structDBusList.html">DBusList</a> *link; 00359 00360 <font class="keywordflow">if</font> (after_this_link == NULL) 00361 <font class="keywordflow">return</font> _dbus_list_prepend (list, data); 00362 <font class="keywordflow">else</font> 00363 { 00364 link = alloc_link (data); 00365 <font class="keywordflow">if</font> (link == NULL) 00366 <font class="keywordflow">return</font> FALSE; 00367 00368 link_after (list, after_this_link, link); 00369 } 00370 00371 <font class="keywordflow">return</font> TRUE; 00372 } 00373 00381 <font class="keywordtype">void</font> <a name="l00382"></a><a class="code" href="group__DBusList.html#a8">00382</a> _dbus_list_insert_before_link (<a class="code" href="structDBusList.html">DBusList</a> **list, 00383 <a class="code" href="structDBusList.html">DBusList</a> *before_this_link, 00384 <a class="code" href="structDBusList.html">DBusList</a> *link) 00385 { 00386 <font class="keywordflow">if</font> (before_this_link == NULL) 00387 _dbus_list_append_link (list, link); 00388 <font class="keywordflow">else</font> 00389 link_before (list, before_this_link, link); 00390 } 00391 00399 <font class="keywordtype">void</font> <a name="l00400"></a><a class="code" href="group__DBusList.html#a9">00400</a> _dbus_list_insert_after_link (<a class="code" href="structDBusList.html">DBusList</a> **list, 00401 <a class="code" href="structDBusList.html">DBusList</a> *after_this_link, 00402 <a class="code" href="structDBusList.html">DBusList</a> *link) 00403 { 00404 <font class="keywordflow">if</font> (after_this_link == NULL) 00405 _dbus_list_prepend_link (list, link); 00406 <font class="keywordflow">else</font> 00407 link_after (list, after_this_link, link); 00408 } 00409 00420 dbus_bool_t <a name="l00421"></a><a class="code" href="group__DBusList.html#a10">00421</a> _dbus_list_remove (<a class="code" href="structDBusList.html">DBusList</a> **list, 00422 <font class="keywordtype">void</font> *data) 00423 { 00424 <a class="code" href="structDBusList.html">DBusList</a> *link; 00425 00426 link = *list; 00427 <font class="keywordflow">while</font> (link != NULL) 00428 { 00429 <font class="keywordflow">if</font> (link-><a class="code" href="structDBusList.html#m2">data</a> == data) 00430 { 00431 _dbus_list_remove_link (list, link); 00432 <font class="keywordflow">return</font> TRUE; 00433 } 00434 00435 link = _dbus_list_get_next_link (list, link); 00436 } 00437 00438 <font class="keywordflow">return</font> FALSE; 00439 } 00440 00451 dbus_bool_t <a name="l00452"></a><a class="code" href="group__DBusList.html#a11">00452</a> _dbus_list_remove_last (<a class="code" href="structDBusList.html">DBusList</a> **list, 00453 <font class="keywordtype">void</font> *data) 00454 { 00455 <a class="code" href="structDBusList.html">DBusList</a> *link; 00456 00457 link = _dbus_list_find_last (list, data); 00458 <font class="keywordflow">if</font> (link) 00459 { 00460 _dbus_list_remove_link (list, link); 00461 <font class="keywordflow">return</font> TRUE; 00462 } 00463 <font class="keywordflow">else</font> 00464 <font class="keywordflow">return</font> FALSE; 00465 } 00466 00477 <a class="code" href="structDBusList.html">DBusList</a>* <a name="l00478"></a><a class="code" href="group__DBusList.html#a12">00478</a> _dbus_list_find_last (<a class="code" href="structDBusList.html">DBusList</a> **list, 00479 <font class="keywordtype">void</font> *data) 00480 { 00481 <a class="code" href="structDBusList.html">DBusList</a> *link; 00482 00483 link = _dbus_list_get_last_link (list); 00484 00485 <font class="keywordflow">while</font> (link != NULL) 00486 { 00487 <font class="keywordflow">if</font> (link-><a class="code" href="structDBusList.html#m2">data</a> == data) 00488 <font class="keywordflow">return</font> link; 00489 00490 link = _dbus_list_get_prev_link (list, link); 00491 } 00492 00493 <font class="keywordflow">return</font> NULL; 00494 } 00495 00504 <font class="keywordtype">void</font> <a name="l00505"></a><a class="code" href="group__DBusList.html#a13">00505</a> _dbus_list_unlink (<a class="code" href="structDBusList.html">DBusList</a> **list, 00506 <a class="code" href="structDBusList.html">DBusList</a> *link) 00507 { 00508 <font class="keywordflow">if</font> (link-><a class="code" href="structDBusList.html#m1">next</a> == link) 00509 { 00510 <font class="comment">/* one-element list */</font> 00511 *list = NULL; 00512 } 00513 <font class="keywordflow">else</font> 00514 { 00515 link-><a class="code" href="structDBusList.html#m0">prev</a>-><a class="code" href="structDBusList.html#m1">next</a> = link-><a class="code" href="structDBusList.html#m1">next</a>; 00516 link-><a class="code" href="structDBusList.html#m1">next</a>-><a class="code" href="structDBusList.html#m0">prev</a> = link-><a class="code" href="structDBusList.html#m0">prev</a>; 00517 00518 <font class="keywordflow">if</font> (*list == link) 00519 *list = link-><a class="code" href="structDBusList.html#m1">next</a>; 00520 } 00521 00522 link-><a class="code" href="structDBusList.html#m1">next</a> = NULL; 00523 link-><a class="code" href="structDBusList.html#m0">prev</a> = NULL; 00524 } 00525 00532 <font class="keywordtype">void</font> <a name="l00533"></a><a class="code" href="group__DBusList.html#a14">00533</a> _dbus_list_remove_link (<a class="code" href="structDBusList.html">DBusList</a> **list, 00534 <a class="code" href="structDBusList.html">DBusList</a> *link) 00535 { 00536 _dbus_list_unlink (list, link); 00537 free_link (link); 00538 } 00539 00547 <font class="keywordtype">void</font> <a name="l00548"></a><a class="code" href="group__DBusList.html#a15">00548</a> _dbus_list_clear (<a class="code" href="structDBusList.html">DBusList</a> **list) 00549 { 00550 <a class="code" href="structDBusList.html">DBusList</a> *link; 00551 00552 link = *list; 00553 <font class="keywordflow">while</font> (link != NULL) 00554 { 00555 <a class="code" href="structDBusList.html">DBusList</a> *next = _dbus_list_get_next_link (list, link); 00556 00557 free_link (link); 00558 00559 link = next; 00560 } 00561 00562 *list = NULL; 00563 } 00564 00572 <a class="code" href="structDBusList.html">DBusList</a>* <a name="l00573"></a><a class="code" href="group__DBusList.html#a16">00573</a> _dbus_list_get_first_link (<a class="code" href="structDBusList.html">DBusList</a> **list) 00574 { 00575 <font class="keywordflow">return</font> *list; 00576 } 00577 00585 <a class="code" href="structDBusList.html">DBusList</a>* <a name="l00586"></a><a class="code" href="group__DBusList.html#a17">00586</a> _dbus_list_get_last_link (<a class="code" href="structDBusList.html">DBusList</a> **list) 00587 { 00588 <font class="keywordflow">if</font> (*list == NULL) 00589 <font class="keywordflow">return</font> NULL; 00590 <font class="keywordflow">else</font> 00591 <font class="keywordflow">return</font> (*list)->prev; 00592 } 00593 00601 <font class="keywordtype">void</font>* <a name="l00602"></a><a class="code" href="group__DBusList.html#a18">00602</a> _dbus_list_get_last (<a class="code" href="structDBusList.html">DBusList</a> **list) 00603 { 00604 <font class="keywordflow">if</font> (*list == NULL) 00605 <font class="keywordflow">return</font> NULL; 00606 <font class="keywordflow">else</font> 00607 <font class="keywordflow">return</font> (*list)->prev->data; 00608 } 00609 00617 <font class="keywordtype">void</font>* <a name="l00618"></a><a class="code" href="group__DBusList.html#a19">00618</a> _dbus_list_get_first (<a class="code" href="structDBusList.html">DBusList</a> **list) 00619 { 00620 <font class="keywordflow">if</font> (*list == NULL) 00621 <font class="keywordflow">return</font> NULL; 00622 <font class="keywordflow">else</font> 00623 <font class="keywordflow">return</font> (*list)->data; 00624 } 00625 00633 <a class="code" href="structDBusList.html">DBusList</a>* <a name="l00634"></a><a class="code" href="group__DBusList.html#a20">00634</a> _dbus_list_pop_first_link (<a class="code" href="structDBusList.html">DBusList</a> **list) 00635 { 00636 <a class="code" href="structDBusList.html">DBusList</a> *link; 00637 00638 link = _dbus_list_get_first_link (list); 00639 <font class="keywordflow">if</font> (link == NULL) 00640 <font class="keywordflow">return</font> NULL; 00641 00642 _dbus_list_unlink (list, link); 00643 00644 <font class="keywordflow">return</font> link; 00645 } 00646 00654 <font class="keywordtype">void</font>* <a name="l00655"></a><a class="code" href="group__DBusList.html#a21">00655</a> _dbus_list_pop_first (<a class="code" href="structDBusList.html">DBusList</a> **list) 00656 { 00657 <a class="code" href="structDBusList.html">DBusList</a> *link; 00658 <font class="keywordtype">void</font> *data; 00659 00660 link = _dbus_list_get_first_link (list); 00661 <font class="keywordflow">if</font> (link == NULL) 00662 <font class="keywordflow">return</font> NULL; 00663 00664 data = link-><a class="code" href="structDBusList.html#m2">data</a>; 00665 _dbus_list_remove_link (list, link); 00666 00667 <font class="keywordflow">return</font> data; 00668 } 00669 00677 <font class="keywordtype">void</font>* <a name="l00678"></a><a class="code" href="group__DBusList.html#a22">00678</a> _dbus_list_pop_last (<a class="code" href="structDBusList.html">DBusList</a> **list) 00679 { 00680 <a class="code" href="structDBusList.html">DBusList</a> *link; 00681 <font class="keywordtype">void</font> *data; 00682 00683 link = _dbus_list_get_last_link (list); 00684 <font class="keywordflow">if</font> (link == NULL) 00685 <font class="keywordflow">return</font> NULL; 00686 00687 data = link-><a class="code" href="structDBusList.html#m2">data</a>; 00688 _dbus_list_remove_link (list, link); 00689 00690 <font class="keywordflow">return</font> data; 00691 } 00692 00700 <a class="code" href="structDBusList.html">DBusList</a>* <a name="l00701"></a><a class="code" href="group__DBusList.html#a23">00701</a> _dbus_list_pop_last_link (<a class="code" href="structDBusList.html">DBusList</a> **list) 00702 { 00703 <a class="code" href="structDBusList.html">DBusList</a> *link; 00704 00705 link = _dbus_list_get_last_link (list); 00706 <font class="keywordflow">if</font> (link == NULL) 00707 <font class="keywordflow">return</font> NULL; 00708 00709 _dbus_list_unlink (list, link); 00710 00711 <font class="keywordflow">return</font> link; 00712 } 00713 00723 dbus_bool_t <a name="l00724"></a><a class="code" href="group__DBusList.html#a24">00724</a> _dbus_list_copy (<a class="code" href="structDBusList.html">DBusList</a> **list, 00725 <a class="code" href="structDBusList.html">DBusList</a> **dest) 00726 { 00727 <a class="code" href="structDBusList.html">DBusList</a> *link; 00728 00729 _dbus_assert (list != dest); 00730 00731 *dest = NULL; 00732 00733 link = *list; 00734 <font class="keywordflow">while</font> (link != NULL) 00735 { 00736 <font class="keywordflow">if</font> (!_dbus_list_append (dest, link-><a class="code" href="structDBusList.html#m2">data</a>)) 00737 { 00738 <font class="comment">/* free what we have so far */</font> 00739 _dbus_list_clear (dest); 00740 <font class="keywordflow">return</font> FALSE; 00741 } 00742 00743 link = _dbus_list_get_next_link (list, link); 00744 } 00745 00746 <font class="keywordflow">return</font> TRUE; 00747 } 00748 00756 <font class="keywordtype">int</font> <a name="l00757"></a><a class="code" href="group__DBusList.html#a25">00757</a> _dbus_list_get_length (<a class="code" href="structDBusList.html">DBusList</a> **list) 00758 { 00759 <a class="code" href="structDBusList.html">DBusList</a> *link; 00760 <font class="keywordtype">int</font> length; 00761 00762 length = 0; 00763 00764 link = *list; 00765 <font class="keywordflow">while</font> (link != NULL) 00766 { 00767 ++length; 00768 00769 link = _dbus_list_get_next_link (list, link); 00770 } 00771 00772 <font class="keywordflow">return</font> length; 00773 } 00774 00785 <font class="keywordtype">void</font> <a name="l00786"></a><a class="code" href="group__DBusList.html#a26">00786</a> _dbus_list_foreach (<a class="code" href="structDBusList.html">DBusList</a> **list, 00787 DBusForeachFunction function, 00788 <font class="keywordtype">void</font> *data) 00789 { 00790 <a class="code" href="structDBusList.html">DBusList</a> *link; 00791 00792 link = *list; 00793 <font class="keywordflow">while</font> (link != NULL) 00794 { 00795 <a class="code" href="structDBusList.html">DBusList</a> *next = _dbus_list_get_next_link (list, link); 00796 00797 (* function) (link-><a class="code" href="structDBusList.html#m2">data</a>, data); 00798 00799 link = next; 00800 } 00801 } 00802 00809 dbus_bool_t <a name="l00810"></a><a class="code" href="group__DBusList.html#a27">00810</a> _dbus_list_length_is_one (<a class="code" href="structDBusList.html">DBusList</a> **list) 00811 { 00812 <font class="keywordflow">return</font> (*list != NULL && 00813 (*list)->next == *list); 00814 } 00815 00818 <font class="preprocessor">#ifdef DBUS_BUILD_TESTS</font> 00819 <font class="preprocessor"></font><font class="preprocessor">#include "dbus-test.h"</font> 00820 <font class="preprocessor">#include <stdio.h></font> 00821 00822 <font class="keyword">static</font> <font class="keywordtype">void</font> 00823 verify_list (<a class="code" href="structDBusList.html">DBusList</a> **list) 00824 { 00825 <a class="code" href="structDBusList.html">DBusList</a> *link; 00826 <font class="keywordtype">int</font> length; 00827 00828 link = *list; 00829 00830 <font class="keywordflow">if</font> (link == NULL) 00831 <font class="keywordflow">return</font>; 00832 00833 <font class="keywordflow">if</font> (link-><a class="code" href="structDBusList.html#m1">next</a> == link) 00834 { 00835 _dbus_assert (link-><a class="code" href="structDBusList.html#m0">prev</a> == link); 00836 _dbus_assert (*list == link); 00837 <font class="keywordflow">return</font>; 00838 } 00839 00840 length = 0; 00841 <font class="keywordflow">do</font> 00842 { 00843 length += 1; 00844 _dbus_assert (link-><a class="code" href="structDBusList.html#m0">prev</a>-><a class="code" href="structDBusList.html#m1">next</a> == link); 00845 _dbus_assert (link-><a class="code" href="structDBusList.html#m1">next</a>-><a class="code" href="structDBusList.html#m0">prev</a> == link); 00846 link = link-><a class="code" href="structDBusList.html#m1">next</a>; 00847 } 00848 <font class="keywordflow">while</font> (link != *list); 00849 00850 _dbus_assert (length == _dbus_list_get_length (list)); 00851 00852 <font class="keywordflow">if</font> (length == 1) 00853 _dbus_assert (_dbus_list_length_is_one (list)); 00854 <font class="keywordflow">else</font> 00855 _dbus_assert (!_dbus_list_length_is_one (list)); 00856 } 00857 00858 <font class="keyword">static</font> dbus_bool_t 00859 is_ascending_sequence (<a class="code" href="structDBusList.html">DBusList</a> **list) 00860 { 00861 <a class="code" href="structDBusList.html">DBusList</a> *link; 00862 <font class="keywordtype">int</font> prev; 00863 00864 prev = _DBUS_INT_MIN; 00865 00866 link = _dbus_list_get_first_link (list); 00867 <font class="keywordflow">while</font> (link != NULL) 00868 { 00869 <font class="keywordtype">int</font> v = _DBUS_POINTER_TO_INT (link-><a class="code" href="structDBusList.html#m2">data</a>); 00870 00871 <font class="keywordflow">if</font> (v <= prev) 00872 <font class="keywordflow">return</font> FALSE; 00873 00874 prev = v; 00875 00876 link = _dbus_list_get_next_link (list, link); 00877 } 00878 00879 <font class="keywordflow">return</font> TRUE; 00880 } 00881 00882 <font class="keyword">static</font> dbus_bool_t 00883 is_descending_sequence (<a class="code" href="structDBusList.html">DBusList</a> **list) 00884 { 00885 <a class="code" href="structDBusList.html">DBusList</a> *link; 00886 <font class="keywordtype">int</font> prev; 00887 00888 prev = _DBUS_INT_MAX; 00889 00890 link = _dbus_list_get_first_link (list); 00891 <font class="keywordflow">while</font> (link != NULL) 00892 { 00893 <font class="keywordtype">int</font> v = _DBUS_POINTER_TO_INT (link-><a class="code" href="structDBusList.html#m2">data</a>); 00894 00895 <font class="keywordflow">if</font> (v >= prev) 00896 <font class="keywordflow">return</font> FALSE; 00897 00898 prev = v; 00899 00900 link = _dbus_list_get_next_link (list, link); 00901 } 00902 00903 <font class="keywordflow">return</font> TRUE; 00904 } 00905 00906 <font class="keyword">static</font> dbus_bool_t 00907 all_even_values (<a class="code" href="structDBusList.html">DBusList</a> **list) 00908 { 00909 <a class="code" href="structDBusList.html">DBusList</a> *link; 00910 00911 link = _dbus_list_get_first_link (list); 00912 <font class="keywordflow">while</font> (link != NULL) 00913 { 00914 <font class="keywordtype">int</font> v = _DBUS_POINTER_TO_INT (link-><a class="code" href="structDBusList.html#m2">data</a>); 00915 00916 <font class="keywordflow">if</font> ((v % 2) != 0) 00917 <font class="keywordflow">return</font> FALSE; 00918 00919 link = _dbus_list_get_next_link (list, link); 00920 } 00921 00922 <font class="keywordflow">return</font> TRUE; 00923 } 00924 00925 <font class="keyword">static</font> dbus_bool_t 00926 all_odd_values (<a class="code" href="structDBusList.html">DBusList</a> **list) 00927 { 00928 <a class="code" href="structDBusList.html">DBusList</a> *link; 00929 00930 link = _dbus_list_get_first_link (list); 00931 <font class="keywordflow">while</font> (link != NULL) 00932 { 00933 <font class="keywordtype">int</font> v = _DBUS_POINTER_TO_INT (link-><a class="code" href="structDBusList.html#m2">data</a>); 00934 00935 <font class="keywordflow">if</font> ((v % 2) == 0) 00936 <font class="keywordflow">return</font> FALSE; 00937 00938 link = _dbus_list_get_next_link (list, link); 00939 } 00940 00941 <font class="keywordflow">return</font> TRUE; 00942 } 00943 00944 <font class="keyword">static</font> dbus_bool_t 00945 lists_equal (<a class="code" href="structDBusList.html">DBusList</a> **list1, 00946 <a class="code" href="structDBusList.html">DBusList</a> **list2) 00947 { 00948 <a class="code" href="structDBusList.html">DBusList</a> *link1; 00949 <a class="code" href="structDBusList.html">DBusList</a> *link2; 00950 00951 link1 = _dbus_list_get_first_link (list1); 00952 link2 = _dbus_list_get_first_link (list2); 00953 <font class="keywordflow">while</font> (link1 && link2) 00954 { 00955 <font class="keywordflow">if</font> (link1-><a class="code" href="structDBusList.html#m2">data</a> != link2-><a class="code" href="structDBusList.html#m2">data</a>) 00956 <font class="keywordflow">return</font> FALSE; 00957 00958 link1 = _dbus_list_get_next_link (list1, link1); 00959 link2 = _dbus_list_get_next_link (list2, link2); 00960 } 00961 00962 <font class="keywordflow">if</font> (link1 || link2) 00963 <font class="keywordflow">return</font> FALSE; 00964 00965 <font class="keywordflow">return</font> TRUE; 00966 } 00967 00973 dbus_bool_t <a name="l00974"></a><a class="code" href="group__DBusListInternals.html#a4">00974</a> _dbus_list_test (<font class="keywordtype">void</font>) 00975 { 00976 <a class="code" href="structDBusList.html">DBusList</a> *list1; 00977 <a class="code" href="structDBusList.html">DBusList</a> *list2; 00978 <a class="code" href="structDBusList.html">DBusList</a> *link1; 00979 <a class="code" href="structDBusList.html">DBusList</a> *link2; 00980 <a class="code" href="structDBusList.html">DBusList</a> *copy1; 00981 <a class="code" href="structDBusList.html">DBusList</a> *copy2; 00982 <font class="keywordtype">int</font> i; 00983 00984 list1 = NULL; 00985 list2 = NULL; 00986 00987 <font class="comment">/* Test append and prepend */</font> 00988 00989 i = 0; 00990 <font class="keywordflow">while</font> (i < 10) 00991 { 00992 <font class="keywordflow">if</font> (!_dbus_list_append (&list1, _DBUS_INT_TO_POINTER (i))) 00993 _dbus_assert_not_reached (<font class="stringliteral">"could not allocate for append"</font>); 00994 00995 <font class="keywordflow">if</font> (!_dbus_list_prepend (&list2, _DBUS_INT_TO_POINTER (i))) 00996 _dbus_assert_not_reached (<font class="stringliteral">"count not allocate for prepend"</font>); 00997 ++i; 00998 00999 verify_list (&list1); 01000 verify_list (&list2); 01001 01002 _dbus_assert (_dbus_list_get_length (&list1) == i); 01003 _dbus_assert (_dbus_list_get_length (&list2) == i); 01004 } 01005 01006 _dbus_assert (is_ascending_sequence (&list1)); 01007 _dbus_assert (is_descending_sequence (&list2)); 01008 01009 <font class="comment">/* Test list clear */</font> 01010 _dbus_list_clear (&list1); 01011 _dbus_list_clear (&list2); 01012 01013 verify_list (&list1); 01014 verify_list (&list2); 01015 01016 <font class="comment">/* Test get_first, get_last, pop_first, pop_last */</font> 01017 01018 i = 0; 01019 <font class="keywordflow">while</font> (i < 10) 01020 { 01021 _dbus_list_append (&list1, _DBUS_INT_TO_POINTER (i)); 01022 _dbus_list_prepend (&list2, _DBUS_INT_TO_POINTER (i)); 01023 ++i; 01024 } 01025 01026 --i; 01027 <font class="keywordflow">while</font> (i >= 0) 01028 { 01029 <font class="keywordtype">void</font> *got_data1; 01030 <font class="keywordtype">void</font> *got_data2; 01031 01032 <font class="keywordtype">void</font> *data1; 01033 <font class="keywordtype">void</font> *data2; 01034 01035 got_data1 = _dbus_list_get_last (&list1); 01036 got_data2 = _dbus_list_get_first (&list2); 01037 01038 data1 = _dbus_list_pop_last (&list1); 01039 data2 = _dbus_list_pop_first (&list2); 01040 01041 _dbus_assert (got_data1 == data1); 01042 _dbus_assert (got_data2 == data2); 01043 01044 _dbus_assert (_DBUS_POINTER_TO_INT (data1) == i); 01045 _dbus_assert (_DBUS_POINTER_TO_INT (data2) == i); 01046 01047 verify_list (&list1); 01048 verify_list (&list2); 01049 01050 _dbus_assert (is_ascending_sequence (&list1)); 01051 _dbus_assert (is_descending_sequence (&list2)); 01052 01053 --i; 01054 } 01055 01056 _dbus_assert (list1 == NULL); 01057 _dbus_assert (list2 == NULL); 01058 01059 <font class="comment">/* Test get_first_link, get_last_link, pop_first_link, pop_last_link */</font> 01060 01061 i = 0; 01062 <font class="keywordflow">while</font> (i < 10) 01063 { 01064 _dbus_list_append (&list1, _DBUS_INT_TO_POINTER (i)); 01065 _dbus_list_prepend (&list2, _DBUS_INT_TO_POINTER (i)); 01066 ++i; 01067 } 01068 01069 --i; 01070 <font class="keywordflow">while</font> (i >= 0) 01071 { 01072 <a class="code" href="structDBusList.html">DBusList</a> *got_link1; 01073 <a class="code" href="structDBusList.html">DBusList</a> *got_link2; 01074 01075 <a class="code" href="structDBusList.html">DBusList</a> *link1; 01076 <a class="code" href="structDBusList.html">DBusList</a> *link2; 01077 01078 <font class="keywordtype">void</font> *data1; 01079 <font class="keywordtype">void</font> *data2; 01080 01081 got_link1 = _dbus_list_get_last_link (&list1); 01082 got_link2 = _dbus_list_get_first_link (&list2); 01083 01084 link1 = _dbus_list_pop_last_link (&list1); 01085 link2 = _dbus_list_pop_first_link (&list2); 01086 01087 _dbus_assert (got_link1 == link1); 01088 _dbus_assert (got_link2 == link2); 01089 01090 data1 = link1-><a class="code" href="structDBusList.html#m2">data</a>; 01091 data2 = link2-><a class="code" href="structDBusList.html#m2">data</a>; 01092 01093 _dbus_list_free_link (link1); 01094 _dbus_list_free_link (link2); 01095 01096 _dbus_assert (_DBUS_POINTER_TO_INT (data1) == i); 01097 _dbus_assert (_DBUS_POINTER_TO_INT (data2) == i); 01098 01099 verify_list (&list1); 01100 verify_list (&list2); 01101 01102 _dbus_assert (is_ascending_sequence (&list1)); 01103 _dbus_assert (is_descending_sequence (&list2)); 01104 01105 --i; 01106 } 01107 01108 _dbus_assert (list1 == NULL); 01109 _dbus_assert (list2 == NULL); 01110 01111 <font class="comment">/* Test iteration */</font> 01112 01113 i = 0; 01114 <font class="keywordflow">while</font> (i < 10) 01115 { 01116 _dbus_list_append (&list1, _DBUS_INT_TO_POINTER (i)); 01117 _dbus_list_prepend (&list2, _DBUS_INT_TO_POINTER (i)); 01118 ++i; 01119 01120 verify_list (&list1); 01121 verify_list (&list2); 01122 01123 _dbus_assert (_dbus_list_get_length (&list1) == i); 01124 _dbus_assert (_dbus_list_get_length (&list2) == i); 01125 } 01126 01127 _dbus_assert (is_ascending_sequence (&list1)); 01128 _dbus_assert (is_descending_sequence (&list2)); 01129 01130 --i; 01131 link2 = _dbus_list_get_first_link (&list2); 01132 <font class="keywordflow">while</font> (link2 != NULL) 01133 { 01134 verify_list (&link2); <font class="comment">/* pretend this link is the head */</font> 01135 01136 _dbus_assert (_DBUS_POINTER_TO_INT (link2-><a class="code" href="structDBusList.html#m2">data</a>) == i); 01137 01138 link2 = _dbus_list_get_next_link (&list2, link2); 01139 --i; 01140 } 01141 01142 i = 0; 01143 link1 = _dbus_list_get_first_link (&list1); 01144 <font class="keywordflow">while</font> (link1 != NULL) 01145 { 01146 verify_list (&link1); <font class="comment">/* pretend this link is the head */</font> 01147 01148 _dbus_assert (_DBUS_POINTER_TO_INT (link1-><a class="code" href="structDBusList.html#m2">data</a>) == i); 01149 01150 link1 = _dbus_list_get_next_link (&list1, link1); 01151 ++i; 01152 } 01153 01154 --i; 01155 link1 = _dbus_list_get_last_link (&list1); 01156 <font class="keywordflow">while</font> (link1 != NULL) 01157 { 01158 verify_list (&link1); <font class="comment">/* pretend this link is the head */</font> 01159 01160 _dbus_assert (_DBUS_POINTER_TO_INT (link1-><a class="code" href="structDBusList.html#m2">data</a>) == i); 01161 01162 link1 = _dbus_list_get_prev_link (&list1, link1); 01163 --i; 01164 } 01165 01166 _dbus_list_clear (&list1); 01167 _dbus_list_clear (&list2); 01168 01169 <font class="comment">/* Test remove */</font> 01170 01171 i = 0; 01172 <font class="keywordflow">while</font> (i < 10) 01173 { 01174 _dbus_list_append (&list1, _DBUS_INT_TO_POINTER (i)); 01175 _dbus_list_prepend (&list2, _DBUS_INT_TO_POINTER (i)); 01176 ++i; 01177 } 01178 01179 --i; 01180 <font class="keywordflow">while</font> (i >= 0) 01181 { 01182 <font class="keywordflow">if</font> ((i % 2) == 0) 01183 { 01184 <font class="keywordflow">if</font> (!_dbus_list_remove (&list1, _DBUS_INT_TO_POINTER (i))) 01185 _dbus_assert_not_reached (<font class="stringliteral">"element should have been in list"</font>); 01186 <font class="keywordflow">if</font> (!_dbus_list_remove (&list2, _DBUS_INT_TO_POINTER (i))) 01187 _dbus_assert_not_reached (<font class="stringliteral">"element should have been in list"</font>); 01188 01189 verify_list (&list1); 01190 verify_list (&list2); 01191 } 01192 --i; 01193 } 01194 01195 _dbus_assert (all_odd_values (&list1)); 01196 _dbus_assert (all_odd_values (&list2)); 01197 01198 _dbus_list_clear (&list1); 01199 _dbus_list_clear (&list2); 01200 01201 <font class="comment">/* test removing the other half of the elements */</font> 01202 01203 i = 0; 01204 <font class="keywordflow">while</font> (i < 10) 01205 { 01206 _dbus_list_append (&list1, _DBUS_INT_TO_POINTER (i)); 01207 _dbus_list_prepend (&list2, _DBUS_INT_TO_POINTER (i)); 01208 ++i; 01209 } 01210 01211 --i; 01212 <font class="keywordflow">while</font> (i >= 0) 01213 { 01214 <font class="keywordflow">if</font> ((i % 2) != 0) 01215 { 01216 <font class="keywordflow">if</font> (!_dbus_list_remove (&list1, _DBUS_INT_TO_POINTER (i))) 01217 _dbus_assert_not_reached (<font class="stringliteral">"element should have been in list"</font>); 01218 <font class="keywordflow">if</font> (!_dbus_list_remove (&list2, _DBUS_INT_TO_POINTER (i))) 01219 _dbus_assert_not_reached (<font class="stringliteral">"element should have been in list"</font>); 01220 01221 verify_list (&list1); 01222 verify_list (&list2); 01223 } 01224 --i; 01225 } 01226 01227 _dbus_assert (all_even_values (&list1)); 01228 _dbus_assert (all_even_values (&list2)); 01229 01230 <font class="comment">/* clear list using remove_link */</font> 01231 <font class="keywordflow">while</font> (list1 != NULL) 01232 { 01233 _dbus_list_remove_link (&list1, list1); 01234 verify_list (&list1); 01235 } 01236 <font class="keywordflow">while</font> (list2 != NULL) 01237 { 01238 _dbus_list_remove_link (&list2, list2); 01239 verify_list (&list2); 01240 } 01241 01242 <font class="comment">/* Test remove link more generally */</font> 01243 i = 0; 01244 <font class="keywordflow">while</font> (i < 10) 01245 { 01246 _dbus_list_append (&list1, _DBUS_INT_TO_POINTER (i)); 01247 _dbus_list_prepend (&list2, _DBUS_INT_TO_POINTER (i)); 01248 ++i; 01249 } 01250 01251 --i; 01252 link2 = _dbus_list_get_first_link (&list2); 01253 <font class="keywordflow">while</font> (link2 != NULL) 01254 { 01255 <a class="code" href="structDBusList.html">DBusList</a> *next = _dbus_list_get_next_link (&list2, link2); 01256 01257 _dbus_assert (_DBUS_POINTER_TO_INT (link2-><a class="code" href="structDBusList.html#m2">data</a>) == i); 01258 01259 <font class="keywordflow">if</font> ((i % 2) == 0) 01260 _dbus_list_remove_link (&list2, link2); 01261 01262 verify_list (&list2); 01263 01264 link2 = next; 01265 --i; 01266 } 01267 01268 _dbus_assert (all_odd_values (&list2)); 01269 _dbus_list_clear (&list2); 01270 01271 i = 0; 01272 link1 = _dbus_list_get_first_link (&list1); 01273 <font class="keywordflow">while</font> (link1 != NULL) 01274 { 01275 <a class="code" href="structDBusList.html">DBusList</a> *next = _dbus_list_get_next_link (&list1, link1); 01276 01277 _dbus_assert (_DBUS_POINTER_TO_INT (link1-><a class="code" href="structDBusList.html#m2">data</a>) == i); 01278 01279 <font class="keywordflow">if</font> ((i % 2) != 0) 01280 _dbus_list_remove_link (&list1, link1); 01281 01282 verify_list (&list1); 01283 01284 link1 = next; 01285 ++i; 01286 } 01287 01288 _dbus_assert (all_even_values (&list1)); 01289 _dbus_list_clear (&list1); 01290 01291 <font class="comment">/* Test copying a list */</font> 01292 i = 0; 01293 <font class="keywordflow">while</font> (i < 10) 01294 { 01295 _dbus_list_append (&list1, _DBUS_INT_TO_POINTER (i)); 01296 _dbus_list_prepend (&list2, _DBUS_INT_TO_POINTER (i)); 01297 ++i; 01298 } 01299 01300 <font class="comment">/* bad pointers, because they are allowed in the copy dest */</font> 01301 copy1 = _DBUS_INT_TO_POINTER (0x342234); 01302 copy2 = _DBUS_INT_TO_POINTER (23); 01303 01304 _dbus_list_copy (&list1, &copy1); 01305 verify_list (&list1); 01306 verify_list (&copy1); 01307 _dbus_assert (lists_equal (&list1, &copy1)); 01308 01309 _dbus_list_copy (&list2, &copy2); 01310 verify_list (&list2); 01311 verify_list (&copy2); 01312 _dbus_assert (lists_equal (&list2, &copy2)); 01313 01314 <font class="comment">/* Now test copying empty lists */</font> 01315 _dbus_list_clear (&list1); 01316 _dbus_list_clear (&list2); 01317 _dbus_list_clear (&copy1); 01318 _dbus_list_clear (&copy2); 01319 01320 <font class="comment">/* bad pointers, because they are allowed in the copy dest */</font> 01321 copy1 = _DBUS_INT_TO_POINTER (0x342234); 01322 copy2 = _DBUS_INT_TO_POINTER (23); 01323 01324 _dbus_list_copy (&list1, &copy1); 01325 verify_list (&list1); 01326 verify_list (&copy1); 01327 _dbus_assert (lists_equal (&list1, &copy1)); 01328 01329 _dbus_list_copy (&list2, &copy2); 01330 verify_list (&list2); 01331 verify_list (&copy2); 01332 _dbus_assert (lists_equal (&list2, &copy2)); 01333 01334 _dbus_list_clear (&list1); 01335 _dbus_list_clear (&list2); 01336 01337 <font class="comment">/* insert_before on empty list */</font> 01338 _dbus_list_insert_before (&list1, NULL, 01339 _DBUS_INT_TO_POINTER (0)); 01340 verify_list (&list1); 01341 01342 <font class="comment">/* inserting before first element */</font> 01343 _dbus_list_insert_before (&list1, list1, 01344 _DBUS_INT_TO_POINTER (2)); 01345 verify_list (&list1); 01346 _dbus_assert (is_descending_sequence (&list1)); 01347 01348 <font class="comment">/* inserting in the middle */</font> 01349 _dbus_list_insert_before (&list1, list1-><a class="code" href="structDBusList.html#m1">next</a>, 01350 _DBUS_INT_TO_POINTER (1)); 01351 verify_list (&list1); 01352 _dbus_assert (is_descending_sequence (&list1)); 01353 01354 <font class="comment">/* using insert_before to append */</font> 01355 _dbus_list_insert_before (&list1, NULL, 01356 _DBUS_INT_TO_POINTER (-1)); 01357 verify_list (&list1); 01358 _dbus_assert (is_descending_sequence (&list1)); 01359 01360 _dbus_list_clear (&list1); 01361 01362 <font class="comment">/* insert_after on empty list */</font> 01363 _dbus_list_insert_after (&list1, NULL, 01364 _DBUS_INT_TO_POINTER (0)); 01365 verify_list (&list1); 01366 01367 <font class="comment">/* inserting after first element */</font> 01368 _dbus_list_insert_after (&list1, list1, 01369 _DBUS_INT_TO_POINTER (1)); 01370 verify_list (&list1); 01371 _dbus_assert (is_ascending_sequence (&list1)); 01372 01373 <font class="comment">/* inserting at the end */</font> 01374 _dbus_list_insert_after (&list1, list1-><a class="code" href="structDBusList.html#m1">next</a>, 01375 _DBUS_INT_TO_POINTER (2)); 01376 verify_list (&list1); 01377 _dbus_assert (is_ascending_sequence (&list1)); 01378 01379 <font class="comment">/* using insert_after to prepend */</font> 01380 _dbus_list_insert_after (&list1, NULL, 01381 _DBUS_INT_TO_POINTER (-1)); 01382 verify_list (&list1); 01383 _dbus_assert (is_ascending_sequence (&list1)); 01384 01385 _dbus_list_clear (&list1); 01386 01387 <font class="comment">/* using remove_last */</font> 01388 _dbus_list_append (&list1, _DBUS_INT_TO_POINTER (2)); 01389 _dbus_list_append (&list1, _DBUS_INT_TO_POINTER (1)); 01390 _dbus_list_append (&list1, _DBUS_INT_TO_POINTER (3)); 01391 01392 _dbus_list_remove_last (&list1, _DBUS_INT_TO_POINTER (2)); 01393 01394 verify_list (&list1); 01395 _dbus_assert (is_ascending_sequence (&list1)); 01396 01397 _dbus_list_clear (&list1); 01398 01399 <font class="keywordflow">return</font> TRUE; 01400 } 01401 01402 <font class="preprocessor">#endif</font> </pre></div><hr><address align="right"><small>Generated on Wed Jun 9 05:01:25 2004 for D-BUS by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.15 </small></address> </body> </html>