g_tree_lookup_extended



Hi,

I proposed this one a while ago and it's in bugzilla, but it
wasn't applied until now, so I thought I should simply post
it again and ask if anyone would object against adding this
public function to the GTree API:


gboolean
g_tree_lookup_extended (GTree         *tree,
                       gconstpointer  lookup_key,
                       gpointer      *orig_key,
                       gpointer      *value)
{
  GRealTree *rtree;
  GTreeNode *node;

  g_return_val_if_fail (tree != NULL, FALSE);

  rtree = (GRealTree*) tree;

  node = g_tree_node_lookup (rtree->root, rtree->key_compare, 
                             rtree->key_compare_data, lookup_key);

  if (node)
    {
      if (orig_key)
       *orig_key = node->key;
      if (value)
       *value = node->value;
      return TRUE;
    }
  else
    return FALSE;
}


It's the equivalent of g_hash_table_lookup_extended() which has
been around for a long time and IMHO its an important missing
feature. So if nobody objects, I'll commit this...


Salut, Sven




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]