Beispiel #1
0
void *find_data_avltree(struct avl_tree *t, char *key)
{
  struct avl_node *n;

  n = find_name_node_avltree(t, key);
  if (n == NULL)
    return NULL;

  return get_node_data_avltree(n);
}
Beispiel #2
0
int del_name_node_complex_avltree(struct avl_tree *t, char *key, void *global, void (*complex_free)(void *global, char *key, void *payload))
{
  struct avl_node *dn;
  
  if (t == NULL){
    return -1;
  }

  dn = find_name_node_avltree(t, key);

  if (dn == NULL){
    return -1;
  }

  return del_node_complex_avltree(t, dn, global, complex_free);
}
Beispiel #3
0
void *search_type_katcp(struct katcp_dispatch *d, struct katcp_type *t, char *key, void *data)
{
  //struct katcp_type *t;
  void *o;
  
  if (t == NULL || key == NULL)
    return NULL;
#if 0
  t = find_name_type_katcp(d, type);
  if (t == NULL)
    return NULL;
#endif

  o = get_node_data_avltree(find_name_node_avltree(t->t_tree, key));
  if (o == NULL){
    if (data != NULL){
      if (store_data_at_type_katcp(d, t, 0, key, data,
                                      t->t_print,
                                      t->t_free,
                                      t->t_copy,
                                      t->t_compare,
                                      t->t_parse,
                                      t->t_getkey) < 0){
#ifdef DEBUG
        fprintf(stderr, "ktype: search store data fail calling process must manage data at (%p)\n", data);
#endif

        return NULL;
      }
    }
  }
  else {
#if 0
    def DEBUG
    fprintf(stderr, "ktype: search found key: <%s> managing data at (%p)\n", key, data);
#endif
    
    if (t->t_free != NULL && data != o)
      (*t->t_free)(data);

    data = o;
  }

  return data;
}
Beispiel #4
0
int del_data_type_katcp(struct katcp_dispatch *d, char *type, char *key)
{
  struct katcp_type *t;
  struct avl_node *n;

  if (type == NULL || key == NULL)
    return -1;

  t = find_name_type_katcp(d, type);
  if (t == NULL)
    return -1;

  n = find_name_node_avltree(t->t_tree, key);
  if (n == NULL)
    return -1;

  return del_node_avltree(t->t_tree, n, t->t_free);
}
Beispiel #5
0
void *get_key_data_type_katcp(struct katcp_dispatch *d, char *type, char *key)
{
  struct katcp_type *t;
  struct avl_node *n;

  if (type == NULL || key == NULL)
    return NULL;

  t = find_name_type_katcp(d, type);
  if (t == NULL)
    return NULL;

  n = find_name_node_avltree(t->t_tree, key);
  if (n == NULL)
    return NULL;
  
  return get_node_data_avltree(n);
}