[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181115223640.411-12-stephen@networkplumber.org>
Date: Thu, 15 Nov 2018 14:36:29 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: netdev@...r.kernel.org
Cc: Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH iproute2 11/22] tc: drop unused name_to_id function
Not used in current code.
Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
---
include/names.h | 1 -
lib/names.c | 28 ----------------------------
2 files changed, 29 deletions(-)
diff --git a/include/names.h b/include/names.h
index 3e5d3b146a23..2fcaacc398d4 100644
--- a/include/names.h
+++ b/include/names.h
@@ -22,6 +22,5 @@ int db_names_load(struct db_names *db, const char *path);
void db_names_free(struct db_names *db);
char *id_to_name(struct db_names *db, int id, char *name);
-int name_to_id(struct db_names *db, int *id, const char *name);
#endif
diff --git a/lib/names.c b/lib/names.c
index fbd6503f22d4..b46ea7910946 100644
--- a/lib/names.c
+++ b/lib/names.c
@@ -150,31 +150,3 @@ char *id_to_name(struct db_names *db, int id, char *name)
snprintf(name, IDNAME_MAX, "%d", id);
return NULL;
}
-
-int name_to_id(struct db_names *db, int *id, const char *name)
-{
- struct db_entry *entry;
- int i;
-
- if (!db)
- return -1;
-
- if (db->cached && strcmp(db->cached->name, name) == 0) {
- *id = db->cached->id;
- return 0;
- }
-
- for (i = 0; i < db->size; i++) {
- entry = db->hash[i];
- while (entry && strcmp(entry->name, name))
- entry = entry->next;
-
- if (entry) {
- db->cached = entry;
- *id = entry->id;
- return 0;
- }
- }
-
- return -1;
-}
--
2.17.1
Powered by blists - more mailing lists