X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fadt%2Fiterator.c;h=92ceb7ba5d5e2a137ad4085f733f53ba48da90bc;hb=3e889332cb054e5cee1a12bba6dd0209121100cf;hp=7136c6187208c050a7e460c716feb62819a458fa;hpb=a59dd7aa7ca55ee52f0c0e775d937f1cc9d3a79b;p=libfirm diff --git a/ir/adt/iterator.c b/ir/adt/iterator.c index 7136c6187..92ceb7ba5 100644 --- a/ir/adt/iterator.c +++ b/ir/adt/iterator.c @@ -1,3 +1,29 @@ +/* + * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * + * This file is part of libFirm. + * + * This file may be distributed and/or modified under the terms of the + * GNU General Public License version 2 as published by the Free Software + * Foundation and appearing in the file LICENSE.GPL included in the + * packaging of this file. + * + * Licensees holding valid libFirm Professional Edition licenses may use + * this file in accordance with the libFirm Commercial License. + * Agreement provided with the Software. + * + * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE + * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. + */ + +/** + * @file + * @brief iterators + * @author Sebastian Hack + * @version $Id$ + */ +#include "config.h" #include @@ -5,26 +31,22 @@ #include "list.h" #include "iterator.h" -#define ITERATOR_MAGIC "ITR" - -int is_iterator(const void *ptr) -{ - const iterator_t *it = ptr; - return strncmp(it->magic, ITERATOR_MAGIC, sizeof(ITERATOR_MAGIC)) == 0; -} static void *it_pset_start(void *collection) { - return pset_first(collection); + return pset_first((pset*) collection); } static void *it_pset_next(void *collection, void *curr) { - return pset_next(collection); + (void) curr; + return pset_next((pset*) collection); } static void it_pset_finish(void *collection, void *curr) { + (void) collection; + (void) curr; } static const iterator_t iterator_pset = { @@ -34,13 +56,13 @@ static const iterator_t iterator_pset = { it_pset_finish }; -const iterator_t *it_pset = &iterator_pset; +const iterator_t *pset_iterator = &iterator_pset; static void *it_list_next(void *coll, void *it) { - struct list_head *head = coll; - struct list_head *curr = it; + struct list_head *head = (list_head*) coll; + struct list_head *curr = (list_head*) it; return curr->next != head ? curr->next : NULL; } @@ -51,6 +73,8 @@ static void *it_list_start(void *coll) static void it_list_finish(void *coll, void *curr) { + (void) coll; + (void) curr; } static const iterator_t iterator_list = { @@ -60,4 +84,4 @@ static const iterator_t iterator_list = { it_list_finish }; -const iterator_t *it_list = &iterator_list; +const iterator_t *list_iterator = &iterator_list;