From e50753ce7c0ba360bc4735fc14817bbf941704cd Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=B6tz=20Lindenmaier?= Date: Mon, 14 Mar 2005 11:34:05 +0000 Subject: [PATCH] dded new routing for tr_inheritance. [r5370] --- ir/adt/pset.h | 24 +++++++++++++----------- ir/adt/set.c | 7 +++++++ ir/adt/set.h | 2 +- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/ir/adt/pset.h b/ir/adt/pset.h index 9a42d1bfa..1de420252 100644 --- a/ir/adt/pset.h +++ b/ir/adt/pset.h @@ -26,6 +26,16 @@ */ int pset_default_ptr_cmp(const void *x, const void *y); +/** + * The abstract type of a pset (Set of pointers). + * + * This kind of sets stores only pointer to elements, the elements itself + * must be stored somewere else. + * + * @see set + */ +typedef struct pset pset; + /* * Define some convenience macros using the predefined hash function. */ @@ -35,16 +45,8 @@ int pset_default_ptr_cmp(const void *x, const void *y); #define pset_find_ptr(set,key) pset_find(set, key, HASH_PTR(key)) #define pset_new_ptr(slots) new_pset(pset_default_ptr_cmp, slots) #define pset_new_ptr_default() pset_new_ptr(64) +void pset_insert_pset_ptr(pset *target, pset *src); /* Insertss all elements of src in target. */ -/** - * The abstract type of a pset (Set of pointers). - * - * This kind of sets stores only pointer to elements, the elements itself - * must be stored somewere else. - * - * @see set - */ -typedef struct pset pset; /** The entry of a pset, representing an element pointer in the set and it's meta-information */ typedef struct { @@ -114,7 +116,7 @@ void *pset_find (pset *pset, const void *key, unsigned hash); * @return a pointer to the inserted element * * @note - * It is not possible to insert on element more than once. If a element + * It is not possible to insert an element more than once. If an element * that should be inserted is already in the set, this functions does * nothing but returning its already existing set_entry. @@ -131,7 +133,7 @@ void *pset_insert (pset *pset, const void *key, unsigned hash); * @return a pointer to the pset_entry of the inserted element * * @note - * It is not possible to insert on element more than once. If a element + * It is not possible to insert an element more than once. If an element * that should be inserted is already in the pset, this functions does * nothing but returning its pset_entry. */ diff --git a/ir/adt/set.c b/ir/adt/set.c index 9b2e031f6..f2e4dd756 100644 --- a/ir/adt/set.c +++ b/ir/adt/set.c @@ -550,6 +550,13 @@ MANGLEP(entry) * return pset_hinsert (se, key, hash); } +void pset_insert_pset_ptr(pset *target, pset *src) { + void *elt; + for (elt = pset_first(src); elt; elt = pset_next(src)) { + pset_insert_ptr(target, elt); + } +} + #else /* !PSET */ void * diff --git a/ir/adt/set.h b/ir/adt/set.h index 8b95c0c0e..746dc95f6 100644 --- a/ir/adt/set.h +++ b/ir/adt/set.h @@ -104,7 +104,7 @@ void *set_find (set *set, const void *key, size_t size, unsigned hash); * @return a pointer to the inserted element * * @note - * It is not possible to insert on element more than once. If an element + * It is not possible to insert one element more than once. If an element * that should be inserted is already in the set, this functions does * nothing but returning its pointer. */ -- 2.20.1