Coverage report for dbus/dbus-object-tree.c.gcov
-: 0:Source:dbus-object-tree.c
-: 0:Graph:.libs/dbus-object-tree.gcno
-: 0:Data:.libs/dbus-object-tree.gcda
-: 0:Runs:11823
-: 0:Programs:5
-: 1:/* -*- mode: C; c-file-style: "gnu" -*- */
-: 2:/* dbus-object-tree.c DBusObjectTree (internals of DBusConnection)
-: 3: *
-: 4: * Copyright (C) 2003, 2005 Red Hat Inc.
-: 5: *
-: 6: * Licensed under the Academic Free License version 2.1
-: 7: *
-: 8: * This program is free software; you can redistribute it and/or modify
-: 9: * it under the terms of the GNU General Public License as published by
-: 10: * the Free Software Foundation; either version 2 of the License, or
-: 11: * (at your option) any later version.
-: 12: *
-: 13: * This program is distributed in the hope that it will be useful,
-: 14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
-: 15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-: 16: * GNU General Public License for more details.
-: 17: *
-: 18: * You should have received a copy of the GNU General Public License
-: 19: * along with this program; if not, write to the Free Software
-: 20: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-: 21: *
-: 22: */
-: 23:#include "dbus-object-tree.h"
-: 24:#include "dbus-connection-internal.h"
-: 25:#include "dbus-internals.h"
-: 26:#include "dbus-hash.h"
-: 27:#include "dbus-protocol.h"
-: 28:#include "dbus-string.h"
-: 29:#include <string.h>
-: 30:#include <stdlib.h>
-: 31:
-: 32:/**
-: 33: * @defgroup DBusObjectTree A hierarchy of objects with container-contained relationship
-: 34: * @ingroup DBusInternals
-: 35: * @brief DBusObjectTree is used by DBusConnection to track the object tree
-: 36: *
-: 37: * Types and functions related to DBusObjectTree. These
-: 38: * are all library-internal.
-: 39: *
-: 40: * @{
-: 41: */
-: 42:
-: 43:/** Subnode of the object hierarchy */
-: 44:typedef struct DBusObjectSubtree DBusObjectSubtree;
-: 45:
-: 46:static DBusObjectSubtree* _dbus_object_subtree_new (const char *name,
-: 47: const DBusObjectPathVTable *vtable,
-: 48: void *user_data);
-: 49:static DBusObjectSubtree* _dbus_object_subtree_ref (DBusObjectSubtree *subtree);
-: 50:static void _dbus_object_subtree_unref (DBusObjectSubtree *subtree);
-: 51:
-: 52:/**
-: 53: * Internals of DBusObjectTree
-: 54: */
-: 55:struct DBusObjectTree
-: 56:{
-: 57: int refcount; /**< Reference count */
-: 58: DBusConnection *connection; /**< Connection this tree belongs to */
-: 59:
-: 60: DBusObjectSubtree *root; /**< Root of the tree ("/" node) */
-: 61:};
-: 62:
-: 63:/**
-: 64: * Struct representing a single registered subtree handler, or node
-: 65: * that's a parent of a registered subtree handler. If
-: 66: * message_function != NULL there's actually a handler at this node.
-: 67: */
-: 68:struct DBusObjectSubtree
-: 69:{
-: 70: DBusAtomic refcount; /**< Reference count */
-: 71: DBusObjectSubtree *parent; /**< Parent node */
-: 72: DBusObjectPathUnregisterFunction unregister_function; /**< Function to call on unregister */
-: 73: DBusObjectPathMessageFunction message_function; /**< Function to handle messages */
-: 74: void *user_data; /**< Data for functions */
-: 75: DBusObjectSubtree **subtrees; /**< Child nodes */
-: 76: int n_subtrees; /**< Number of child nodes */
-: 77: int max_subtrees; /**< Number of allocated entries in subtrees */
-: 78: unsigned int invoke_as_fallback : 1; /**< Whether to invoke message_function when child nodes don't handle the message */
-: 79: char name[1]; /**< Allocated as large as necessary */
-: 80:};
-: 81:
-: 82:/**
-: 83: * Creates a new object tree, representing a mapping from paths
-: 84: * to handler vtables.
-: 85: *
-: 86: * @param connection the connection this tree belongs to
-: 87: * @returns the new tree or #NULL if no memory
-: 88: */
-: 89:DBusObjectTree*
-: 90:_dbus_object_tree_new (DBusConnection *connection)
function _dbus_object_tree_new called 14696 returned 100% blocks executed 100%
14696: 91:{
-: 92: DBusObjectTree *tree;
-: 93:
-: 94: /* the connection passed in here isn't fully constructed,
-: 95: * so don't do anything more than store a pointer to
-: 96: * it
-: 97: */
-: 98:
14696: 99: tree = dbus_new0 (DBusObjectTree, 1);
call 0 returned 100%
14696: 100: if (tree == NULL)
branch 0 taken 99% (fallthrough)
branch 1 taken 1%
15: 101: goto oom;
-: 102:
14681: 103: tree->refcount = 1;
14681: 104: tree->connection = connection;
14681: 105: tree->root = _dbus_object_subtree_new ("/", NULL, NULL);
call 0 returned 100%
14681: 106: if (tree->root == NULL)
branch 0 taken 1% (fallthrough)
branch 1 taken 99%
17: 107: goto oom;
14664: 108: tree->root->invoke_as_fallback = TRUE;
-: 109:
14664: 110: return tree;
-: 111:
32: 112: oom:
32: 113: if (tree)
branch 0 taken 53% (fallthrough)
branch 1 taken 47%
-: 114: {
17: 115: dbus_free (tree);
call 0 returned 100%
-: 116: }
-: 117:
32: 118: return NULL;
-: 119:}
-: 120:
-: 121:/**
-: 122: * Increment the reference count
-: 123: * @param tree the object tree
-: 124: * @returns the object tree
-: 125: */
-: 126:DBusObjectTree *
-: 127:_dbus_object_tree_ref (DBusObjectTree *tree)
function _dbus_object_tree_ref called 203 returned 100% blocks executed 100%
203: 128:{
203: 129: _dbus_assert (tree->refcount > 0);
call 0 returned 100%
-: 130:
203: 131: tree->refcount += 1;
-: 132:
203: 133: return tree;
-: 134:}
-: 135:
-: 136:/**
-: 137: * Decrement the reference count
-: 138: * @param tree the object tree
-: 139: */
-: 140:void
-: 141:_dbus_object_tree_unref (DBusObjectTree *tree)
function _dbus_object_tree_unref called 14450 returned 100% blocks executed 100%
14450: 142:{
14450: 143: _dbus_assert (tree->refcount > 0);
call 0 returned 100%
-: 144:
14450: 145: tree->refcount -= 1;
-: 146:
14450: 147: if (tree->refcount == 0)
branch 0 taken 99% (fallthrough)
branch 1 taken 1%
-: 148: {
14247: 149: _dbus_object_tree_free_all_unlocked (tree);
call 0 returned 100%
-: 150:
14247: 151: dbus_free (tree);
call 0 returned 100%
-: 152: }
14450: 153:}
-: 154:
-: 155:/** Set to 1 to get a bunch of debug spew about finding the
-: 156: * subtree nodes
-: 157: */
-: 158:#define VERBOSE_FIND 0
-: 159:
-: 160:static DBusObjectSubtree*
-: 161:find_subtree_recurse (DBusObjectSubtree *subtree,
-: 162: const char **path,
-: 163: dbus_bool_t create_if_not_found,
-: 164: int *index_in_parent,
-: 165: dbus_bool_t *exact_match)
function find_subtree_recurse called 129558 returned 100% blocks executed 95%
129558: 166:{
-: 167: int i, j;
-: 168: dbus_bool_t return_deepest_match;
-: 169:
129558: 170: return_deepest_match = exact_match != NULL;
-: 171:
129558: 172: _dbus_assert (!(return_deepest_match && create_if_not_found));
branch 0 taken 28% (fallthrough)
branch 1 taken 72%
branch 2 taken 100% (fallthrough)
branch 3 taken 0%
call 4 returned 100%
-: 173:
129558: 174: if (path[0] == NULL)
branch 0 taken 28% (fallthrough)
branch 1 taken 72%
-: 175: {
-: 176:#if VERBOSE_FIND
-: 177: _dbus_verbose (" path exhausted, returning %s\n",
-: 178: subtree->name);
-: 179:#endif
36664: 180: if (exact_match != NULL)
branch 0 taken 28% (fallthrough)
branch 1 taken 72%
10267: 181: *exact_match = TRUE;
36664: 182: return subtree;
-: 183: }
-: 184:
-: 185:#if VERBOSE_FIND
-: 186: _dbus_verbose (" searching children of %s for %s\n",
-: 187: subtree->name, path[0]);
-: 188:#endif
-: 189:
92894: 190: i = 0;
92894: 191: j = subtree->n_subtrees;
216771: 192: while (i < j)
branch 0 taken 84%
branch 1 taken 16% (fallthrough)
-: 193: {
-: 194: int k, v;
-: 195:
104259: 196: k = (i + j) / 2;
104259: 197: v = strcmp (path[0], subtree->subtrees[k]->name);
call 0 returned 100%
-: 198:
-: 199:#if VERBOSE_FIND
-: 200: _dbus_verbose (" %s cmp %s = %d\n",
-: 201: path[0], subtree->subtrees[k]->name,
-: 202: v);
-: 203:#endif
-: 204:
104259: 205: if (v == 0)
branch 0 taken 70% (fallthrough)
branch 1 taken 30%
-: 206: {
73276: 207: if (index_in_parent)
branch 0 taken 4% (fallthrough)
branch 1 taken 96%
-: 208: {
-: 209:#if VERBOSE_FIND
-: 210: _dbus_verbose (" storing parent index %d\n", k);
-: 211:#endif
3021: 212: *index_in_parent = k;
-: 213: }
-: 214:
73276: 215: if (return_deepest_match)
branch 0 taken 30% (fallthrough)
branch 1 taken 70%
-: 216: {
-: 217: DBusObjectSubtree *next;
-: 218:
21784: 219: next = find_subtree_recurse (subtree->subtrees[k],
call 0 returned 100%
-: 220: &path[1], create_if_not_found,
-: 221: index_in_parent, exact_match);
21784: 222: if (next == NULL &&
branch 0 taken 2% (fallthrough)
branch 1 taken 98%
branch 2 taken 33% (fallthrough)
branch 3 taken 67%
-: 223: subtree->invoke_as_fallback)
-: 224: {
-: 225:#if VERBOSE_FIND
-: 226: _dbus_verbose (" no deeper match found, returning %s\n",
-: 227: subtree->name);
-: 228:#endif
159: 229: if (exact_match != NULL)
branch 0 taken 100% (fallthrough)
branch 1 taken 0%
159: 230: *exact_match = FALSE;
159: 231: return subtree;
-: 232: }
-: 233: else
21625: 234: return next;
-: 235: }
-: 236: else
51492: 237: return find_subtree_recurse (subtree->subtrees[k],
call 0 returned 100%
-: 238: &path[1], create_if_not_found,
-: 239: index_in_parent, exact_match);
-: 240: }
30983: 241: else if (v < 0)
branch 0 taken 64% (fallthrough)
branch 1 taken 36%
-: 242: {
19984: 243: j = k;
-: 244: }
-: 245: else
-: 246: {
10999: 247: i = k + 1;
-: 248: }
-: 249: }
-: 250:
-: 251:#if VERBOSE_FIND
-: 252: _dbus_verbose (" no match found, current tree %s, create_if_not_found = %d\n",
-: 253: subtree->name, create_if_not_found);
-: 254:#endif
-: 255:
19618: 256: if (create_if_not_found)
branch 0 taken 30% (fallthrough)
branch 1 taken 70%
-: 257: {
-: 258: DBusObjectSubtree* child;
-: 259: int child_pos, new_n_subtrees;
-: 260:
-: 261:#if VERBOSE_FIND
-: 262: _dbus_verbose (" creating subtree %s\n",
-: 263: path[0]);
-: 264:#endif
-: 265:
5904: 266: child = _dbus_object_subtree_new (path[0],
call 0 returned 100%
-: 267: NULL, NULL);
5904: 268: if (child == NULL)
branch 0 taken 1% (fallthrough)
branch 1 taken 99%
26: 269: return NULL;
-: 270:
5878: 271: new_n_subtrees = subtree->n_subtrees + 1;
5878: 272: if (new_n_subtrees > subtree->max_subtrees)
branch 0 taken 89% (fallthrough)
branch 1 taken 11%
-: 273: {
-: 274: int new_max_subtrees;
-: 275: DBusObjectSubtree **new_subtrees;
-: 276:
5252: 277: new_max_subtrees = subtree->max_subtrees == 0 ? 1 : 2 * subtree->max_subtrees;
branch 0 taken 21% (fallthrough)
branch 1 taken 79%
5252: 278: new_subtrees = dbus_realloc (subtree->subtrees,
call 0 returned 100%
-: 279: new_max_subtrees * sizeof (DBusObjectSubtree*));
5252: 280: if (new_subtrees == NULL)
branch 0 taken 1% (fallthrough)
branch 1 taken 99%
-: 281: {
22: 282: _dbus_object_subtree_unref (child);
call 0 returned 100%
22: 283: return NULL;
-: 284: }
5230: 285: subtree->subtrees = new_subtrees;
5230: 286: subtree->max_subtrees = new_max_subtrees;
-: 287: }
-: 288:
-: 289: /* The binary search failed, so i == j points to the
-: 290: place the child should be inserted. */
5856: 291: child_pos = i;
5856: 292: _dbus_assert (child_pos < new_n_subtrees &&
branch 0 taken 100% (fallthrough)
branch 1 taken 0%
branch 2 taken 100% (fallthrough)
branch 3 taken 0%
call 4 returned 100%
-: 293: new_n_subtrees <= subtree->max_subtrees);
5856: 294: if (child_pos + 1 < new_n_subtrees)
branch 0 taken 15% (fallthrough)
branch 1 taken 85%
-: 295: {
863: 296: memmove (&subtree->subtrees[child_pos+1],
call 0 returned 100%
-: 297: &subtree->subtrees[child_pos],
-: 298: (new_n_subtrees - child_pos - 1) *
-: 299: sizeof subtree->subtrees[0]);
-: 300: }
5856: 301: subtree->subtrees[child_pos] = child;
-: 302:
5856: 303: if (index_in_parent)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
#####: 304: *index_in_parent = child_pos;
5856: 305: subtree->n_subtrees = new_n_subtrees;
5856: 306: child->parent = subtree;
-: 307:
5856: 308: return find_subtree_recurse (child,
call 0 returned 100%
-: 309: &path[1], create_if_not_found,
-: 310: index_in_parent, exact_match);
-: 311: }
-: 312: else
-: 313: {
13714: 314: if (exact_match != NULL)
branch 0 taken 31% (fallthrough)
branch 1 taken 69%
4282: 315: *exact_match = FALSE;
13714: 316: return (return_deepest_match && subtree->invoke_as_fallback) ? subtree : NULL;
branch 0 taken 31% (fallthrough)
branch 1 taken 69%
branch 2 taken 96% (fallthrough)
branch 3 taken 4%
-: 317: }
-: 318:}
-: 319:
-: 320:static DBusObjectSubtree*
-: 321:find_subtree (DBusObjectTree *tree,
-: 322: const char **path,
-: 323: int *index_in_parent)
function find_subtree called 29958 returned 100% blocks executed 100%
29958: 324:{
-: 325: DBusObjectSubtree *subtree;
-: 326:
-: 327:#if VERBOSE_FIND
-: 328: _dbus_verbose ("Looking for exact registered subtree\n");
-: 329:#endif
-: 330:
29958: 331: subtree = find_subtree_recurse (tree->root, path, FALSE, index_in_parent, NULL);
call 0 returned 100%
-: 332:
29958: 333: if (subtree && subtree->message_function == NULL)
branch 0 taken 69% (fallthrough)
branch 1 taken 31%
branch 2 taken 24% (fallthrough)
branch 3 taken 76%
4929: 334: return NULL;
-: 335: else
25029: 336: return subtree;
-: 337:}
-: 338:
-: 339:static DBusObjectSubtree*
-: 340:lookup_subtree (DBusObjectTree *tree,
-: 341: const char **path)
function lookup_subtree called 732 returned 100% blocks executed 100%
732: 342:{
-: 343:#if VERBOSE_FIND
-: 344: _dbus_verbose ("Looking for subtree\n");
-: 345:#endif
732: 346: return find_subtree_recurse (tree->root, path, FALSE, NULL, NULL);
call 0 returned 100%
-: 347:}
-: 348:
-: 349:static DBusObjectSubtree*
-: 350:find_handler (DBusObjectTree *tree,
-: 351: const char **path,
-: 352: dbus_bool_t *exact_match)
function find_handler called 14549 returned 100% blocks executed 100%
14549: 353:{
-: 354:#if VERBOSE_FIND
-: 355: _dbus_verbose ("Looking for deepest handler\n");
-: 356:#endif
14549: 357: _dbus_assert (exact_match != NULL);
call 0 returned 100%
-: 358:
14549: 359: *exact_match = FALSE; /* ensure always initialized */
-: 360:
14549: 361: return find_subtree_recurse (tree->root, path, FALSE, NULL, exact_match);
call 0 returned 100%
-: 362:}
-: 363:
-: 364:static DBusObjectSubtree*
-: 365:ensure_subtree (DBusObjectTree *tree,
-: 366: const char **path)
function ensure_subtree called 5187 returned 100% blocks executed 100%
5187: 367:{
-: 368:#if VERBOSE_FIND
-: 369: _dbus_verbose ("Ensuring subtree\n");
-: 370:#endif
5187: 371: return find_subtree_recurse (tree->root, path, TRUE, NULL, NULL);
call 0 returned 100%
-: 372:}
-: 373:
-: 374:/**
-: 375: * Registers a new subtree in the global object tree.
-: 376: *
-: 377: * @param tree the global object tree
-: 378: * @param fallback #TRUE to handle messages to children of this path
-: 379: * @param path NULL-terminated array of path elements giving path to subtree
-: 380: * @param vtable the vtable used to traverse this subtree
-: 381: * @param user_data user data to pass to methods in the vtable
-: 382: * @returns #FALSE if not enough memory
-: 383: */
-: 384:dbus_bool_t
-: 385:_dbus_object_tree_register (DBusObjectTree *tree,
-: 386: dbus_bool_t fallback,
-: 387: const char **path,
-: 388: const DBusObjectPathVTable *vtable,
-: 389: void *user_data)
function _dbus_object_tree_register called 5187 returned 100% blocks executed 64%
5187: 390:{
-: 391: DBusObjectSubtree *subtree;
-: 392:
5187: 393: _dbus_assert (tree != NULL);
call 0 returned 100%
5187: 394: _dbus_assert (vtable->message_function != NULL);
call 0 returned 100%
5187: 395: _dbus_assert (path != NULL);
call 0 returned 100%
-: 396:
5187: 397: subtree = ensure_subtree (tree, path);
call 0 returned 100%
5187: 398: if (subtree == NULL)
branch 0 taken 1% (fallthrough)
branch 1 taken 99%
48: 399: return FALSE;
-: 400:
-: 401:#ifndef DBUS_DISABLE_CHECKS
5139: 402: if (subtree->message_function != NULL)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
-: 403: {
#####: 404: _dbus_warn ("A handler is already registered for the path starting with path[0] = \"%s\"\n",
branch 0 never executed
branch 1 never executed
call 2 never executed
-: 405: path[0] ? path[0] : "null");
#####: 406: return FALSE;
-: 407: }
-: 408:#else
-: 409: _dbus_assert (subtree->message_function == NULL);
-: 410:#endif
-: 411:
5139: 412: subtree->message_function = vtable->message_function;
5139: 413: subtree->unregister_function = vtable->unregister_function;
5139: 414: subtree->user_data = user_data;
5139: 415: subtree->invoke_as_fallback = fallback != FALSE;
-: 416:
5139: 417: return TRUE;
-: 418:}
-: 419:
-: 420:/**
-: 421: * Unregisters an object subtree that was registered with the
-: 422: * same path.
-: 423: *
-: 424: * @param tree the global object tree
-: 425: * @param path path to the subtree (same as the one passed to _dbus_object_tree_register())
-: 426: */
-: 427:void
-: 428:_dbus_object_tree_unregister_and_unlock (DBusObjectTree *tree,
-: 429: const char **path)
function _dbus_object_tree_unregister_and_unlock called 1431 returned 100% blocks executed 58%
1431: 430:{
-: 431: int i;
-: 432: DBusObjectSubtree *subtree;
-: 433: DBusObjectPathUnregisterFunction unregister_function;
-: 434: void *user_data;
-: 435: DBusConnection *connection;
-: 436:
1431: 437: _dbus_assert (path != NULL);
call 0 returned 100%
-: 438:
1431: 439: unregister_function = NULL;
1431: 440: user_data = NULL;
-: 441:
1431: 442: subtree = find_subtree (tree, path, &i);
call 0 returned 100%
-: 443:
-: 444:#ifndef DBUS_DISABLE_CHECKS
1431: 445: if (subtree == NULL)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
-: 446: {
#####: 447: _dbus_warn ("Attempted to unregister path (path[0] = %s path[1] = %s) which isn't registered\n",
branch 0 never executed
branch 1 never executed
branch 2 never executed
branch 3 never executed
call 4 never executed
-: 448: path[0] ? path[0] : "null",
-: 449: path[1] ? path[1] : "null");
#####: 450: goto unlock;
-: 451: }
-: 452:#else
-: 453: _dbus_assert (subtree != NULL);
-: 454:#endif
-: 455:
1431: 456: _dbus_assert (subtree->parent == NULL ||
branch 0 taken 89% (fallthrough)
branch 1 taken 11%
branch 2 taken 100% (fallthrough)
branch 3 taken 0%
branch 4 taken 100% (fallthrough)
branch 5 taken 0%
call 6 returned 100%
-: 457: (i >= 0 && subtree->parent->subtrees[i] == subtree));
-: 458:
1431: 459: subtree->message_function = NULL;
-: 460:
1431: 461: unregister_function = subtree->unregister_function;
1431: 462: user_data = subtree->user_data;
-: 463:
1431: 464: subtree->unregister_function = NULL;
1431: 465: subtree->user_data = NULL;
-: 466:
-: 467: /* If we have no subtrees of our own, remove from
-: 468: * our parent (FIXME could also be more aggressive
-: 469: * and remove our parent if it becomes empty)
-: 470: */
1431: 471: if (subtree->parent && subtree->n_subtrees == 0)
branch 0 taken 89% (fallthrough)
branch 1 taken 11%
branch 2 taken 50% (fallthrough)
branch 3 taken 50%
-: 472: {
-: 473: /* assumes a 0-byte memmove is OK */
636: 474: memmove (&subtree->parent->subtrees[i],
call 0 returned 100%
-: 475: &subtree->parent->subtrees[i+1],
-: 476: (subtree->parent->n_subtrees - i - 1) *
-: 477: sizeof (subtree->parent->subtrees[0]));
636: 478: subtree->parent->n_subtrees -= 1;
-: 479:
636: 480: subtree->parent = NULL;
-: 481:
636: 482: _dbus_object_subtree_unref (subtree);
call 0 returned 100%
-: 483: }
1431: 484: subtree = NULL;
-: 485:
1431: 486:unlock:
1431: 487: connection = tree->connection;
-: 488:
-: 489: /* Unlock and call application code */
-: 490:#ifdef DBUS_BUILD_TESTS
1431: 491: if (connection)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
-: 492:#endif
-: 493: {
#####: 494: _dbus_connection_ref_unlocked (connection);
call 0 never executed
#####: 495: _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
call 0 never executed
#####: 496: _dbus_connection_unlock (connection);
call 0 never executed
-: 497: }
-: 498:
1431: 499: if (unregister_function)
branch 0 taken 100% (fallthrough)
branch 1 taken 0%
1431: 500: (* unregister_function) (connection, user_data);
call 0 returned 100%
-: 501:
-: 502:#ifdef DBUS_BUILD_TESTS
1431: 503: if (connection)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
-: 504:#endif
#####: 505: dbus_connection_unref (connection);
call 0 never executed
1431: 506:}
-: 507:
-: 508:static void
-: 509:free_subtree_recurse (DBusConnection *connection,
-: 510: DBusObjectSubtree *subtree)
function free_subtree_recurse called 18219 returned 100% blocks executed 100%
18219: 511:{
-: 512: /* Delete them from the end, for slightly
-: 513: * more robustness against odd reentrancy.
-: 514: */
40410: 515: while (subtree->n_subtrees > 0)
branch 0 taken 18%
branch 1 taken 82% (fallthrough)
-: 516: {
-: 517: DBusObjectSubtree *child;
-: 518:
3972: 519: child = subtree->subtrees[subtree->n_subtrees - 1];
3972: 520: subtree->subtrees[subtree->n_subtrees - 1] = NULL;
3972: 521: subtree->n_subtrees -= 1;
3972: 522: child->parent = NULL;
-: 523:
3972: 524: free_subtree_recurse (connection, child);
call 0 returned 100%
-: 525: }
-: 526:
-: 527: /* Call application code */
18219: 528: if (subtree->unregister_function)
branch 0 taken 18% (fallthrough)
branch 1 taken 82%
3292: 529: (* subtree->unregister_function) (connection,
call 0 returned 100%
-: 530: subtree->user_data);
-: 531:
18219: 532: subtree->message_function = NULL;
18219: 533: subtree->unregister_function = NULL;
18219: 534: subtree->user_data = NULL;
-: 535:
-: 536: /* Now free ourselves */
18219: 537: _dbus_object_subtree_unref (subtree);
call 0 returned 100%
18219: 538:}
-: 539:
-: 540:/**
-: 541: * Free all the handlers in the tree. Lock on tree's connection
-: 542: * must not be held.
-: 543: *
-: 544: * @param tree the object tree
-: 545: */
-: 546:void
-: 547:_dbus_object_tree_free_all_unlocked (DBusObjectTree *tree)
function _dbus_object_tree_free_all_unlocked called 28084 returned 100% blocks executed 100%
28084: 548:{
28084: 549: if (tree->root)
branch 0 taken 51% (fallthrough)
branch 1 taken 49%
14247: 550: free_subtree_recurse (tree->connection,
call 0 returned 100%
-: 551: tree->root);
28084: 552: tree->root = NULL;
28084: 553:}
-: 554:
-: 555:static dbus_bool_t
-: 556:_dbus_object_tree_list_registered_unlocked (DBusObjectTree *tree,
-: 557: const char **parent_path,
-: 558: char ***child_entries)
function _dbus_object_tree_list_registered_unlocked called 732 returned 100% blocks executed 88%
732: 559:{
-: 560: DBusObjectSubtree *subtree;
-: 561: char **retval;
-: 562:
732: 563: _dbus_assert (parent_path != NULL);
call 0 returned 100%
732: 564: _dbus_assert (child_entries != NULL);
call 0 returned 100%
-: 565:
732: 566: *child_entries = NULL;
-: 567:
732: 568: subtree = lookup_subtree (tree, parent_path);
call 0 returned 100%
732: 569: if (subtree == NULL)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
-: 570: {
#####: 571: retval = dbus_new0 (char *, 1);
call 0 never executed
-: 572: }
-: 573: else
-: 574: {
-: 575: int i;
732: 576: retval = dbus_new0 (char*, subtree->n_subtrees + 1);
call 0 returned 100%
732: 577: if (retval == NULL)
branch 0 taken 1% (fallthrough)
branch 1 taken 99%
4: 578: goto out;
728: 579: i = 0;
2538: 580: while (i < subtree->n_subtrees)
branch 0 taken 60%
branch 1 taken 40% (fallthrough)
-: 581: {
1088: 582: retval[i] = _dbus_strdup (subtree->subtrees[i]->name);
call 0 returned 100%
1088: 583: if (retval[i] == NULL)
branch 0 taken 1% (fallthrough)
branch 1 taken 99%
-: 584: {
6: 585: dbus_free_string_array (retval);
call 0 returned 100%
6: 586: retval = NULL;
6: 587: goto out;
-: 588: }
1082: 589: ++i;
-: 590: }
-: 591: }
-: 592:
732: 593: out:
-: 594:
732: 595: *child_entries = retval;
732: 596: return retval != NULL;
-: 597:}
-: 598:
-: 599:static DBusHandlerResult
-: 600:handle_default_introspect_and_unlock (DBusObjectTree *tree,
-: 601: DBusMessage *message,
-: 602: const char **path)
function handle_default_introspect_and_unlock called 875 returned 100% blocks executed 11%
875: 603:{
-: 604: DBusString xml;
-: 605: DBusHandlerResult result;
-: 606: char **children;
-: 607: int i;
-: 608: DBusMessage *reply;
-: 609: DBusMessageIter iter;
-: 610: const char *v_STRING;
-: 611: dbus_bool_t already_unlocked;
-: 612:
-: 613: /* We have the connection lock here */
-: 614:
875: 615: already_unlocked = FALSE;
-: 616:
875: 617: _dbus_verbose (" considering default Introspect() handler...\n");
call 0 returned 100%
-: 618:
875: 619: reply = NULL;
-: 620:
875: 621: if (!dbus_message_is_method_call (message,
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
-: 622: DBUS_INTERFACE_INTROSPECTABLE,
-: 623: "Introspect"))
-: 624: {
-: 625:#ifdef DBUS_BUILD_TESTS
875: 626: if (tree->connection)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
-: 627:#endif
-: 628: {
#####: 629: _dbus_verbose ("unlock %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
call 0 never executed
#####: 630: _dbus_connection_unlock (tree->connection);
call 0 never executed
-: 631: }
-: 632:
875: 633: return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-: 634: }
-: 635:
#####: 636: _dbus_verbose (" using default Introspect() handler!\n");
call 0 never executed
-: 637:
#####: 638: if (!_dbus_string_init (&xml))
call 0 never executed
branch 1 never executed
branch 2 never executed
-: 639: {
-: 640:#ifdef DBUS_BUILD_TESTS
#####: 641: if (tree->connection)
branch 0 never executed
branch 1 never executed
-: 642:#endif
-: 643: {
#####: 644: _dbus_verbose ("unlock %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
call 0 never executed
#####: 645: _dbus_connection_unlock (tree->connection);
call 0 never executed
-: 646: }
-: 647:
#####: 648: return DBUS_HANDLER_RESULT_NEED_MEMORY;
-: 649: }
-: 650:
#####: 651: result = DBUS_HANDLER_RESULT_NEED_MEMORY;
-: 652:
#####: 653: children = NULL;
#####: 654: if (!_dbus_object_tree_list_registered_unlocked (tree, path, &children))
call 0 never executed
branch 1 never executed
branch 2 never executed
#####: 655: goto out;
-: 656:
#####: 657: if (!_dbus_string_append (&xml, DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE))
call 0 never executed
branch 1 never executed
branch 2 never executed
#####: 658: goto out;
-: 659:
#####: 660: if (!_dbus_string_append (&xml, "<node>\n"))
call 0 never executed
branch 1 never executed
branch 2 never executed
#####: 661: goto out;
-: 662:
#####: 663: i = 0;
#####: 664: while (children[i] != NULL)
branch 0 never executed
branch 1 never executed
-: 665: {
#####: 666: if (!_dbus_string_append_printf (&xml, " <node name=\"%s\"/>\n",
call 0 never executed
branch 1 never executed
branch 2 never executed
-: 667: children[i]))
#####: 668: goto out;
-: 669:
#####: 670: ++i;
-: 671: }
-: 672:
#####: 673: if (!_dbus_string_append (&xml, "</node>\n"))
call 0 never executed
branch 1 never executed
branch 2 never executed
#####: 674: goto out;
-: 675:
#####: 676: reply = dbus_message_new_method_return (message);
call 0 never executed
#####: 677: if (reply == NULL)
branch 0 never executed
branch 1 never executed
#####: 678: goto out;
-: 679:
#####: 680: dbus_message_iter_init_append (reply, &iter);
call 0 never executed
#####: 681: v_STRING = _dbus_string_get_const_data (&xml);
call 0 never executed
#####: 682: if (!dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &v_STRING))
call 0 never executed
branch 1 never executed
branch 2 never executed
#####: 683: goto out;
-: 684:
-: 685:#ifdef DBUS_BUILD_TESTS
#####: 686: if (tree->connection)
branch 0 never executed
branch 1 never executed
-: 687:#endif
-: 688: {
#####: 689: already_unlocked = TRUE;
-: 690:
#####: 691: if (!_dbus_connection_send_and_unlock (tree->connection, reply, NULL))
call 0 never executed
branch 1 never executed
branch 2 never executed
#####: 692: goto out;
-: 693: }
-: 694:
#####: 695: result = DBUS_HANDLER_RESULT_HANDLED;
-: 696:
#####: 697: out:
-: 698:#ifdef DBUS_BUILD_TESTS
#####: 699: if (tree->connection)
branch 0 never executed
branch 1 never executed
-: 700:#endif
-: 701: {
#####: 702: if (!already_unlocked)
branch 0 never executed
branch 1 never executed
-: 703: {
#####: 704: _dbus_verbose ("unlock %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
call 0 never executed
#####: 705: _dbus_connection_unlock (tree->connection);
call 0 never executed
-: 706: }
-: 707: }
-: 708:
#####: 709: _dbus_string_free (&xml);
call 0 never executed
#####: 710: dbus_free_string_array (children);
call 0 never executed
#####: 711: if (reply)
branch 0 never executed
branch 1 never executed
#####: 712: dbus_message_unref (reply);
call 0 never executed
-: 713:
#####: 714: return result;
-: 715:}
-: 716:
-: 717:/**
-: 718: * Tries to dispatch a message by directing it to handler for the
-: 719: * object path listed in the message header, if any. Messages are
-: 720: * dispatched first to the registered handler that matches the largest
-: 721: * number of path elements; that is, message to /foo/bar/baz would go
-: 722: * to the handler for /foo/bar before the one for /foo.
-: 723: *
-: 724: * @todo thread problems
-: 725: *
-: 726: * @param tree the global object tree
-: 727: * @param message the message to dispatch
-: 728: * @returns whether message was handled successfully
-: 729: */
-: 730:DBusHandlerResult
-: 731:_dbus_object_tree_dispatch_and_unlock (DBusObjectTree *tree,
-: 732: DBusMessage *message)
function _dbus_object_tree_dispatch_and_unlock called 933 returned 100% blocks executed 77%
933: 733:{
-: 734: char **path;
-: 735: dbus_bool_t exact_match;
-: 736: DBusList *list;
-: 737: DBusList *link;
-: 738: DBusHandlerResult result;
-: 739: DBusObjectSubtree *subtree;
-: 740:
-: 741:#if 0
-: 742: _dbus_verbose ("Dispatch of message by object path\n");
-: 743:#endif
-: 744:
933: 745: path = NULL;
933: 746: if (!dbus_message_get_path_decomposed (message, &path))
call 0 returned 100%
branch 1 taken 3% (fallthrough)
branch 2 taken 97%
-: 747: {
-: 748:#ifdef DBUS_BUILD_TESTS
28: 749: if (tree->connection)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
-: 750:#endif
-: 751: {
#####: 752: _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
call 0 never executed
#####: 753: _dbus_connection_unlock (tree->connection);
call 0 never executed
-: 754: }
-: 755:
28: 756: _dbus_verbose ("No memory to get decomposed path\n");
call 0 returned 100%
-: 757:
28: 758: return DBUS_HANDLER_RESULT_NEED_MEMORY;
-: 759: }
-: 760:
905: 761: if (path == NULL)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
-: 762: {
-: 763:#ifdef DBUS_BUILD_TESTS
#####: 764: if (tree->connection)
branch 0 never executed
branch 1 never executed
-: 765:#endif
-: 766: {
#####: 767: _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
call 0 never executed
#####: 768: _dbus_connection_unlock (tree->connection);
call 0 never executed
-: 769: }
-: 770:
#####: 771: _dbus_verbose ("No path field in message\n");
call 0 never executed
#####: 772: return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-: 773: }
-: 774:
-: 775: /* Find the deepest path that covers the path in the message */
905: 776: subtree = find_handler (tree, (const char**) path, &exact_match);
call 0 returned 100%
-: 777:
-: 778: /* Build a list of all paths that cover the path in the message */
-: 779:
905: 780: list = NULL;
-: 781:
4301: 782: while (subtree != NULL)
branch 0 taken 74%
branch 1 taken 26% (fallthrough)
-: 783: {
2521: 784: if (subtree->message_function != NULL && (exact_match || subtree->invoke_as_fallback))
branch 0 taken 94% (fallthrough)
branch 1 taken 6%
branch 2 taken 62% (fallthrough)
branch 3 taken 38%
branch 4 taken 73% (fallthrough)
branch 5 taken 27%
-: 785: {
1978: 786: _dbus_object_subtree_ref (subtree);
call 0 returned 100%
-: 787:
-: 788: /* run deepest paths first */
1978: 789: if (!_dbus_list_append (&list, subtree))
call 0 returned 100%
branch 1 taken 2% (fallthrough)
branch 2 taken 98%
-: 790: {
30: 791: result = DBUS_HANDLER_RESULT_NEED_MEMORY;
30: 792: _dbus_object_subtree_unref (subtree);
call 0 returned 100%
30: 793: goto free_and_return;
-: 794: }
-: 795: }
-: 796:
2491: 797: exact_match = FALSE;
2491: 798: subtree = subtree->parent;
-: 799: }
-: 800:
875: 801: _dbus_verbose ("%d handlers in the path tree for this message\n",
call 0 returned 100%
call 1 returned 100%
-: 802: _dbus_list_get_length (&list));
-: 803:
-: 804: /* Invoke each handler in the list */
-: 805:
875: 806: result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-: 807:
875: 808: link = _dbus_list_get_first_link (&list);
call 0 returned 100%
3682: 809: while (link != NULL)
branch 0 taken 69%
branch 1 taken 31% (fallthrough)
-: 810: {
1932: 811: DBusList *next = _dbus_list_get_next_link (&list, link);
branch 0 taken 55% (fallthrough)
branch 1 taken 45%
1932: 812: subtree = link->data;
-: 813:
-: 814: /* message_function is NULL if we're unregistered
-: 815: * due to reentrancy
-: 816: */
1932: 817: if (subtree->message_function)
branch 0 taken 100% (fallthrough)
branch 1 taken 0%
-: 818: {
-: 819: DBusObjectPathMessageFunction message_function;
-: 820: void *user_data;
-: 821:
1932: 822: message_function = subtree->message_function;
1932: 823: user_data = subtree->user_data;
-: 824:
-: 825:#if 0
-: 826: _dbus_verbose (" (invoking a handler)\n");
-: 827:#endif
-: 828:
-: 829:#ifdef DBUS_BUILD_TESTS
1932: 830: if (tree->connection)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
-: 831:#endif
-: 832: {
#####: 833: _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
call 0 never executed
#####: 834: _dbus_connection_unlock (tree->connection);
call 0 never executed
-: 835: }
-: 836:
-: 837: /* FIXME you could unregister the subtree in another thread
-: 838: * before we invoke the callback, and I can't figure out a
-: 839: * good way to solve this.
-: 840: */
-: 841:
1932: 842: result = (* message_function) (tree->connection,
call 0 returned 100%
-: 843: message,
-: 844: user_data);
-: 845:
-: 846:#ifdef DBUS_BUILD_TESTS
1932: 847: if (tree->connection)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
-: 848:#endif
#####: 849: _dbus_connection_lock (tree->connection);
call 0 never executed
-: 850:
1932: 851: if (result != DBUS_HANDLER_RESULT_NOT_YET_HANDLED)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
#####: 852: goto free_and_return;
-: 853: }
-: 854:
1932: 855: link = next;
-: 856: }
-: 857:
905: 858: free_and_return:
-: 859:
905: 860: if (result == DBUS_HANDLER_RESULT_NOT_YET_HANDLED)
branch 0 taken 97% (fallthrough)
branch 1 taken 3%
-: 861: {
-: 862: /* This hardcoded default handler does a minimal Introspect()
-: 863: */
875: 864: result = handle_default_introspect_and_unlock (tree, message,
call 0 returned 100%
-: 865: (const char**) path);
-: 866: }
-: 867: else
-: 868: {
-: 869:#ifdef DBUS_BUILD_TESTS
30: 870: if (tree->connection)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
-: 871:#endif
-: 872: {
#####: 873: _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
call 0 never executed
#####: 874: _dbus_connection_unlock (tree->connection);
call 0 never executed
-: 875: }
-: 876: }
-: 877:
3758: 878: while (list != NULL)
branch 0 taken 68%
branch 1 taken 32% (fallthrough)
-: 879: {
1948: 880: link = _dbus_list_get_first_link (&list);
call 0 returned 100%
1948: 881: _dbus_object_subtree_unref (link->data);
call 0 returned 100%
1948: 882: _dbus_list_remove_link (&list, link);
call 0 returned 100%
-: 883: }
-: 884:
905: 885: dbus_free_string_array (path);
call 0 returned 100%
-: 886:
905: 887: return result;
-: 888:}
-: 889:
-: 890:/**
-: 891: * Looks up the data passed to _dbus_object_tree_register() for a
-: 892: * handler at the given path.
-: 893: *
-: 894: * @param tree the global object tree
-: 895: * @param path NULL-terminated array of path elements giving path to subtree
-: 896: * @returns the object's user_data or #NULL if none found
-: 897: */
-: 898:void*
-: 899:_dbus_object_tree_get_user_data_unlocked (DBusObjectTree *tree,
-: 900: const char **path)
function _dbus_object_tree_get_user_data_unlocked called 6570 returned 100% blocks executed 100%
6570: 901:{
-: 902: dbus_bool_t exact_match;
-: 903: DBusObjectSubtree *subtree;
-: 904:
6570: 905: _dbus_assert (tree != NULL);
call 0 returned 100%
6570: 906: _dbus_assert (path != NULL);
call 0 returned 100%
-: 907:
-: 908: /* Find the deepest path that covers the path in the message */
6570: 909: subtree = find_handler (tree, (const char**) path, &exact_match);
call 0 returned 100%
-: 910:
6570: 911: if ((subtree == NULL) || !exact_match)
branch 0 taken 100% (fallthrough)
branch 1 taken 0%
branch 2 taken 10% (fallthrough)
branch 3 taken 90%
-: 912: {
636: 913: _dbus_verbose ("%s: No object at specified path found\n",
call 0 returned 100%
-: 914: _DBUS_FUNCTION_NAME);
636: 915: return NULL;
-: 916: }
-: 917:
5934: 918: return subtree->user_data;
-: 919:}
-: 920:
-: 921:/**
-: 922: * Allocates a subtree object.
-: 923: *
-: 924: * @param name name to duplicate.
-: 925: * @returns newly-allocated subtree
-: 926: */
-: 927:static DBusObjectSubtree*
-: 928:allocate_subtree_object (const char *name)
function allocate_subtree_object called 20585 returned 100% blocks executed 100%
20585: 929:{
-: 930: int len;
-: 931: DBusObjectSubtree *subtree;
20585: 932: const size_t front_padding = _DBUS_STRUCT_OFFSET (DBusObjectSubtree, name);
-: 933:
20585: 934: _dbus_assert (name != NULL);
call 0 returned 100%
-: 935:
20585: 936: len = strlen (name);
call 0 returned 100%
-: 937:
20585: 938: subtree = dbus_malloc (front_padding + (len + 1));
call 0 returned 100%
-: 939:
20585: 940: if (subtree == NULL)
branch 0 taken 1% (fallthrough)
branch 1 taken 99%
43: 941: return NULL;
-: 942:
20542: 943: memcpy (subtree->name, name, len + 1);
call 0 returned 100%
-: 944:
20542: 945: return subtree;
-: 946:}
-: 947:
-: 948:static DBusObjectSubtree*
-: 949:_dbus_object_subtree_new (const char *name,
-: 950: const DBusObjectPathVTable *vtable,
-: 951: void *user_data)
function _dbus_object_subtree_new called 20585 returned 100% blocks executed 83%
20585: 952:{
-: 953: DBusObjectSubtree *subtree;
-: 954:
20585: 955: subtree = allocate_subtree_object (name);
call 0 returned 100%
20585: 956: if (subtree == NULL)
branch 0 taken 99% (fallthrough)
branch 1 taken 1%
43: 957: goto oom;
-: 958:
20542: 959: _dbus_assert (name != NULL);
call 0 returned 100%
-: 960:
20542: 961: subtree->parent = NULL;
-: 962:
20542: 963: if (vtable)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
-: 964: {
#####: 965: subtree->message_function = vtable->message_function;
#####: 966: subtree->unregister_function = vtable->unregister_function;
-: 967: }
-: 968: else
-: 969: {
20542: 970: subtree->message_function = NULL;
20542: 971: subtree->unregister_function = NULL;
-: 972: }
-: 973:
20542: 974: subtree->user_data = user_data;
20542: 975: subtree->refcount.value = 1;
20542: 976: subtree->subtrees = NULL;
20542: 977: subtree->n_subtrees = 0;
20542: 978: subtree->max_subtrees = 0;
20542: 979: subtree->invoke_as_fallback = FALSE;
-: 980:
20542: 981: return subtree;
-: 982:
43: 983: oom:
43: 984: if (subtree)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
-: 985: {
#####: 986: dbus_free (subtree);
call 0 never executed
-: 987: }
-: 988:
43: 989: return NULL;
-: 990:}
-: 991:
-: 992:static DBusObjectSubtree *
-: 993:_dbus_object_subtree_ref (DBusObjectSubtree *subtree)
function _dbus_object_subtree_ref called 1978 returned 100% blocks executed 100%
1978: 994:{
1978: 995: _dbus_assert (subtree->refcount.value > 0);
call 0 returned 100%
1978: 996: _dbus_atomic_inc (&subtree->refcount);
call 0 returned 100%
-: 997:
1978: 998: return subtree;
-: 999:}
-: 1000:
-: 1001:static void
-: 1002:_dbus_object_subtree_unref (DBusObjectSubtree *subtree)
function _dbus_object_subtree_unref called 20855 returned 100% blocks executed 100%
20855: 1003:{
20855: 1004: _dbus_assert (subtree->refcount.value > 0);
call 0 returned 100%
-: 1005:
20855: 1006: if (_dbus_atomic_dec (&subtree->refcount) == 1)
call 0 returned 100%
branch 1 taken 91% (fallthrough)
branch 2 taken 9%
-: 1007: {
18877: 1008: _dbus_assert (subtree->unregister_function == NULL);
call 0 returned 100%
18877: 1009: _dbus_assert (subtree->message_function == NULL);
call 0 returned 100%
-: 1010:
18877: 1011: dbus_free (subtree->subtrees);
call 0 returned 100%
18877: 1012: dbus_free (subtree);
call 0 returned 100%
-: 1013: }
20855: 1014:}
-: 1015:
-: 1016:/**
-: 1017: * Lists the registered fallback handlers and object path handlers at
-: 1018: * the given parent_path. The returned array should be freed with
-: 1019: * dbus_free_string_array().
-: 1020: *
-: 1021: * @param tree the object tree
-: 1022: * @param parent_path the path to list the child handlers of
-: 1023: * @param child_entries returns #NULL-terminated array of children
-: 1024: * @returns #FALSE if no memory to allocate the child entries
-: 1025: */
-: 1026:dbus_bool_t
-: 1027:_dbus_object_tree_list_registered_and_unlock (DBusObjectTree *tree,
-: 1028: const char **parent_path,
-: 1029: char ***child_entries)
function _dbus_object_tree_list_registered_and_unlock called 0 returned 0% blocks executed 0%
#####: 1030:{
-: 1031: dbus_bool_t result;
-: 1032:
#####: 1033: result = _dbus_object_tree_list_registered_unlocked (tree,
call 0 never executed
-: 1034: parent_path,
-: 1035: child_entries);
-: 1036:
-: 1037:#ifdef DBUS_BUILD_TESTS
#####: 1038: if (tree->connection)
branch 0 never executed
branch 1 never executed
-: 1039:#endif
-: 1040: {
#####: 1041: _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
call 0 never executed
#####: 1042: _dbus_connection_unlock (tree->connection);
call 0 never executed
-: 1043: }
-: 1044:
#####: 1045: return result;
-: 1046:}
-: 1047:
-: 1048:
-: 1049:/** Set to 1 to get a bunch of spew about disassembling the path string */
-: 1050:#define VERBOSE_DECOMPOSE 0
-: 1051:
-: 1052:/**
-: 1053: * Decompose an object path. A path of just "/" is
-: 1054: * represented as an empty vector of strings.
-: 1055: * The path need not be nul terminated.
-: 1056: *
-: 1057: * @param data the path data
-: 1058: * @param len the length of the path string
-: 1059: * @param path address to store new object path
-: 1060: * @param path_len length of stored path
-: 1061: */
-: 1062:dbus_bool_t
-: 1063:_dbus_decompose_path (const char* data,
-: 1064: int len,
-: 1065: char ***path,
-: 1066: int *path_len)
function _dbus_decompose_path called 3429 returned 100% blocks executed 97%
3429: 1067:{
-: 1068: char **retval;
-: 1069: int n_components;
-: 1070: int i, j, comp;
-: 1071:
3429: 1072: _dbus_assert (data != NULL);
call 0 returned 100%
-: 1073:
-: 1074:#if VERBOSE_DECOMPOSE
-: 1075: _dbus_verbose ("Decomposing path \"%s\"\n",
-: 1076: data);
-: 1077:#endif
-: 1078:
3429: 1079: n_components = 0;
3429: 1080: if (len > 1) /* if path is not just "/" */
branch 0 taken 90% (fallthrough)
branch 1 taken 10%
-: 1081: {
3069: 1082: i = 0;
48734: 1083: while (i < len)
branch 0 taken 93%
branch 1 taken 7% (fallthrough)
-: 1084: {
42596: 1085: if (data[i] == '/')
branch 0 taken 20% (fallthrough)
branch 1 taken 80%
8400: 1086: n_components += 1;
42596: 1087: ++i;
-: 1088: }
-: 1089: }
-: 1090:
3429: 1091: retval = dbus_new0 (char*, n_components + 1);
call 0 returned 100%
-: 1092:
3429: 1093: if (retval == NULL)
branch 0 taken 1% (fallthrough)
branch 1 taken 99%
9: 1094: return FALSE;
-: 1095:
3420: 1096: comp = 0;
3420: 1097: if (n_components == 0)
branch 0 taken 10% (fallthrough)
branch 1 taken 90%
359: 1098: i = 1;
-: 1099: else
3061: 1100: i = 0;
15178: 1101: while (comp < n_components)
branch 0 taken 71%
branch 1 taken 29% (fallthrough)
-: 1102: {
8358: 1103: _dbus_assert (i < len);
call 0 returned 100%
-: 1104:
8358: 1105: if (data[i] == '/')
branch 0 taken 100% (fallthrough)
branch 1 taken 0%
8358: 1106: ++i;
8358: 1107: j = i;
-: 1108:
50753: 1109: while (j < len && data[j] != '/')
branch 0 taken 93% (fallthrough)
branch 1 taken 7%
branch 2 taken 87%
branch 3 taken 13% (fallthrough)
34037: 1110: ++j;
-: 1111:
-: 1112: /* Now [i, j) is the path component */
8358: 1113: _dbus_assert (i < j);
call 0 returned 100%
8358: 1114: _dbus_assert (data[i] != '/');
call 0 returned 100%
8358: 1115: _dbus_assert (j == len || data[j] == '/');
branch 0 taken 64% (fallthrough)
branch 1 taken 36%
branch 2 taken 100% (fallthrough)
branch 3 taken 0%
call 4 returned 100%
-: 1116:
-: 1117:#if VERBOSE_DECOMPOSE
-: 1118: _dbus_verbose (" (component in [%d,%d))\n",
-: 1119: i, j);
-: 1120:#endif
-: 1121:
8358: 1122: retval[comp] = _dbus_memdup (&data[i], j - i + 1);
call 0 returned 100%
8358: 1123: if (retval[comp] == NULL)
branch 0 taken 1% (fallthrough)
branch 1 taken 99%
-: 1124: {
20: 1125: dbus_free_string_array (retval);
call 0 returned 100%
20: 1126: return FALSE;
-: 1127: }
8338: 1128: retval[comp][j-i] = '\0';
-: 1129:#if VERBOSE_DECOMPOSE
-: 1130: _dbus_verbose (" (component %d = \"%s\")\n",
-: 1131: comp, retval[comp]);
-: 1132:#endif
-: 1133:
8338: 1134: ++comp;
8338: 1135: i = j;
-: 1136: }
3400: 1137: _dbus_assert (i == len);
call 0 returned 100%
-: 1138:
3400: 1139: *path = retval;
3400: 1140: if (path_len)
branch 0 taken 49% (fallthrough)
branch 1 taken 51%
1663: 1141: *path_len = n_components;
-: 1142:
3400: 1143: return TRUE;
-: 1144:}
-: 1145:
-: 1146:/** @} */
-: 1147:
-: 1148:#ifdef DBUS_BUILD_TESTS
-: 1149:#include "dbus-test.h"
-: 1150:#include <stdio.h>
-: 1151:
-: 1152:static char*
-: 1153:flatten_path (const char **path)
function flatten_path called 990 returned 100% blocks executed 100%
990: 1154:{
-: 1155: DBusString str;
-: 1156: char *s;
-: 1157:
990: 1158: if (!_dbus_string_init (&str))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
9: 1159: return NULL;
-: 1160:
981: 1161: if (path[0] == NULL)
branch 0 taken 16% (fallthrough)
branch 1 taken 84%
-: 1162: {
154: 1163: if (!_dbus_string_append_byte (&str, '/'))
call 0 returned 100%
branch 1 taken 99% (fallthrough)
branch 2 taken 1%
1: 1164: goto nomem;
-: 1165: }
-: 1166: else
-: 1167: {
-: 1168: int i;
-: 1169:
827: 1170: i = 0;
3463: 1171: while (path[i])
branch 0 taken 70%
branch 1 taken 30% (fallthrough)
-: 1172: {
1847: 1173: if (!_dbus_string_append_byte (&str, '/'))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
19: 1174: goto nomem;
-: 1175:
1828: 1176: if (!_dbus_string_append (&str, path[i]))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
19: 1177: goto nomem;
-: 1178:
1809: 1179: ++i;
-: 1180: }
-: 1181: }
-: 1182:
942: 1183: if (!_dbus_string_steal_data (&str, &s))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
9: 1184: goto nomem;
-: 1185:
933: 1186: _dbus_string_free (&str);
call 0 returned 100%
-: 1187:
933: 1188: return s;
-: 1189:
48: 1190: nomem:
48: 1191: _dbus_string_free (&str);
call 0 returned 100%
48: 1192: return NULL;
-: 1193:}
-: 1194:
-: 1195:
-: 1196:typedef enum
-: 1197:{
-: 1198: STR_EQUAL,
-: 1199: STR_PREFIX,
-: 1200: STR_DIFFERENT
-: 1201:} StrComparison;
-: 1202:
-: 1203:/* Returns TRUE if container is a parent of child
-: 1204: */
-: 1205:static StrComparison
-: 1206:path_contains (const char **container,
-: 1207: const char **child)
function path_contains called 9538 returned 100% blocks executed 100%
9538: 1208:{
-: 1209: int i;
-: 1210:
9538: 1211: i = 0;
27463: 1212: while (child[i] != NULL)
branch 0 taken 74%
branch 1 taken 26% (fallthrough)
-: 1213: {
-: 1214: int v;
-: 1215:
13271: 1216: if (container[i] == NULL)
branch 0 taken 11% (fallthrough)
branch 1 taken 89%
1442: 1217: return STR_PREFIX; /* container ran out, child continues;
-: 1218: * thus the container is a parent of the
-: 1219: * child.
-: 1220: */
-: 1221:
11829: 1222: _dbus_assert (container[i] != NULL);
call 0 returned 100%
11829: 1223: _dbus_assert (child[i] != NULL);
call 0 returned 100%
-: 1224:
11829: 1225: v = strcmp (container[i], child[i]);
call 0 returned 100%
-: 1226:
11829: 1227: if (v != 0)
branch 0 taken 29% (fallthrough)
branch 1 taken 71%
3442: 1228: return STR_DIFFERENT; /* they overlap until here and then are different,
-: 1229: * not overlapping
-: 1230: */
-: 1231:
8387: 1232: ++i;
-: 1233: }
-: 1234:
-: 1235: /* Child ran out; if container also did, they are equal;
-: 1236: * otherwise, the child is a parent of the container.
-: 1237: */
4654: 1238: if (container[i] == NULL)
branch 0 taken 55% (fallthrough)
branch 1 taken 45%
2538: 1239: return STR_EQUAL;
-: 1240: else
2116: 1241: return STR_DIFFERENT;
-: 1242:}
-: 1243:
-: 1244:#if 0
-: 1245:static void
-: 1246:spew_subtree_recurse (DBusObjectSubtree *subtree,
-: 1247: int indent)
-: 1248:{
-: 1249: int i;
-: 1250:
-: 1251: i = 0;
-: 1252: while (i < indent)
-: 1253: {
-: 1254: _dbus_verbose (" ");
-: 1255: ++i;
-: 1256: }
-: 1257:
-: 1258: _dbus_verbose ("%s (%d children)\n",
-: 1259: subtree->name, subtree->n_subtrees);
-: 1260:
-: 1261: i = 0;
-: 1262: while (i < subtree->n_subtrees)
-: 1263: {
-: 1264: spew_subtree_recurse (subtree->subtrees[i], indent + 2);
-: 1265:
-: 1266: ++i;
-: 1267: }
-: 1268:}
-: 1269:
-: 1270:static void
-: 1271:spew_tree (DBusObjectTree *tree)
-: 1272:{
-: 1273: spew_subtree_recurse (tree->root, 0);
-: 1274:}
-: 1275:#endif
-: 1276:
-: 1277:/**
-: 1278: * Callback data used in tests
-: 1279: */
-: 1280:typedef struct
-: 1281:{
-: 1282: const char **path; /**< Path */
-: 1283: dbus_bool_t handler_fallback; /**< true if the handler may be called as fallback */
-: 1284: dbus_bool_t message_handled; /**< Gets set to true if message handler called */
-: 1285: dbus_bool_t handler_unregistered; /**< gets set to true if handler is unregistered */
-: 1286:} TreeTestData;
-: 1287:
-: 1288:
-: 1289:static void
-: 1290:test_unregister_function (DBusConnection *connection,
-: 1291: void *user_data)
function test_unregister_function called 4723 returned 100% blocks executed 100%
4723: 1292:{
4723: 1293: TreeTestData *ttd = user_data;
-: 1294:
4723: 1295: ttd->handler_unregistered = TRUE;
4723: 1296:}
-: 1297:
-: 1298:static DBusHandlerResult
-: 1299:test_message_function (DBusConnection *connection,
-: 1300: DBusMessage *message,
-: 1301: void *user_data)
function test_message_function called 1932 returned 100% blocks executed 100%
1932: 1302:{
1932: 1303: TreeTestData *ttd = user_data;
-: 1304:
1932: 1305: ttd->message_handled = TRUE;
-: 1306:
1932: 1307: return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-: 1308:}
-: 1309:
-: 1310:static dbus_bool_t
-: 1311:do_register (DBusObjectTree *tree,
-: 1312: const char **path,
-: 1313: dbus_bool_t fallback,
-: 1314: int i,
-: 1315: TreeTestData *tree_test_data)
function do_register called 4771 returned 100% blocks executed 100%
4771: 1316:{
-: 1317: DBusObjectPathVTable vtable = { test_unregister_function,
4771: 1318: test_message_function, NULL };
-: 1319:
4771: 1320: tree_test_data[i].message_handled = FALSE;
4771: 1321: tree_test_data[i].handler_unregistered = FALSE;
4771: 1322: tree_test_data[i].handler_fallback = fallback;
4771: 1323: tree_test_data[i].path = path;
-: 1324:
4771: 1325: if (!_dbus_object_tree_register (tree, fallback, path,
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
-: 1326: &vtable,
-: 1327: &tree_test_data[i]))
48: 1328: return FALSE;
-: 1329:
4723: 1330: _dbus_assert (_dbus_object_tree_get_user_data_unlocked (tree, path) ==
call 0 returned 100%
call 1 returned 100%
-: 1331: &tree_test_data[i]);
-: 1332:
4723: 1333: return TRUE;
-: 1334:}
-: 1335:
-: 1336:static dbus_bool_t
-: 1337:do_test_dispatch (DBusObjectTree *tree,
-: 1338: const char **path,
-: 1339: int i,
-: 1340: TreeTestData *tree_test_data,
-: 1341: int n_test_data)
function do_test_dispatch called 990 returned 100% blocks executed 97%
990: 1342:{
-: 1343: DBusMessage *message;
-: 1344: int j;
-: 1345: DBusHandlerResult result;
-: 1346: char *flat;
-: 1347:
990: 1348: message = NULL;
-: 1349:
990: 1350: flat = flatten_path (path);
call 0 returned 100%
990: 1351: if (flat == NULL)
branch 0 taken 94% (fallthrough)
branch 1 taken 6%
57: 1352: goto oom;
-: 1353:
933: 1354: message = dbus_message_new_method_call (NULL,
call 0 returned 100%
-: 1355: flat,
-: 1356: "org.freedesktop.TestInterface",
-: 1357: "Foo");
933: 1358: dbus_free (flat);
call 0 returned 100%
933: 1359: if (message == NULL)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
#####: 1360: goto oom;
-: 1361:
933: 1362: j = 0;
10263: 1363: while (j < n_test_data)
branch 0 taken 90%
branch 1 taken 10% (fallthrough)
-: 1364: {
8397: 1365: tree_test_data[j].message_handled = FALSE;
8397: 1366: ++j;
-: 1367: }
-: 1368:
933: 1369: result = _dbus_object_tree_dispatch_and_unlock (tree, message);
call 0 returned 100%
933: 1370: if (result == DBUS_HANDLER_RESULT_NEED_MEMORY)
branch 0 taken 6% (fallthrough)
branch 1 taken 94%
58: 1371: goto oom;
-: 1372:
875: 1373: _dbus_assert (tree_test_data[i].message_handled);
call 0 returned 100%
-: 1374:
875: 1375: j = 0;
9625: 1376: while (j < n_test_data)
branch 0 taken 90%
branch 1 taken 10% (fallthrough)
-: 1377: {
7875: 1378: if (tree_test_data[j].message_handled)
branch 0 taken 25% (fallthrough)
branch 1 taken 75%
-: 1379: {
1932: 1380: if (tree_test_data[j].handler_fallback)
branch 0 taken 89% (fallthrough)
branch 1 taken 11%
1718: 1381: _dbus_assert (path_contains (tree_test_data[j].path,
call 0 returned 100%
call 1 returned 100%
-: 1382: path) != STR_DIFFERENT);
-: 1383: else
214: 1384: _dbus_assert (path_contains (tree_test_data[j].path, path) == STR_EQUAL);
call 0 returned 100%
call 1 returned 100%
-: 1385: }
-: 1386: else
-: 1387: {
5943: 1388: if (tree_test_data[j].handler_fallback)
branch 0 taken 74% (fallthrough)
branch 1 taken 26%
4407: 1389: _dbus_assert (path_contains (tree_test_data[j].path,
call 0 returned 100%
call 1 returned 100%
-: 1390: path) == STR_DIFFERENT);
-: 1391: else
1536: 1392: _dbus_assert (path_contains (tree_test_data[j].path, path) != STR_EQUAL);
call 0 returned 100%
call 1 returned 100%
-: 1393: }
-: 1394:
7875: 1395: ++j;
-: 1396: }
-: 1397:
875: 1398: dbus_message_unref (message);
call 0 returned 100%
-: 1399:
875: 1400: return TRUE;
-: 1401:
115: 1402: oom:
115: 1403: if (message)
branch 0 taken 50% (fallthrough)
branch 1 taken 50%
58: 1404: dbus_message_unref (message);
call 0 returned 100%
115: 1405: return FALSE;
-: 1406:}
-: 1407:
-: 1408:static size_t
-: 1409:string_array_length (const char **array)
function string_array_length called 4048 returned 100% blocks executed 100%
4048: 1410:{
-: 1411: size_t i;
4048: 1412: for (i = 0; array[i]; i++) ;
branch 0 taken 70%
branch 1 taken 30% (fallthrough)
4048: 1413: return i;
-: 1414:}
-: 1415:
-: 1416:typedef struct
-: 1417:{
-: 1418: const char *path;
-: 1419: const char *result[20];
-: 1420:} DecomposePathTest;
-: 1421:
-: 1422:static DecomposePathTest decompose_tests[] = {
-: 1423: { "/foo", { "foo", NULL } },
-: 1424: { "/foo/bar", { "foo", "bar", NULL } },
-: 1425: { "/", { NULL } },
-: 1426: { "/a/b", { "a", "b", NULL } },
-: 1427: { "/a/b/c", { "a", "b", "c", NULL } },
-: 1428: { "/a/b/c/d", { "a", "b", "c", "d", NULL } },
-: 1429: { "/foo/bar/q", { "foo", "bar", "q", NULL } },
-: 1430: { "/foo/bar/this/is/longer", { "foo", "bar", "this", "is", "longer", NULL } }
-: 1431:};
-: 1432:
-: 1433:static dbus_bool_t
-: 1434:run_decompose_tests (void)
function run_decompose_tests called 208 returned 100% blocks executed 57%
208: 1435:{
-: 1436: int i;
-: 1437:
208: 1438: i = 0;
2079: 1439: while (i < _DBUS_N_ELEMENTS (decompose_tests))
branch 0 taken 89%
branch 1 taken 11% (fallthrough)
-: 1440: {
-: 1441: char **result;
-: 1442: int result_len;
-: 1443: int expected_len;
-: 1444:
1664: 1445: if (!_dbus_decompose_path (decompose_tests[i].path,
call 0 returned 100%
call 1 returned 100%
branch 2 taken 1% (fallthrough)
branch 3 taken 99%
-: 1446: strlen (decompose_tests[i].path),
-: 1447: &result, &result_len))
1: 1448: return FALSE;
-: 1449:
1663: 1450: expected_len = string_array_length (decompose_tests[i].result);
call 0 returned 100%
-: 1451:
1663: 1452: if (result_len != (int) string_array_length ((const char**)result) ||
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
branch 6 taken 0% (fallthrough)
branch 7 taken 100%
-: 1453: expected_len != result_len ||
-: 1454: path_contains (decompose_tests[i].result,
-: 1455: (const char**) result) != STR_EQUAL)
-: 1456: {
#####: 1457: int real_len = string_array_length ((const char**)result);
call 0 never executed
#####: 1458: _dbus_warn ("Expected decompose of %s to have len %d, returned %d, appears to have %d\n",
call 0 never executed
-: 1459: decompose_tests[i].path, expected_len, result_len,
-: 1460: real_len);
#####: 1461: _dbus_warn ("Decompose resulted in elements: { ");
call 0 never executed
#####: 1462: i = 0;
#####: 1463: while (i < real_len)
branch 0 never executed
branch 1 never executed
-: 1464: {
#####: 1465: _dbus_warn ("\"%s\"%s", result[i],
branch 0 never executed
branch 1 never executed
call 2 never executed
-: 1466: (i + 1) == real_len ? "" : ", ");
#####: 1467: ++i;
-: 1468: }
#####: 1469: _dbus_warn ("}\n");
call 0 never executed
#####: 1470: _dbus_assert_not_reached ("path decompose failed\n");
call 0 never executed
-: 1471: }
-: 1472:
1663: 1473: dbus_free_string_array (result);
call 0 returned 100%
-: 1474:
1663: 1475: ++i;
-: 1476: }
-: 1477:
207: 1478: return TRUE;
-: 1479:}
-: 1480:
-: 1481:static dbus_bool_t
-: 1482:object_tree_test_iteration (void *data)
function object_tree_test_iteration called 208 returned 100% blocks executed 94%
208: 1483:{
208: 1484: const char *path0[] = { NULL };
208: 1485: const char *path1[] = { "foo", NULL };
208: 1486: const char *path2[] = { "foo", "bar", NULL };
208: 1487: const char *path3[] = { "foo", "bar", "baz", NULL };
208: 1488: const char *path4[] = { "foo", "bar", "boo", NULL };
208: 1489: const char *path5[] = { "blah", NULL };
208: 1490: const char *path6[] = { "blah", "boof", NULL };
208: 1491: const char *path7[] = { "blah", "boof", "this", "is", "really", "long", NULL };
208: 1492: const char *path8[] = { "childless", NULL };
-: 1493: DBusObjectTree *tree;
-: 1494: TreeTestData tree_test_data[9];
-: 1495: int i;
-: 1496: dbus_bool_t exact_match;
-: 1497:
208: 1498: if (!run_decompose_tests ())
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
1: 1499: return FALSE;
-: 1500:
207: 1501: tree = NULL;
-: 1502:
207: 1503: tree = _dbus_object_tree_new (NULL);
call 0 returned 100%
207: 1504: if (tree == NULL)
branch 0 taken 1% (fallthrough)
branch 1 taken 99%
2: 1505: goto out;
-: 1506:
205: 1507: if (!do_register (tree, path0, TRUE, 0, tree_test_data))
call 0 returned 100%
branch 1 taken 0% (fallthrough)
branch 2 taken 100%
#####: 1508: goto out;
-: 1509:
205: 1510: _dbus_assert (find_subtree (tree, path0, NULL));
call 0 returned 100%
call 1 returned 100%
205: 1511: _dbus_assert (!find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
205: 1512: _dbus_assert (!find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
205: 1513: _dbus_assert (!find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
205: 1514: _dbus_assert (!find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
205: 1515: _dbus_assert (!find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
205: 1516: _dbus_assert (!find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
205: 1517: _dbus_assert (!find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
205: 1518: _dbus_assert (!find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1519:
205: 1520: _dbus_assert (find_handler (tree, path0, &exact_match) && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
205: 1521: _dbus_assert (find_handler (tree, path1, &exact_match) == tree->root && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
205: 1522: _dbus_assert (find_handler (tree, path2, &exact_match) == tree->root && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
205: 1523: _dbus_assert (find_handler (tree, path3, &exact_match) == tree->root && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
205: 1524: _dbus_assert (find_handler (tree, path4, &exact_match) == tree->root && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
205: 1525: _dbus_assert (find_handler (tree, path5, &exact_match) == tree->root && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
205: 1526: _dbus_assert (find_handler (tree, path6, &exact_match) == tree->root && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
205: 1527: _dbus_assert (find_handler (tree, path7, &exact_match) == tree->root && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
205: 1528: _dbus_assert (find_handler (tree, path8, &exact_match) == tree->root && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
-: 1529:
205: 1530: if (!do_register (tree, path1, TRUE, 1, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
2: 1531: goto out;
-: 1532:
203: 1533: _dbus_assert (find_subtree (tree, path0, NULL));
call 0 returned 100%
call 1 returned 100%
203: 1534: _dbus_assert (find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
203: 1535: _dbus_assert (!find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
203: 1536: _dbus_assert (!find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
203: 1537: _dbus_assert (!find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
203: 1538: _dbus_assert (!find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
203: 1539: _dbus_assert (!find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
203: 1540: _dbus_assert (!find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
203: 1541: _dbus_assert (!find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1542:
203: 1543: _dbus_assert (find_handler (tree, path0, &exact_match) && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
203: 1544: _dbus_assert (find_handler (tree, path1, &exact_match) && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
203: 1545: _dbus_assert (find_handler (tree, path2, &exact_match) && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
203: 1546: _dbus_assert (find_handler (tree, path3, &exact_match) && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
203: 1547: _dbus_assert (find_handler (tree, path4, &exact_match) && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
203: 1548: _dbus_assert (find_handler (tree, path5, &exact_match) == tree->root && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
203: 1549: _dbus_assert (find_handler (tree, path6, &exact_match) == tree->root && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
203: 1550: _dbus_assert (find_handler (tree, path7, &exact_match) == tree->root && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
203: 1551: _dbus_assert (find_handler (tree, path8, &exact_match) == tree->root && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
-: 1552:
203: 1553: if (!do_register (tree, path2, TRUE, 2, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
2: 1554: goto out;
-: 1555:
201: 1556: _dbus_assert (find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
201: 1557: _dbus_assert (find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
201: 1558: _dbus_assert (!find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
201: 1559: _dbus_assert (!find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
201: 1560: _dbus_assert (!find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
201: 1561: _dbus_assert (!find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
201: 1562: _dbus_assert (!find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
201: 1563: _dbus_assert (!find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1564:
201: 1565: if (!do_register (tree, path3, TRUE, 3, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
2: 1566: goto out;
-: 1567:
199: 1568: _dbus_assert (find_subtree (tree, path0, NULL));
call 0 returned 100%
call 1 returned 100%
199: 1569: _dbus_assert (find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
199: 1570: _dbus_assert (find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
199: 1571: _dbus_assert (find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
199: 1572: _dbus_assert (!find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
199: 1573: _dbus_assert (!find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
199: 1574: _dbus_assert (!find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
199: 1575: _dbus_assert (!find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
199: 1576: _dbus_assert (!find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1577:
199: 1578: if (!do_register (tree, path4, TRUE, 4, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
2: 1579: goto out;
-: 1580:
197: 1581: _dbus_assert (find_subtree (tree, path0, NULL));
call 0 returned 100%
call 1 returned 100%
197: 1582: _dbus_assert (find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
197: 1583: _dbus_assert (find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
197: 1584: _dbus_assert (find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
197: 1585: _dbus_assert (find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
197: 1586: _dbus_assert (!find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
197: 1587: _dbus_assert (!find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
197: 1588: _dbus_assert (!find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
197: 1589: _dbus_assert (!find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1590:
197: 1591: if (!do_register (tree, path5, TRUE, 5, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
2: 1592: goto out;
-: 1593:
195: 1594: _dbus_assert (find_subtree (tree, path0, NULL));
call 0 returned 100%
call 1 returned 100%
195: 1595: _dbus_assert (find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
195: 1596: _dbus_assert (find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
195: 1597: _dbus_assert (find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
195: 1598: _dbus_assert (find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
195: 1599: _dbus_assert (find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
195: 1600: _dbus_assert (!find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
195: 1601: _dbus_assert (!find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
195: 1602: _dbus_assert (!find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1603:
195: 1604: _dbus_assert (find_handler (tree, path0, &exact_match) == tree->root && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
195: 1605: _dbus_assert (find_handler (tree, path1, &exact_match) != tree->root && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
195: 1606: _dbus_assert (find_handler (tree, path2, &exact_match) != tree->root && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
195: 1607: _dbus_assert (find_handler (tree, path3, &exact_match) != tree->root && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
195: 1608: _dbus_assert (find_handler (tree, path4, &exact_match) != tree->root && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
195: 1609: _dbus_assert (find_handler (tree, path5, &exact_match) != tree->root && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
195: 1610: _dbus_assert (find_handler (tree, path6, &exact_match) != tree->root && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
195: 1611: _dbus_assert (find_handler (tree, path7, &exact_match) != tree->root && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
195: 1612: _dbus_assert (find_handler (tree, path8, &exact_match) == tree->root && !exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
-: 1613:
195: 1614: if (!do_register (tree, path6, TRUE, 6, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
2: 1615: goto out;
-: 1616:
193: 1617: _dbus_assert (find_subtree (tree, path0, NULL));
call 0 returned 100%
call 1 returned 100%
193: 1618: _dbus_assert (find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
193: 1619: _dbus_assert (find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
193: 1620: _dbus_assert (find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
193: 1621: _dbus_assert (find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
193: 1622: _dbus_assert (find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
193: 1623: _dbus_assert (find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
193: 1624: _dbus_assert (!find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
193: 1625: _dbus_assert (!find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1626:
193: 1627: if (!do_register (tree, path7, TRUE, 7, tree_test_data))
call 0 returned 100%
branch 1 taken 4% (fallthrough)
branch 2 taken 96%
8: 1628: goto out;
-: 1629:
185: 1630: _dbus_assert (find_subtree (tree, path0, NULL));
call 0 returned 100%
call 1 returned 100%
185: 1631: _dbus_assert (find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
185: 1632: _dbus_assert (find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
185: 1633: _dbus_assert (find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
185: 1634: _dbus_assert (find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
185: 1635: _dbus_assert (find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
185: 1636: _dbus_assert (find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
185: 1637: _dbus_assert (find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
185: 1638: _dbus_assert (!find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1639:
185: 1640: if (!do_register (tree, path8, TRUE, 8, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
2: 1641: goto out;
-: 1642:
183: 1643: _dbus_assert (find_subtree (tree, path0, NULL));
call 0 returned 100%
call 1 returned 100%
183: 1644: _dbus_assert (find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
183: 1645: _dbus_assert (find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
183: 1646: _dbus_assert (find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
183: 1647: _dbus_assert (find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
183: 1648: _dbus_assert (find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
183: 1649: _dbus_assert (find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
183: 1650: _dbus_assert (find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
183: 1651: _dbus_assert (find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1652:
183: 1653: _dbus_assert (find_handler (tree, path0, &exact_match) == tree->root && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
183: 1654: _dbus_assert (find_handler (tree, path1, &exact_match) != tree->root && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
183: 1655: _dbus_assert (find_handler (tree, path2, &exact_match) != tree->root && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
183: 1656: _dbus_assert (find_handler (tree, path3, &exact_match) != tree->root && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
183: 1657: _dbus_assert (find_handler (tree, path4, &exact_match) != tree->root && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
183: 1658: _dbus_assert (find_handler (tree, path5, &exact_match) != tree->root && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
183: 1659: _dbus_assert (find_handler (tree, path6, &exact_match) != tree->root && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
183: 1660: _dbus_assert (find_handler (tree, path7, &exact_match) != tree->root && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
183: 1661: _dbus_assert (find_handler (tree, path8, &exact_match) != tree->root && exact_match);
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
branch 3 taken 100% (fallthrough)
branch 4 taken 0%
call 5 returned 100%
-: 1662:
-: 1663: /* test the list_registered function */
-: 1664:
-: 1665: {
183: 1666: const char *root[] = { NULL };
-: 1667: char **child_entries;
-: 1668: int nb;
-: 1669:
183: 1670: _dbus_object_tree_list_registered_unlocked (tree, path1, &child_entries);
call 0 returned 100%
183: 1671: if (child_entries != NULL)
branch 0 taken 99% (fallthrough)
branch 1 taken 1%
-: 1672: {
181: 1673: nb = string_array_length ((const char**)child_entries);
call 0 returned 100%
181: 1674: _dbus_assert (nb == 1);
call 0 returned 100%
181: 1675: dbus_free_string_array (child_entries);
call 0 returned 100%
-: 1676: }
-: 1677:
183: 1678: _dbus_object_tree_list_registered_unlocked (tree, path2, &child_entries);
call 0 returned 100%
183: 1679: if (child_entries != NULL)
branch 0 taken 98% (fallthrough)
branch 1 taken 2%
-: 1680: {
180: 1681: nb = string_array_length ((const char**)child_entries);
call 0 returned 100%
180: 1682: _dbus_assert (nb == 2);
call 0 returned 100%
180: 1683: dbus_free_string_array (child_entries);
call 0 returned 100%
-: 1684: }
-: 1685:
183: 1686: _dbus_object_tree_list_registered_unlocked (tree, path8, &child_entries);
call 0 returned 100%
183: 1687: if (child_entries != NULL)
branch 0 taken 99% (fallthrough)
branch 1 taken 1%
-: 1688: {
182: 1689: nb = string_array_length ((const char**)child_entries);
call 0 returned 100%
182: 1690: _dbus_assert (nb == 0);
call 0 returned 100%
182: 1691: dbus_free_string_array (child_entries);
call 0 returned 100%
-: 1692: }
-: 1693:
183: 1694: _dbus_object_tree_list_registered_unlocked (tree, root, &child_entries);
call 0 returned 100%
183: 1695: if (child_entries != NULL)
branch 0 taken 98% (fallthrough)
branch 1 taken 2%
-: 1696: {
179: 1697: nb = string_array_length ((const char**)child_entries);
call 0 returned 100%
179: 1698: _dbus_assert (nb == 3);
call 0 returned 100%
179: 1699: dbus_free_string_array (child_entries);
call 0 returned 100%
-: 1700: }
-: 1701: }
-: 1702:
-: 1703: /* Check that destroying tree calls unregister funcs */
183: 1704: _dbus_object_tree_unref (tree);
call 0 returned 100%
-: 1705:
183: 1706: i = 0;
2013: 1707: while (i < (int) _DBUS_N_ELEMENTS (tree_test_data))
branch 0 taken 90%
branch 1 taken 10% (fallthrough)
-: 1708: {
1647: 1709: _dbus_assert (tree_test_data[i].handler_unregistered);
call 0 returned 100%
1647: 1710: _dbus_assert (!tree_test_data[i].message_handled);
call 0 returned 100%
1647: 1711: ++i;
-: 1712: }
-: 1713:
-: 1714: /* Now start again and try the individual unregister function */
183: 1715: tree = _dbus_object_tree_new (NULL);
call 0 returned 100%
183: 1716: if (tree == NULL)
branch 0 taken 1% (fallthrough)
branch 1 taken 99%
2: 1717: goto out;
-: 1718:
181: 1719: if (!do_register (tree, path0, TRUE, 0, tree_test_data))
call 0 returned 100%
branch 1 taken 0% (fallthrough)
branch 2 taken 100%
#####: 1720: goto out;
181: 1721: if (!do_register (tree, path1, TRUE, 1, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
2: 1722: goto out;
179: 1723: if (!do_register (tree, path2, TRUE, 2, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
2: 1724: goto out;
177: 1725: if (!do_register (tree, path3, TRUE, 3, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
2: 1726: goto out;
175: 1727: if (!do_register (tree, path4, TRUE, 4, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
2: 1728: goto out;
173: 1729: if (!do_register (tree, path5, TRUE, 5, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
2: 1730: goto out;
171: 1731: if (!do_register (tree, path6, TRUE, 6, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
2: 1732: goto out;
169: 1733: if (!do_register (tree, path7, TRUE, 7, tree_test_data))
call 0 returned 100%
branch 1 taken 5% (fallthrough)
branch 2 taken 95%
8: 1734: goto out;
161: 1735: if (!do_register (tree, path8, TRUE, 8, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
2: 1736: goto out;
-: 1737:
159: 1738: _dbus_object_tree_unregister_and_unlock (tree, path0);
call 0 returned 100%
159: 1739: _dbus_assert (_dbus_object_tree_get_user_data_unlocked (tree, path0) == NULL);
call 0 returned 100%
call 1 returned 100%
-: 1740:
159: 1741: _dbus_assert (!find_subtree (tree, path0, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1742: _dbus_assert (find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1743: _dbus_assert (find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1744: _dbus_assert (find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1745: _dbus_assert (find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1746: _dbus_assert (find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1747: _dbus_assert (find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1748: _dbus_assert (find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1749: _dbus_assert (find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1750:
159: 1751: _dbus_object_tree_unregister_and_unlock (tree, path1);
call 0 returned 100%
159: 1752: _dbus_assert (_dbus_object_tree_get_user_data_unlocked (tree, path1) == NULL);
call 0 returned 100%
call 1 returned 100%
-: 1753:
159: 1754: _dbus_assert (!find_subtree (tree, path0, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1755: _dbus_assert (!find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1756: _dbus_assert (find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1757: _dbus_assert (find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1758: _dbus_assert (find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1759: _dbus_assert (find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1760: _dbus_assert (find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1761: _dbus_assert (find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1762: _dbus_assert (find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1763:
159: 1764: _dbus_object_tree_unregister_and_unlock (tree, path2);
call 0 returned 100%
159: 1765: _dbus_assert (_dbus_object_tree_get_user_data_unlocked (tree, path2) == NULL);
call 0 returned 100%
call 1 returned 100%
-: 1766:
159: 1767: _dbus_assert (!find_subtree (tree, path0, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1768: _dbus_assert (!find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1769: _dbus_assert (!find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1770: _dbus_assert (find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1771: _dbus_assert (find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1772: _dbus_assert (find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1773: _dbus_assert (find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1774: _dbus_assert (find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1775: _dbus_assert (find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1776:
159: 1777: _dbus_object_tree_unregister_and_unlock (tree, path3);
call 0 returned 100%
159: 1778: _dbus_assert (_dbus_object_tree_get_user_data_unlocked (tree, path3) == NULL);
call 0 returned 100%
call 1 returned 100%
-: 1779:
159: 1780: _dbus_assert (!find_subtree (tree, path0, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1781: _dbus_assert (!find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1782: _dbus_assert (!find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1783: _dbus_assert (!find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1784: _dbus_assert (find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1785: _dbus_assert (find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1786: _dbus_assert (find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1787: _dbus_assert (find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1788: _dbus_assert (find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1789:
159: 1790: _dbus_object_tree_unregister_and_unlock (tree, path4);
call 0 returned 100%
159: 1791: _dbus_assert (_dbus_object_tree_get_user_data_unlocked (tree, path4) == NULL);
call 0 returned 100%
call 1 returned 100%
-: 1792:
159: 1793: _dbus_assert (!find_subtree (tree, path0, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1794: _dbus_assert (!find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1795: _dbus_assert (!find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1796: _dbus_assert (!find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1797: _dbus_assert (!find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1798: _dbus_assert (find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1799: _dbus_assert (find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1800: _dbus_assert (find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1801: _dbus_assert (find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1802:
159: 1803: _dbus_object_tree_unregister_and_unlock (tree, path5);
call 0 returned 100%
159: 1804: _dbus_assert (_dbus_object_tree_get_user_data_unlocked (tree, path5) == NULL);
call 0 returned 100%
call 1 returned 100%
-: 1805:
159: 1806: _dbus_assert (!find_subtree (tree, path0, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1807: _dbus_assert (!find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1808: _dbus_assert (!find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1809: _dbus_assert (!find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1810: _dbus_assert (!find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1811: _dbus_assert (!find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1812: _dbus_assert (find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1813: _dbus_assert (find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1814: _dbus_assert (find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1815:
159: 1816: _dbus_object_tree_unregister_and_unlock (tree, path6);
call 0 returned 100%
159: 1817: _dbus_assert (_dbus_object_tree_get_user_data_unlocked (tree, path6) == NULL);
call 0 returned 100%
call 1 returned 100%
-: 1818:
159: 1819: _dbus_assert (!find_subtree (tree, path0, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1820: _dbus_assert (!find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1821: _dbus_assert (!find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1822: _dbus_assert (!find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1823: _dbus_assert (!find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1824: _dbus_assert (!find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1825: _dbus_assert (!find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1826: _dbus_assert (find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1827: _dbus_assert (find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1828:
159: 1829: _dbus_object_tree_unregister_and_unlock (tree, path7);
call 0 returned 100%
159: 1830: _dbus_assert (_dbus_object_tree_get_user_data_unlocked (tree, path7) == NULL);
call 0 returned 100%
call 1 returned 100%
-: 1831:
159: 1832: _dbus_assert (!find_subtree (tree, path0, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1833: _dbus_assert (!find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1834: _dbus_assert (!find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1835: _dbus_assert (!find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1836: _dbus_assert (!find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1837: _dbus_assert (!find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1838: _dbus_assert (!find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1839: _dbus_assert (!find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1840: _dbus_assert (find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1841:
159: 1842: _dbus_object_tree_unregister_and_unlock (tree, path8);
call 0 returned 100%
159: 1843: _dbus_assert (_dbus_object_tree_get_user_data_unlocked (tree, path8) == NULL);
call 0 returned 100%
call 1 returned 100%
-: 1844:
159: 1845: _dbus_assert (!find_subtree (tree, path0, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1846: _dbus_assert (!find_subtree (tree, path1, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1847: _dbus_assert (!find_subtree (tree, path2, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1848: _dbus_assert (!find_subtree (tree, path3, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1849: _dbus_assert (!find_subtree (tree, path4, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1850: _dbus_assert (!find_subtree (tree, path5, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1851: _dbus_assert (!find_subtree (tree, path6, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1852: _dbus_assert (!find_subtree (tree, path7, NULL));
call 0 returned 100%
call 1 returned 100%
159: 1853: _dbus_assert (!find_subtree (tree, path8, NULL));
call 0 returned 100%
call 1 returned 100%
-: 1854:
159: 1855: i = 0;
1749: 1856: while (i < (int) _DBUS_N_ELEMENTS (tree_test_data))
branch 0 taken 90%
branch 1 taken 10% (fallthrough)
-: 1857: {
1431: 1858: _dbus_assert (tree_test_data[i].handler_unregistered);
call 0 returned 100%
1431: 1859: _dbus_assert (!tree_test_data[i].message_handled);
call 0 returned 100%
1431: 1860: ++i;
-: 1861: }
-: 1862:
-: 1863: /* Register it all again, and test dispatch */
-: 1864:
159: 1865: if (!do_register (tree, path0, TRUE, 0, tree_test_data))
call 0 returned 100%
branch 1 taken 0% (fallthrough)
branch 2 taken 100%
#####: 1866: goto out;
159: 1867: if (!do_register (tree, path1, FALSE, 1, tree_test_data))
call 0 returned 100%
branch 1 taken 0% (fallthrough)
branch 2 taken 100%
#####: 1868: goto out;
159: 1869: if (!do_register (tree, path2, TRUE, 2, tree_test_data))
call 0 returned 100%
branch 1 taken 0% (fallthrough)
branch 2 taken 100%
#####: 1870: goto out;
159: 1871: if (!do_register (tree, path3, TRUE, 3, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
1: 1872: goto out;
158: 1873: if (!do_register (tree, path4, TRUE, 4, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
1: 1874: goto out;
157: 1875: if (!do_register (tree, path5, TRUE, 5, tree_test_data))
call 0 returned 100%
branch 1 taken 0% (fallthrough)
branch 2 taken 100%
#####: 1876: goto out;
157: 1877: if (!do_register (tree, path6, FALSE, 6, tree_test_data))
call 0 returned 100%
branch 1 taken 0% (fallthrough)
branch 2 taken 100%
#####: 1878: goto out;
157: 1879: if (!do_register (tree, path7, TRUE, 7, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
1: 1880: goto out;
156: 1881: if (!do_register (tree, path8, TRUE, 8, tree_test_data))
call 0 returned 100%
branch 1 taken 1% (fallthrough)
branch 2 taken 99%
1: 1882: goto out;
-: 1883:
-: 1884:#if 0
-: 1885: spew_tree (tree);
-: 1886:#endif
-: 1887:
155: 1888: if (!do_test_dispatch (tree, path0, 0, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data)))
call 0 returned 100%
branch 1 taken 4% (fallthrough)
branch 2 taken 96%
6: 1889: goto out;
149: 1890: if (!do_test_dispatch (tree, path1, 1, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data)))
call 0 returned 100%
branch 1 taken 6% (fallthrough)
branch 2 taken 94%
9: 1891: goto out;
140: 1892: if (!do_test_dispatch (tree, path2, 2, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data)))
call 0 returned 100%
branch 1 taken 9% (fallthrough)
branch 2 taken 91%
12: 1893: goto out;
128: 1894: if (!do_test_dispatch (tree, path3, 3, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data)))
call 0 returned 100%
branch 1 taken 13% (fallthrough)
branch 2 taken 88%
16: 1895: goto out;
112: 1896: if (!do_test_dispatch (tree, path4, 4, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data)))
call 0 returned 100%
branch 1 taken 14% (fallthrough)
branch 2 taken 86%
16: 1897: goto out;
96: 1898: if (!do_test_dispatch (tree, path5, 5, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data)))
call 0 returned 100%
branch 1 taken 9% (fallthrough)
branch 2 taken 91%
9: 1899: goto out;
87: 1900: if (!do_test_dispatch (tree, path6, 6, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data)))
call 0 returned 100%
branch 1 taken 15% (fallthrough)
branch 2 taken 85%
13: 1901: goto out;
74: 1902: if (!do_test_dispatch (tree, path7, 7, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data)))
call 0 returned 100%
branch 1 taken 34% (fallthrough)
branch 2 taken 66%
25: 1903: goto out;
49: 1904: if (!do_test_dispatch (tree, path8, 8, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data)))
call 0 returned 100%
49: 1905: goto out;
-: 1906:
207: 1907: out:
207: 1908: if (tree)
branch 0 taken 98% (fallthrough)
branch 1 taken 2%
-: 1909: {
-: 1910: /* test ref */
203: 1911: _dbus_object_tree_ref (tree);
call 0 returned 100%
203: 1912: _dbus_object_tree_unref (tree);
call 0 returned 100%
203: 1913: _dbus_object_tree_unref (tree);
call 0 returned 100%
-: 1914: }
-: 1915:
207: 1916: return TRUE;
-: 1917:}
-: 1918:
-: 1919:/**
-: 1920: * @ingroup DBusObjectTree
-: 1921: * Unit test for DBusObjectTree
-: 1922: * @returns #TRUE on success.
-: 1923: */
-: 1924:dbus_bool_t
-: 1925:_dbus_object_tree_test (void)
function _dbus_object_tree_test called 1 returned 100% blocks executed 100%
1: 1926:{
1: 1927: _dbus_test_oom_handling ("object tree",
call 0 returned 100%
-: 1928: object_tree_test_iteration,
-: 1929: NULL);
-: 1930:
1: 1931: return TRUE;
-: 1932:}
-: 1933:
-: 1934:#endif /* DBUS_BUILD_TESTS */