コード例 #1
0
ファイル: asmrule.cpp プロジェクト: andyTsing/freedownload
static void free_node_t(struct node_t *p)
{
    if(!p) return; /* just to make sure*/
  
    if(p->op == O_ID || p->op == O_NUM) {
	/* p->left is char *, or int * (malloced)*/
	free(p->left);
	p->left = NULL;
    }
    else {
	if(p->left) free_node_t(p->left);
	if(p->right) free_node_t(p->right);
    }
    free(p);
}
コード例 #2
0
ファイル: asmrule.cpp プロジェクト: andyTsing/freedownload
/*
 * judge if bw is OK in 'rulestr'
 *          return value:     0 ... no, it's not OK.
 *                        non 0 ... yes, it is. use this rule.
 */
int asmrule_match(char *rulestr,int bw)
{
    int ret = 0;
    struct node_t *p;
    struct c_desc *cd;
  
    if(rulestr[0] != '#') { /* asmrule always start with #*/
	return 1; /* if not, it's no description rule --> always match */
    }
  
    cd = new_c_desc(rulestr + 1);
  
    p = cond_expr(cd);

    /*tree_debug(p); debugging*/
  
    insert_id_value(p,"OldPNMPlayer",0); /* we don't care about old player */
    insert_id_value(p,"Bandwidth",bw);
  
    ret = eval_tree(p);
  
    free_node_t(p);
    free_c_desc(cd);
  
    return ret;
}
コード例 #3
0
void free_names() {
	free_node_t(names);
	names = NULL;
}