---
libsepol/include/sepol/policydb/hashtab.h | 28 --------
libsepol/src/hashtab.c | 85 -----------------------
policycoreutils/newrole/hashtab.c | 85 -----------------------
policycoreutils/newrole/hashtab.h | 28 --------
4 files changed, 226 deletions(-)
diff --git a/libsepol/include/sepol/policydb/hashtab.h b/libsepol/include/sepol/policydb/hashtab.h
index ca5ba862..dca8c983 100644
--- a/libsepol/include/sepol/policydb/hashtab.h
+++ b/libsepol/include/sepol/policydb/hashtab.h
@@ -79,20 +79,6 @@ extern int hashtab_remove(hashtab_t h, hashtab_key_t k,
hashtab_datum_t d,
void *args), void *args);
-/*
- Insert or replace the specified (key, datum) pair in the specified
- hash table. If an entry for the specified key already exists,
- then the specified destroy function is applied to (key,datum,args)
- for the entry prior to replacing the entry's contents.
-
- Returns SEPOL_ENOMEM if insufficient space is available or
- SEPOL_OK otherwise.
- */
-extern int hashtab_replace(hashtab_t h, hashtab_key_t k, hashtab_datum_t d,
- void (*destroy) (hashtab_key_t k,
- hashtab_datum_t d,
- void *args), void *args);
-
/*
Searches for the entry with the specified key in the hash table.
@@ -122,20 +108,6 @@ extern int hashtab_map(hashtab_t h,
hashtab_datum_t d,
void *args), void *args);
-/*
- Same as hashtab_map, except that if apply returns a non-zero status,
- then the (key,datum) pair will be removed from the hashtab and the
- destroy function will be applied to (key,datum,args).
- */
-extern void hashtab_map_remove_on_error(hashtab_t h,
- int (*apply) (hashtab_key_t k,
- hashtab_datum_t d,
- void *args),
- void (*destroy) (hashtab_key_t k,
- hashtab_datum_t d,
- void *args),
- void *args);
-
extern void hashtab_hash_eval(hashtab_t h, char *tag);
#ifdef __cplusplus
diff --git a/libsepol/src/hashtab.c b/libsepol/src/hashtab.c
index f5407ab6..9590b359 100644
--- a/libsepol/src/hashtab.c
+++ b/libsepol/src/hashtab.c
@@ -133,48 +133,6 @@ int hashtab_remove(hashtab_t h, hashtab_key_t key,
return SEPOL_OK;
}
-int hashtab_replace(hashtab_t h, hashtab_key_t key, hashtab_datum_t datum,
- void (*destroy) (hashtab_key_t k,
- hashtab_datum_t d, void *args), void *args)
-{
- int hvalue;
- hashtab_ptr_t prev, cur, newnode;
-
- if (!h)
- return SEPOL_ENOMEM;
-
- hvalue = h->hash_value(h, key);
- prev = NULL;
- cur = h->htable[hvalue];
- while (cur != NULL && h->keycmp(h, key, cur->key) > 0) {
- prev = cur;
- cur = cur->next;
- }
-
- if (cur && (h->keycmp(h, key, cur->key) == 0)) {
- if (destroy)
- destroy(cur->key, cur->datum, args);
- cur->key = key;
- cur->datum = datum;
- } else {
- newnode = (hashtab_ptr_t) malloc(sizeof(hashtab_node_t));
- if (newnode == NULL)
- return SEPOL_ENOMEM;
- memset(newnode, 0, sizeof(struct hashtab_node));
- newnode->key = key;
- newnode->datum = datum;
- if (prev) {
- newnode->next = prev->next;
- prev->next = newnode;
- } else {
- newnode->next = h->htable[hvalue];
- h->htable[hvalue] = newnode;
- }
- }
-
- return SEPOL_OK;
-}
-
hashtab_datum_t hashtab_search(hashtab_t h, const_hashtab_key_t key)
{
@@ -241,49 +199,6 @@ int hashtab_map(hashtab_t h,
return SEPOL_OK;
}
-void hashtab_map_remove_on_error(hashtab_t h,
- int (*apply) (hashtab_key_t k,
- hashtab_datum_t d,
- void *args),
- void (*destroy) (hashtab_key_t k,
- hashtab_datum_t d,
- void *args), void *args)
-{
- unsigned int i;
- int ret;
- hashtab_ptr_t last, cur, temp;
-
- if (!h)
- return;
-
- for (i = 0; i < h->size; i++) {
- last = NULL;
- cur = h->htable[i];
- while (cur != NULL) {
- ret = apply(cur->key, cur->datum, args);
- if (ret) {
- if (last) {
- last->next = cur->next;
- } else {
- h->htable[i] = cur->next;
- }
-
- temp = cur;
- cur = cur->next;
- if (destroy)
- destroy(temp->key, temp->datum, args);
- free(temp);
- h->nel--;
- } else {
- last = cur;
- cur = cur->next;
- }
- }
- }
-
- return;
-}
-
void hashtab_hash_eval(hashtab_t h, char *tag)
{
unsigned int i;
diff --git a/policycoreutils/newrole/hashtab.c b/policycoreutils/newrole/hashtab.c
index 24c65c49..bc502836 100644
--- a/policycoreutils/newrole/hashtab.c
+++ b/policycoreutils/newrole/hashtab.c
@@ -112,48 +112,6 @@ int hashtab_remove(hashtab_t h, hashtab_key_t key,
return HASHTAB_SUCCESS;
}
-int hashtab_replace(hashtab_t h, hashtab_key_t key, hashtab_datum_t datum,
- void (*destroy) (hashtab_key_t k,
- hashtab_datum_t d, void *args), void *args)
-{
- int hvalue;
- hashtab_ptr_t prev, cur, newnode;
-
- if (!h)
- return HASHTAB_OVERFLOW;
-
- hvalue = h->hash_value(h, key);
- prev = NULL;
- cur = h->htable[hvalue];
- while (cur != NULL && h->keycmp(h, key, cur->key) > 0) {
- prev = cur;
- cur = cur->next;
- }
-
- if (cur && (h->keycmp(h, key, cur->key) == 0)) {
- if (destroy)
- destroy(cur->key, cur->datum, args);
- cur->key = key;
- cur->datum = datum;
- } else {
- newnode = (hashtab_ptr_t) malloc(sizeof(hashtab_node_t));
- if (newnode == NULL)
- return HASHTAB_OVERFLOW;
- memset(newnode, 0, sizeof(struct hashtab_node));
- newnode->key = key;
- newnode->datum = datum;
- if (prev) {
- newnode->next = prev->next;
- prev->next = newnode;
- } else {
- newnode->next = h->htable[hvalue];
- h->htable[hvalue] = newnode;
- }
- }
-
- return HASHTAB_SUCCESS;
-}
-
hashtab_datum_t hashtab_search(hashtab_t h, const_hashtab_key_t key)
{
@@ -220,49 +178,6 @@ int hashtab_map(hashtab_t h,
return HASHTAB_SUCCESS;
}
-void hashtab_map_remove_on_error(hashtab_t h,
- int (*apply) (hashtab_key_t k,
- hashtab_datum_t d,
- void *args),
- void (*destroy) (hashtab_key_t k,
- hashtab_datum_t d,
- void *args), void *args)
-{
- unsigned int i;
- int ret;
- hashtab_ptr_t last, cur, temp;
-
- if (!h)
- return;
-
- for (i = 0; i < h->size; i++) {
- last = NULL;
- cur = h->htable[i];
- while (cur != NULL) {
- ret = apply(cur->key, cur->datum, args);
- if (ret) {
- if (last) {
- last->next = cur->next;
- } else {
- h->htable[i] = cur->next;
- }
-
- temp = cur;
- cur = cur->next;
- if (destroy)
- destroy(temp->key, temp->datum, args);
- free(temp);
- h->nel--;
- } else {
- last = cur;
- cur = cur->next;
- }
- }
- }
-
- return;
-}
-
void hashtab_hash_eval(hashtab_t h, char *tag)
{
unsigned int i;
diff --git a/policycoreutils/newrole/hashtab.h b/policycoreutils/newrole/hashtab.h
index ad5559ba..092b96a9 100644
--- a/policycoreutils/newrole/hashtab.h
+++ b/policycoreutils/newrole/hashtab.h
@@ -81,20 +81,6 @@ extern int hashtab_remove(hashtab_t h, hashtab_key_t k,
hashtab_datum_t d,
void *args), void *args);
-/*
- Insert or replace the specified (key, datum) pair in the specified
- hash table. If an entry for the specified key already exists,
- then the specified destroy function is applied to (key,datum,args)
- for the entry prior to replacing the entry's contents.
-
- Returns HASHTAB_OVERFLOW if insufficient space is available or
- HASHTAB_SUCCESS otherwise.
- */
-extern int hashtab_replace(hashtab_t h, hashtab_key_t k, hashtab_datum_t d,
- void (*destroy) (hashtab_key_t k,
- hashtab_datum_t d,
- void *args), void *args);
-
/*
Searches for the entry with the specified key in the hash table.
@@ -124,20 +110,6 @@ extern int hashtab_map(hashtab_t h,
hashtab_datum_t d,
void *args), void *args);
-/*
- Same as hashtab_map, except that if apply returns a non-zero status,
- then the (key,datum) pair will be removed from the hashtab and the
- destroy function will be applied to (key,datum,args).
- */
-extern void hashtab_map_remove_on_error(hashtab_t h,
- int (*apply) (hashtab_key_t k,
- hashtab_datum_t d,
- void *args),
- void (*destroy) (hashtab_key_t k,
- hashtab_datum_t d,
- void *args),
- void *args);
-
extern void hashtab_hash_eval(hashtab_t h, char *tag);
#endif