mirror of
https://github.com/ksherlock/rlint.git
synced 2024-06-01 20:41:32 +00:00
keep track of processed resources
This commit is contained in:
parent
427917d427
commit
932784608a
36
rlint.c
36
rlint.c
|
@ -19,7 +19,39 @@ unsigned level;
|
||||||
unsigned error_count;
|
unsigned error_count;
|
||||||
unsigned flag_v = 0;
|
unsigned flag_v = 0;
|
||||||
|
|
||||||
|
struct node {
|
||||||
|
struct node *next;
|
||||||
|
ResType type;
|
||||||
|
ResID id;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct node *processed_map[256];
|
||||||
|
|
||||||
|
|
||||||
|
unsigned processed(ResType type, ResID id) {
|
||||||
|
unsigned hash = 0xaaaa;
|
||||||
|
struct node *e;
|
||||||
|
|
||||||
|
hash ^= type;
|
||||||
|
hash ^= (unsigned)id;
|
||||||
|
hash ^= id >> 16;
|
||||||
|
|
||||||
|
hash ^= hash >> 8;
|
||||||
|
hash &= 0xff;
|
||||||
|
|
||||||
|
e = processed_map[hash];
|
||||||
|
while(e) {
|
||||||
|
if (e->type == type && e->id == id) return 1;
|
||||||
|
e = e->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
e = malloc(sizeof(struct node));
|
||||||
|
e->next = processed_map[hash];
|
||||||
|
e->type = type;
|
||||||
|
e->id = id;
|
||||||
|
processed_map[hash] = e;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
char *ResName(ResType type) {
|
char *ResName(ResType type) {
|
||||||
static char buffer[6] = { '$', 'x', 'x', 'x', 'x', 0 };
|
static char buffer[6] = { '$', 'x', 'x', 'x', 'x', 0 };
|
||||||
|
@ -126,6 +158,8 @@ void check(ResType type, ResID id) {
|
||||||
fprintf(stdout," %s:%08lx\n", ResName(type), id);
|
fprintf(stdout," %s:%08lx\n", ResName(type), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (processed(type, id)) return;
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case rMenu: callback = check_rMenu; break;
|
case rMenu: callback = check_rMenu; break;
|
||||||
case rMenuItem: callback = check_rMenuItem; break;
|
case rMenuItem: callback = check_rMenuItem; break;
|
||||||
|
@ -255,6 +289,8 @@ int main(int argc, char **argv) {
|
||||||
flag_v = 0;
|
flag_v = 0;
|
||||||
error_count = 0;
|
error_count = 0;
|
||||||
level = 0;
|
level = 0;
|
||||||
|
memset(processed_map, 0, sizeof(processed_map));
|
||||||
|
memset(history, 0, sizeof(history));
|
||||||
|
|
||||||
for (i = 1; i < argc; ++i) {
|
for (i = 1; i < argc; ++i) {
|
||||||
char *cp = argv[i];
|
char *cp = argv[i];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user