File: parser.c

package info (click to toggle)
htmlcxx 0.87-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,412 kB
  • sloc: sh: 4,380; cpp: 4,355; yacc: 526; ansic: 205; lex: 159; makefile: 47; perl: 27
file content (33 lines) | stat: -rw-r--r-- 694 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <stdlib.h>
#include "parser.h"

void free_rulesets(struct selector_list_t *rules) {

	struct selector_list_t *pos = rules;
	while (pos != NULL) {
		struct selector_list_t *tmp = pos;
		struct selector_t *rule = pos->selector;
		struct property_t *property = rule->property;
		while (property != NULL) {
			struct property_t *tmp = property;
			property = property->next;
			tmp->count--;
			if (tmp->count == 0) {
				free(tmp->name);
				free(tmp->val);
				free(tmp);
			}
		}
		while (rule != NULL) {
			struct selector_t *tmp = rule;
			rule = rule->next;
			free(tmp->element_name);
			free(tmp->id);
			free(tmp->e_class);
			free(tmp);
		}
		pos = pos->next;
		free(tmp);
	}

}