X-Git-Url: http://git.pond.sub.org/?p=empserver;a=blobdiff_plain;f=src%2Flib%2Fas%2Fas_delete.c;fp=src%2Flib%2Fas%2Fas_delete.c;h=0000000000000000000000000000000000000000;hp=eab8b4be043f65951bbdaf3ec6dff7c77dec5eb3;hb=ffbbfcb25fd1e5ef1c03c0ece542c97f571ad51d;hpb=90de24d038b01e0956ed91625f515ab66ac7677c diff --git a/src/lib/as/as_delete.c b/src/lib/as/as_delete.c deleted file mode 100644 index eab8b4be0..000000000 --- a/src/lib/as/as_delete.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * A* Search - A search library used in Empire to determine paths between - * objects. - * Copyright (C) 1990-1998 Phil Lapsley - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include -#include "as.h" - -static void as_free_queue(struct as_queue *queue); - -/* - * Free any dynamically allocated data stored in the as_data structure. - */ -void -as_reset(struct as_data *adp) -{ - as_free_queue(adp->head); - adp->head = NULL; - as_free_queue(adp->tried); - adp->tried = NULL; - as_free_queue(adp->subsumed); - adp->subsumed = NULL; - as_free_hashtab(adp); - as_free_path(adp->path); - adp->path = NULL; -} - -/* - * Free a queue (either the main, subsumed, or tried). - */ -static void -as_free_queue(struct as_queue *queue) -{ - struct as_queue *qp, *qp2; - - for (qp = queue; qp; qp = qp2) { - free(qp->np); - qp2 = qp->next; - free(qp); - } -} - -/* - * Free a path. - */ -void -as_free_path(struct as_path *pp) -{ - struct as_path *pp2; - - for (; pp; pp = pp2) { - pp2 = pp->next; - free(pp); - } -} - -/* - * Delete the as_data structure (which includes freeing its data). - */ -void -as_delete(struct as_data *adp) -{ - as_reset(adp); - free(adp->neighbor_coords); - free(adp->neighbor_nodes); - free(adp->hashtab); - free(adp); -}