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