[PATCH 8/8] Remove cfg_foreach
Ladislav Michl <[email protected]> Tue, 4 Dec 2018 22:28:31 +0100
| Newsgroups | gmane.linux.drivers.gnokii |
|---|---|
| Message-ID | <20181204212831.GI10937@lenoch> |
cfg_foreach is no longer used, so remove it.
---
common/cfgreader.c | 23 -----------------------
include/gnokii-internal.h | 2 --
2 files changed, 25 deletions(-)
diff --git a/common/cfgreader.c b/common/cfgreader.c
index 5204f82d..d440daf7 100644
--- a/common/cfgreader.c
+++ b/common/cfgreader.c
@@ -651,29 +651,6 @@ int cfg_section_exists(struct gn_cfg_header *cfg, const char *section)
return false;
}
-/*
- * Return all the entries of the given section.
- */
-void cfg_foreach(const char *section, cfg_foreach_func func)
-{
- struct gn_cfg_header *h;
- struct gn_cfg_entry *e;
- struct gn_cfg_header *cfg = gn_cfg_info;
-
- if ((cfg == NULL) || (section == NULL) || (func == NULL)) {
- return;
- }
-
- /* Search for section name */
- for (h = cfg; h != NULL; h = h->next) {
- if (strcmp(section, h->section) == 0) {
- /* Search for key within section */
- for (e = h->entries; e != NULL; e = e->next)
- (*func)(section, e->key, e->value);
- }
- }
-}
-
/* Set the value of a key in a config file. Return the new value if
the section/key can be found, else return NULL. */
char *cfg_set(struct gn_cfg_header *cfg, const char *section, const char *key,
diff --git a/include/gnokii-internal.h b/include/gnokii-internal.h
index e02e44ea..75e4ccaa 100644
--- a/include/gnokii-internal.h
+++ b/include/gnokii-internal.h
@@ -154,8 +154,6 @@ int sms_nokia_text_encode(unsigned char *text, unsigned char *message, bool firs
int sms_nokia_bitmap_encode(gn_bmp *bitmap, unsigned char *message, bool first);
struct gn_cfg_header *cfg_file_read(const char *filename);
-typedef void (*cfg_foreach_func)(const char *section, const char *key, const char *value);
-void cfg_foreach(const char *section, cfg_foreach_func func);
char *cfg_set(struct gn_cfg_header *cfg, const char *section, const char *key, const char *value);
int cfg_file_write(struct gn_cfg_header *cfg, const char *filename);
/* Get some information about the given phone */
--
2.20.0.rc2