static void make_room(pa_hashmap *cache) {
    pa_assert(cache);

    while (pa_hashmap_size(cache) >= MAX_CACHE_SIZE) {
        struct rule *r;

        pa_assert_se(r = pa_hashmap_steal_first(cache));
        rule_free(r);
    }
}
Example #2
0
/* callback for each rules remove button */
static void
on_ruleremove_clicked (GtkButton *button, gpointer user_data)
{
    struct changeRequest	*changeRequest = (struct changeRequest *)user_data;
    rulePtr			rule;

    rule = g_object_get_data (G_OBJECT (changeRequest->paramHBox), "rule");
    if (rule) {
        changeRequest->editor->priv->newRules = g_slist_remove (changeRequest->editor->priv->newRules, rule);
        rule_free(rule);
    }
    gtk_container_remove (GTK_CONTAINER (changeRequest->editor->priv->root), changeRequest->hbox);
    g_free (changeRequest);
}
Example #3
0
static void
rule_editor_finalize (GObject *object)
{
    RuleEditor *re = RULE_EDITOR (object);

    /* delete rules */
    GSList *iter = re->priv->newRules;
    while (iter) {
        rule_free ((rulePtr)iter->data);
        iter = g_slist_next (iter);
    }
    g_slist_free (re->priv->newRules);
    re->priv->newRules = NULL;

    G_OBJECT_CLASS (parent_class)->finalize (object);
}
Example #4
0
void
itemset_free (itemSetPtr itemSet)
{
	GSList		*rule;

	if (!itemSet)
		return;

	rule = itemSet->rules;
	while (rule) {
		rule_free (rule->data);
		rule = g_slist_next (rule);
	}
	g_slist_free (itemSet->rules);
	g_list_free (itemSet->ids);
	g_free (itemSet);
}
Example #5
0
static void
do_ruletype_changed (struct changeRequest	*changeRequest)
{
    ruleInfoPtr		ruleInfo;
    rulePtr			rule;

    rule = g_object_get_data (G_OBJECT (changeRequest->paramHBox), "rule");
    if (rule) {
        changeRequest->editor->priv->newRules = g_slist_remove (changeRequest->editor->priv->newRules, rule);
        rule_free (rule);
    }
    ruleInfo = g_slist_nth_data (rule_get_available_rules (), changeRequest->rule);
    rule = rule_new (ruleInfo->ruleId, "", TRUE);
    changeRequest->editor->priv->newRules = g_slist_append (changeRequest->editor->priv->newRules, rule);

    rule_editor_setup_widgets (changeRequest, rule);
}
Example #6
0
void
rule_editor_save (RuleEditor *re, itemSetPtr itemset)
{
    GSList	*iter;

    /* delete all old rules */
    iter = itemset->rules;
    while (iter) {
        rule_free ((rulePtr)iter->data);
        iter = g_slist_next (iter);
    }
    g_slist_free (itemset->rules);
    itemset->rules = NULL;

    /* and add all rules from editor */
    iter = re->priv->newRules;
    while (iter) {
        rulePtr rule = (rulePtr)iter->data;
        itemset_add_rule (itemset, rule->ruleInfo->ruleId, rule->value, rule->additive);
        iter = g_slist_next (iter);
    }
}
Example #7
0
void 
node_free(Wht *W) 
{
  int i;

  if (W->children != NULL) {
    for (i = 0; i < W->children->nn; i++) 
      node_free(W->children->Ws[i]);

    i_free(W->children);
  }

  if (W->to_string != NULL)
    i_free(W->to_string);

  if (W->error_msg != NULL)
    i_free(W->error_msg);

  if (W->rule != NULL)
    rule_free(W->rule);

  i_free(W);
}
void pa__done(pa_module *m) {
    struct userdata* u;

    pa_assert(m);

    if (!(u = m->userdata))
        return;

    if (u->client_new_slot)
        pa_hook_slot_free(u->client_new_slot);
    if (u->client_proplist_changed_slot)
        pa_hook_slot_free(u->client_proplist_changed_slot);

    if (u->cache) {
        struct rule *r;

        while ((r = pa_hashmap_steal_first(u->cache)))
            rule_free(r);

        pa_hashmap_free(u->cache, NULL, NULL);
    }

    pa_xfree(u);
}
Example #9
0
static void delete_rule_( void * xrule, void * data )
{
    rule_free( (RULE *)xrule );
}