]>
Commit | Line | Data |
---|---|---|
68bbc9c3 | 1 | /* $Header$ |
2 | * | |
3 | * (c) Copyright 1988 by the Massachusetts Institute of Technology. | |
4 | * For copying and distribution information, please see the file | |
5 | * <mit-copyright.h>. | |
6 | */ | |
7 | ||
8 | #include <mit-copyright.h> | |
9 | #include "dbck.h" | |
10 | ||
11 | #define NULL 0 | |
12 | ||
13 | static char phase3_qc_rcsid[] = "$Header$"; | |
14 | ||
15 | ||
16 | empty_list_check(id, l, hint) | |
17 | int id, hint; | |
18 | struct list *l; | |
19 | { | |
20 | if (l->members == 0 && l->list_id != 0) | |
21 | printf("Warning: List %s is empty\n", l->name); | |
22 | } | |
23 | ||
24 | ||
25 | /* Used by other parts of the program to check that a string_id is good. | |
26 | * This returns TRUE if it is, or FALSE if it is not, and as a side effect | |
27 | * increments the string reference count. | |
28 | */ | |
29 | ||
30 | struct string *string_check(id) | |
31 | int id; | |
32 | { | |
33 | register struct string *s; | |
34 | ||
35 | s = (struct string *) hash_lookup(strings, id); | |
36 | if (s == NULL) | |
37 | return(s); | |
38 | s->refc++; | |
39 | return(s); | |
40 | } | |
41 | ||
42 | ||
43 | unref_string_check(id, s, hint) | |
44 | int id, hint; | |
45 | struct string *s; | |
46 | { | |
47 | if (s->refc == 0) { | |
48 | printf("Unreferenced string %s id %d\n", s->name, id); | |
49 | if (single_fix("Delete", 1)) | |
50 | single_delete("strings", "string_id", id); | |
51 | } | |
52 | } | |
53 | ||
ab05f33a | 54 | /* This test was disabled because the MIT Moira server, which |
55 | * initially only managed host information for workstations and | |
56 | * servers in the Athena Computing Environment, has been extended to | |
57 | * manage all hosts in the MIT.EDU domain (but not subdomains). | |
58 | */ | |
59 | /* | |
68bbc9c3 | 60 | noclu_mach_check(id, m, hint) |
61 | int id, hint; | |
62 | struct machine *m; | |
63 | { | |
64 | if (m->clucount == 0 && m->mach_id != 0) | |
65 | printf("Warning: machine %s is not in any clusters\n", m->name); | |
66 | } | |
ab05f33a | 67 | */ |
68bbc9c3 | 68 | |
69 | phase3() | |
208a4f4a | 70 | { |
68bbc9c3 | 71 | printf("Phase 3 - Finding unused objects\n"); |
72 | ||
73 | if (warn) { | |
ab05f33a | 74 | /* dprintf("Checking machines...\n"); |
75 | * hash_step(machines, noclu_mach_check, NULL); | |
76 | */ | |
68bbc9c3 | 77 | dprintf("Checking lists...\n"); |
78 | hash_step(lists, empty_list_check, NULL); | |
79 | } | |
80 | ||
81 | dprintf("Checking strings...\n"); | |
82 | hash_step(strings, unref_string_check, NULL); | |
208a4f4a | 83 | } |
68bbc9c3 | 84 |