示例#1
0
WHook *mainloop_unregister_hook(const char *name, WHook *hk)
{
    bool found=FALSE;
    Rb_node node;

    if(named_hooks==NULL)
        return NULL;
    
    if(hk==NULL){
        assert(name!=NULL);
        node=rb_find_key_n(named_hooks, name, &found);
    }else{
        rb_traverse(node, named_hooks){
            if((WHook*)rb_val(node)==hk){
                found=TRUE;
                break;
            }
        }
    }

    if(found){
        hk=(WHook*)rb_val(node);
        free((char*)node->k.key);
        rb_delete_node(node);
    }
    
    return hk;
}
示例#2
0
/*EXTL_DOC
 * Find named hook \var{name}.
 */
EXTL_SAFE
EXTL_EXPORT
WHook *mainloop_get_hook(const char *name)
{
    if(name==NULL)
        return NULL;
    
    if(named_hooks!=NULL){
        bool found=FALSE;
        Rb_node node=rb_find_key_n(named_hooks, name, &found);
        if(found)
            return (WHook*)rb_val(node);
    }
    
    return NULL;
}
示例#3
0
文件: rb.c 项目: SystemGarden/habitat
Rb_node rb_find_key(Rb_node n, char *key)
{
  int fnd;
  return rb_find_key_n(n, key, &fnd);
}