Example #1
0
bool local_obsdata_add_node( local_obsdata_type * data , local_obsdata_node_type * node ) {
  const char * key = local_obsdata_node_get_key( node );
  if (local_obsdata_has_node(data , key))
    return false; 
  else {
    vector_append_owned_ref( data->nodes_list , node , local_obsdata_node_free__ );
    hash_insert_ref( data->nodes_map , key , node );
    return true;
  }
}
Example #2
0
void test_wrapper() {
  local_obsdata_node_type * node = local_obsdata_node_alloc("KEY");
  local_obsdata_type * data = local_obsdata_alloc_wrapper( node );
  test_assert_true( local_obsdata_is_instance( data ));
  test_assert_int_equal( 1 , local_obsdata_get_size( data ));
  test_assert_ptr_equal( node , local_obsdata_iget( data , 0 ));
  test_assert_true( local_obsdata_has_node( data , "KEY" ));
  test_assert_false( local_obsdata_has_node( data , "KEYX" ));
  test_assert_string_equal( local_obsdata_node_get_key( node ) , local_obsdata_get_name( data ));
  local_obsdata_free( data );
}
Example #3
0
local_obsdata_type * local_obsdata_alloc_wrapper( local_obsdata_node_type * node ) {
  local_obsdata_type * data = local_obsdata_alloc( local_obsdata_node_get_key( node ));
  local_obsdata_add_node( data , node );
  return data;
}