From d15897e2ecf17326babc5ec57e4d915e9b51b35d Mon Sep 17 00:00:00 2001
From: Anjan Chanda <anjan.chanda@iopsys.eu>
Date: Mon, 4 Oct 2021 13:11:18 +0200
Subject: [PATCH] remove copy of hlist.h

---
 src/core/allsta.c     |   1 -
 src/core/cntlr.c      |   1 -
 src/core/cntlr_ubus.c |   1 -
 src/utils/hlist.h     | 101 ------------------------------------------
 4 files changed, 104 deletions(-)
 delete mode 100644 src/utils/hlist.h

diff --git a/src/core/allsta.c b/src/core/allsta.c
index f577f4aa..f108e145 100644
--- a/src/core/allsta.c
+++ b/src/core/allsta.c
@@ -15,7 +15,6 @@
 #include <easy/easy.h>
 #include "utils.h"
 #include "debug.h"
-#include "hlist.h"
 #include "allsta.h"
 
 /* hash table of all active stas in the network */
diff --git a/src/core/cntlr.c b/src/core/cntlr.c
index 954a6607..e439a5d2 100644
--- a/src/core/cntlr.c
+++ b/src/core/cntlr.c
@@ -41,7 +41,6 @@
 #include "config.h"
 #include "cntlr.h"
 #include "comm.h"
-#include "hlist.h"
 #include "allsta.h"
 #include "cntlr_ubus.h"
 #include "cntlr_map.h"
diff --git a/src/core/cntlr_ubus.c b/src/core/cntlr_ubus.c
index e918c76a..b82904e7 100644
--- a/src/core/cntlr_ubus.c
+++ b/src/core/cntlr_ubus.c
@@ -31,7 +31,6 @@
 #include "debug.h"
 #include "config.h"
 #include "cntlr.h"
-#include "hlist.h"
 #include "allsta.h"
 #include "cntlr_map.h"
 #include "cntlr_ubus.h"
diff --git a/src/utils/hlist.h b/src/utils/hlist.h
deleted file mode 100644
index faf00789..00000000
--- a/src/utils/hlist.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * hlist.h - stripped down version of hash list implementation using
- * singly linked list.
- * Doubly linked list is wastage of space for big hash-tables. If cost of
- * iterating a hash list is significant, it means the hash function is NOT
- * formulated well and should be revisited.
- *
- * Copyright (C) 2019 IOPSYS Software Solutions AB. All rights reserved.
- *
- * Author: anjan.chanda@iopsys.eu
- *
- */
-
-#ifndef _HLIST_H
-#define _HLIST_H
-
-struct hlist_node {
-	struct hlist_node *next;
-};
-
-struct hlist_head {
-	struct hlist_node *first;
-};
-
-#define HLIST_HEAD_INIT(name) { &(name) }
-
-#define HLIST_HEAD(name) struct hlist_head name = HLIST_HEAD_INIT(name)
-
-static inline void INIT_HLIST_HEAD(struct hlist_head *h)
-{
-	h->first = NULL;
-}
-
-static inline void INIT_HLIST_NODE(struct hlist_node *n)
-{
-	n->next = NULL;
-}
-
-static inline int hlist_empty(const struct hlist_head *h)
-{
-	return !h->first;
-}
-
-static inline void __hlist_del(struct hlist_node *prev, struct hlist_node *n)
-{
-	prev->next = n->next;
-	n->next = NULL;
-}
-
-static inline void hlist_del(struct hlist_node *n, struct hlist_head *h)
-{
-	struct hlist_node *p;
-
-	if (h->first == n) {
-		h->first = NULL;
-		n->next = NULL;
-		return;
-	}
-
-	for (p = h->first; p; p = p->next) {
-		if (p->next == n)
-			__hlist_del(p, n);
-	}
-}
-
-static inline void _hlist_add(struct hlist_node *_new, struct hlist_head *h)
-{
-	_new->next = h->first;
-	h->first = _new;
-}
-
-static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
-{
-	_hlist_add(n, h);
-}
-
-#define hlist_for_each(pos, head) \
-	for (pos = (head)->first; pos ; pos = pos->next)
-
-#define hlist_for_each_safe(pos, n, head) \
-	for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
-	     pos = n)
-
-#define hlist_entry(ptr, type, member) container_of(ptr, type, member)
-
-#define hlist_entry_safe(ptr, type, member) \
-	({ typeof(ptr) ____ptr = (ptr); \
-	   ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
-	})
-
-#define hlist_for_each_entry(pos, head, member)                                \
-	for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);    \
-	     pos;                                                              \
-	     pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
-
-#define hlist_for_each_entry_safe(pos, n, head, member)                   \
-	for (pos = hlist_entry_safe((head)->first, typeof(*pos), member); \
-	     pos && ({ n = pos->member.next; 1; });                       \
-	     pos = hlist_entry_safe(n, typeof(*pos), member))
-
-#endif /* _HLIST_H */
-- 
GitLab