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