Annotation of 43BSD/etc/named/db_reload.c, revision 1.1.1.1

1.1       root        1: #ifndef lint
                      2: static char sccsid[] = "@(#)db_reload.c        4.3 (Berkeley) 5/30/86";
                      3: #endif
                      4: 
                      5: /*
                      6:  * Copyright (c) 1986 Regents of the University of California
                      7:  *     All Rights Reserved
                      8:  */
                      9: 
                     10: #include <sys/types.h>
                     11: #include <netinet/in.h>
                     12: #include <stdio.h>
                     13: #include <arpa/nameser.h>
                     14: #include "ns.h"
                     15: #include "db.h"
                     16: 
                     17: /*
                     18:  * Flush and reload data base.
                     19:  */
                     20: 
                     21: db_reload()
                     22: {
                     23:        extern char *bootfile;
                     24: 
                     25: #ifdef DEBUG
                     26:        if (debug >= 3)
                     27:                fprintf(ddt,"reload()\n");
                     28: #endif
                     29: 
                     30:        if (hashtab != NULL)
                     31:                db_free(hashtab);
                     32:        db_inv_free();
                     33:        hashtab = NULL;
                     34:        ns_init(bootfile);
                     35: }
                     36: 
                     37: db_free(htp)
                     38:        struct hashbuf *htp;
                     39: {
                     40:        register struct databuf *dp;
                     41:        register struct namebuf *np;
                     42:        struct namebuf **npp, **nppend;
                     43: 
                     44:        npp = htp->h_tab;
                     45:        nppend = npp + htp->h_size;
                     46:        while (npp < nppend) {
                     47:            for (np = *npp++; np != NULL; free((char *)np), np = np->n_next) {
                     48:                if (np->n_hash != NULL)
                     49:                        db_free(np->n_hash);
                     50:                (void) free(np->n_dname);
                     51:                if (np->n_data == NULL)
                     52:                        continue;
                     53:                for (dp = np->n_data; dp != NULL; dp = dp->d_next)
                     54:                        (void) free((char *)dp);
                     55:            }
                     56:        }
                     57:        (void) free((char *)htp);
                     58: }
                     59: 
                     60: db_inv_free()
                     61: {
                     62:        register struct invbuf *ip;
                     63:        register int i, j;
                     64: 
                     65:        for (i = 0; i < INVHASHSZ; i++)
                     66:                for (ip = invtab[i]; ip != NULL; ip = ip->i_next)
                     67:                        for (j = 0; j < INVBLKSZ; j++)
                     68:                                ip->i_dname[j] = NULL;
                     69: }
                     70: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.