summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2013-06-05 19:20:52 -0400
committerAnthony G. Basile <blueness@gentoo.org>2013-06-05 19:20:52 -0400
commitc36cba5bc1c783f87b0ada8a8b42303bfadeaf0a (patch)
treea8027ec35d6c7bbc5f6a168ab3bfae569f66ed1c
parent58daf39a6c4002a9dd89690d88ce2ec41b2a7ea3 (diff)
Remove unused functions from src/libudev/{conf-files,exit-status,hashmap,log,path-util,set,strv}.c
A lot of upstream commits cross many boundaries between systemd code and udev code. The point of intersection is upstreams src/shared folder. The best way we find to track them is to apply their commits to udev and libudev and then just pick remove functions from the shared folder. Its timely but it gives us the best control over what gets in and what doesnt. In this commit we removed the following functions: conf_files_list_nulstr exit_status_to_string is_clean_exit_lsb uint64_hash_func uint64_compare_func hashmap_free_free_free hashmap_update hashmap_get2 hashmap_remove_and_replace hashmap_remove_value hashmap_steal_first_key hashmap_next log_forget_fds log_set_facility log_meta_object log_struct_internal log_set_target_from_string log_set_max_level_from_string log_get_target log_get_max_level log_show_color_from_string log_show_location_from_string log_on_console is_path path_split_and_make_absolute set_ensure_allocated set_replace set_remove_and_put set_size set_isempty set_iterate_skip set_steal_first set_first set_last set_merge set_move_one set_copy set_clear_free set_get_strv strv_find_prefix strv_merge_concat strv_split_newlines strv_join strv_remove_prefix strv_parse_nulstr strv_overlap strv_sort strv_print Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
-rw-r--r--src/libudev/conf-files.c13
-rw-r--r--src/libudev/conf-files.h1
-rw-r--r--src/libudev/exit-status.c144
-rw-r--r--src/libudev/exit-status.h3
-rw-r--r--src/libudev/hashmap.c137
-rw-r--r--src/libudev/hashmap.h9
-rw-r--r--src/libudev/log.c203
-rw-r--r--src/libudev/log.h31
-rw-r--r--src/libudev/path-util.c19
-rw-r--r--src/libudev/path-util.h2
-rw-r--r--src/libudev/set.c56
-rw-r--r--src/libudev/set.h18
-rw-r--r--src/libudev/strv.c209
-rw-r--r--src/libudev/strv.h12
14 files changed, 0 insertions, 857 deletions
diff --git a/src/libudev/conf-files.c b/src/libudev/conf-files.c
index 6d99739353..5938481f6b 100644
--- a/src/libudev/conf-files.c
+++ b/src/libudev/conf-files.c
@@ -163,16 +163,3 @@ int conf_files_list(char ***strv, const char *suffix, const char *root, const ch
return conf_files_list_strv_internal(strv, suffix, root, dirs);
}
-
-int conf_files_list_nulstr(char ***strv, const char *suffix, const char *root, const char *d) {
- _cleanup_strv_free_ char **dirs = NULL;
-
- assert(strv);
- assert(suffix);
-
- dirs = strv_split_nulstr(d);
- if (!dirs)
- return -ENOMEM;
-
- return conf_files_list_strv_internal(strv, suffix, root, dirs);
-}
diff --git a/src/libudev/conf-files.h b/src/libudev/conf-files.h
index 3bd3d2f3d4..73afe19b97 100644
--- a/src/libudev/conf-files.h
+++ b/src/libudev/conf-files.h
@@ -27,6 +27,5 @@
int conf_files_list(char ***strv, const char *suffix, const char *root, const char *dir, ...);
int conf_files_list_strv(char ***strv, const char *suffix, const char *root, const char* const* dirs);
-int conf_files_list_nulstr(char ***strv, const char *suffix, const char *root, const char *dirs);
#endif
diff --git a/src/libudev/exit-status.c b/src/libudev/exit-status.c
index 45131f2b2a..1db11d3407 100644
--- a/src/libudev/exit-status.c
+++ b/src/libudev/exit-status.c
@@ -26,140 +26,6 @@
#include "set.h"
#include "macro.h"
-const char* exit_status_to_string(ExitStatus status, ExitStatusLevel level) {
-
- /* We cast to int here, so that -Wenum doesn't complain that
- * EXIT_SUCCESS/EXIT_FAILURE aren't in the enum */
-
- switch ((int) status) {
-
- case EXIT_SUCCESS:
- return "SUCCESS";
-
- case EXIT_FAILURE:
- return "FAILURE";
- }
-
-
- if (level == EXIT_STATUS_SYSTEMD || level == EXIT_STATUS_LSB) {
- switch ((int) status) {
-
- case EXIT_CHDIR:
- return "CHDIR";
-
- case EXIT_NICE:
- return "NICE";
-
- case EXIT_FDS:
- return "FDS";
-
- case EXIT_EXEC:
- return "EXEC";
-
- case EXIT_MEMORY:
- return "MEMORY";
-
- case EXIT_LIMITS:
- return "LIMITS";
-
- case EXIT_OOM_ADJUST:
- return "OOM_ADJUST";
-
- case EXIT_SIGNAL_MASK:
- return "SIGNAL_MASK";
-
- case EXIT_STDIN:
- return "STDIN";
-
- case EXIT_STDOUT:
- return "STDOUT";
-
- case EXIT_CHROOT:
- return "CHROOT";
-
- case EXIT_IOPRIO:
- return "IOPRIO";
-
- case EXIT_TIMERSLACK:
- return "TIMERSLACK";
-
- case EXIT_SECUREBITS:
- return "SECUREBITS";
-
- case EXIT_SETSCHEDULER:
- return "SETSCHEDULER";
-
- case EXIT_CPUAFFINITY:
- return "CPUAFFINITY";
-
- case EXIT_GROUP:
- return "GROUP";
-
- case EXIT_USER:
- return "USER";
-
- case EXIT_CAPABILITIES:
- return "CAPABILITIES";
-
- case EXIT_CGROUP:
- return "CGROUP";
-
- case EXIT_SETSID:
- return "SETSID";
-
- case EXIT_CONFIRM:
- return "CONFIRM";
-
- case EXIT_STDERR:
- return "STDERR";
-
- case EXIT_TCPWRAP:
- return "TCPWRAP";
-
- case EXIT_PAM:
- return "PAM";
-
- case EXIT_NETWORK:
- return "NETWORK";
-
- case EXIT_NAMESPACE:
- return "NAMESPACE";
-
- case EXIT_NO_NEW_PRIVILEGES:
- return "NO_NEW_PRIVILEGES";
-
- case EXIT_SECCOMP:
- return "SECCOMP";
- }
- }
-
- if (level == EXIT_STATUS_LSB) {
- switch ((int) status) {
-
- case EXIT_INVALIDARGUMENT:
- return "INVALIDARGUMENT";
-
- case EXIT_NOTIMPLEMENTED:
- return "NOTIMPLEMENTED";
-
- case EXIT_NOPERMISSION:
- return "NOPERMISSION";
-
- case EXIT_NOTINSTALLED:
- return "NOTINSSTALLED";
-
- case EXIT_NOTCONFIGURED:
- return "NOTCONFIGURED";
-
- case EXIT_NOTRUNNING:
- return "NOTRUNNING";
- }
- }
-
- return NULL;
-}
-
-
bool is_clean_exit(int code, int status, ExitStatusSet *success_status) {
if (code == CLD_EXITED)
@@ -180,13 +46,3 @@ bool is_clean_exit(int code, int status, ExitStatusSet *success_status) {
return false;
}
-
-bool is_clean_exit_lsb(int code, int status, ExitStatusSet *success_status) {
-
- if (is_clean_exit(code, status, success_status))
- return true;
-
- return
- code == CLD_EXITED &&
- (status == EXIT_NOTINSTALLED || status == EXIT_NOTCONFIGURED);
-}
diff --git a/src/libudev/exit-status.h b/src/libudev/exit-status.h
index 58f734b6f2..8cf4e5e9a2 100644
--- a/src/libudev/exit-status.h
+++ b/src/libudev/exit-status.h
@@ -84,7 +84,4 @@ typedef struct ExitStatusSet {
Set *signal;
} ExitStatusSet;
-const char* exit_status_to_string(ExitStatus status, ExitStatusLevel level) _const_;
-
bool is_clean_exit(int code, int status, ExitStatusSet *success_status);
-bool is_clean_exit_lsb(int code, int status, ExitStatusSet *success_status);
diff --git a/src/libudev/hashmap.c b/src/libudev/hashmap.c
index 9f7db34397..863312cc6c 100644
--- a/src/libudev/hashmap.c
+++ b/src/libudev/hashmap.c
@@ -157,15 +157,6 @@ unsigned uint64_hash_func(const void *p) {
return (unsigned) ((u >> 32) ^ u);
}
-int uint64_compare_func(const void *_a, const void *_b) {
- uint64_t a, b;
-
- a = *(const uint64_t*) _a;
- b = *(const uint64_t*) _b;
-
- return a < b ? -1 : (a > b ? 1 : 0);
-}
-
Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func) {
bool b;
Hashmap *h;
@@ -309,17 +300,6 @@ void hashmap_free_free(Hashmap *h) {
hashmap_free(h);
}
-void hashmap_free_free_free(Hashmap *h) {
-
- /* Free the hashmap and all data and key objects in it */
-
- if (!h)
- return;
-
- hashmap_clear_free_free(h);
- hashmap_free(h);
-}
-
void hashmap_clear(Hashmap *h) {
if (!h)
return;
@@ -416,21 +396,6 @@ int hashmap_replace(Hashmap *h, const void *key, void *value) {
return hashmap_put(h, key, value);
}
-int hashmap_update(Hashmap *h, const void *key, void *value) {
- struct hashmap_entry *e;
- unsigned hash;
-
- assert(h);
-
- hash = h->hash_func(key) % NBUCKETS;
- e = hash_scan(h, hash, key);
- if (!e)
- return -ENOENT;
-
- e->value = value;
- return 0;
-}
-
void* hashmap_get(Hashmap *h, const void *key) {
unsigned hash;
struct hashmap_entry *e;
@@ -446,24 +411,6 @@ void* hashmap_get(Hashmap *h, const void *key) {
return e->value;
}
-void* hashmap_get2(Hashmap *h, const void *key, void **key2) {
- unsigned hash;
- struct hashmap_entry *e;
-
- if (!h)
- return NULL;
-
- hash = h->hash_func(key) % NBUCKETS;
- e = hash_scan(h, hash, key);
- if (!e)
- return NULL;
-
- if (key2)
- *key2 = (void*) e->key;
-
- return e->value;
-}
-
bool hashmap_contains(Hashmap *h, const void *key) {
unsigned hash;
@@ -522,53 +469,6 @@ int hashmap_remove_and_put(Hashmap *h, const void *old_key, const void *new_key,
return 0;
}
-int hashmap_remove_and_replace(Hashmap *h, const void *old_key, const void *new_key, void *value) {
- struct hashmap_entry *e, *k;
- unsigned old_hash, new_hash;
-
- if (!h)
- return -ENOENT;
-
- old_hash = h->hash_func(old_key) % NBUCKETS;
- if (!(e = hash_scan(h, old_hash, old_key)))
- return -ENOENT;
-
- new_hash = h->hash_func(new_key) % NBUCKETS;
-
- if ((k = hash_scan(h, new_hash, new_key)))
- if (e != k)
- remove_entry(h, k);
-
- unlink_entry(h, e, old_hash);
-
- e->key = new_key;
- e->value = value;
-
- link_entry(h, e, new_hash);
-
- return 0;
-}
-
-void* hashmap_remove_value(Hashmap *h, const void *key, void *value) {
- struct hashmap_entry *e;
- unsigned hash;
-
- if (!h)
- return NULL;
-
- hash = h->hash_func(key) % NBUCKETS;
-
- if (!(e = hash_scan(h, hash, key)))
- return NULL;
-
- if (e->value != value)
- return NULL;
-
- remove_entry(h, e);
-
- return value;
-}
-
void *hashmap_iterate(Hashmap *h, Iterator *i, const void **key) {
struct hashmap_entry *e;
@@ -704,21 +604,6 @@ void* hashmap_steal_first(Hashmap *h) {
return data;
}
-void* hashmap_steal_first_key(Hashmap *h) {
- void *key;
-
- if (!h)
- return NULL;
-
- if (!h->iterate_list_head)
- return NULL;
-
- key = (void*) h->iterate_list_head->key;
- remove_entry(h, h->iterate_list_head);
-
- return key;
-}
-
unsigned hashmap_size(Hashmap *h) {
if (!h)
@@ -838,25 +723,3 @@ char **hashmap_get_strv(Hashmap *h) {
return sv;
}
-
-void *hashmap_next(Hashmap *h, const void *key) {
- unsigned hash;
- struct hashmap_entry *e;
-
- assert(h);
- assert(key);
-
- if (!h)
- return NULL;
-
- hash = h->hash_func(key) % NBUCKETS;
- e = hash_scan(h, hash, key);
- if (!e)
- return NULL;
-
- e = e->iterate_next;
- if (!e)
- return NULL;
-
- return e->value;
-}
diff --git a/src/libudev/hashmap.h b/src/libudev/hashmap.h
index 15b7e27585..d9995dbda5 100644
--- a/src/libudev/hashmap.h
+++ b/src/libudev/hashmap.h
@@ -50,25 +50,19 @@ unsigned trivial_hash_func(const void *p) _const_;
int trivial_compare_func(const void *a, const void *b) _const_;
unsigned uint64_hash_func(const void *p) _pure_;
-int uint64_compare_func(const void *a, const void *b) _pure_;
Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func);
void hashmap_free(Hashmap *h);
void hashmap_free_free(Hashmap *h);
-void hashmap_free_free_free(Hashmap *h);
Hashmap *hashmap_copy(Hashmap *h);
int hashmap_ensure_allocated(Hashmap **h, hash_func_t hash_func, compare_func_t compare_func);
int hashmap_put(Hashmap *h, const void *key, void *value);
-int hashmap_update(Hashmap *h, const void *key, void *value);
int hashmap_replace(Hashmap *h, const void *key, void *value);
void *hashmap_get(Hashmap *h, const void *key);
-void *hashmap_get2(Hashmap *h, const void *key, void **rkey);
bool hashmap_contains(Hashmap *h, const void *key);
void *hashmap_remove(Hashmap *h, const void *key);
-void *hashmap_remove_value(Hashmap *h, const void *key, void *value);
int hashmap_remove_and_put(Hashmap *h, const void *old_key, const void *new_key, void *value);
-int hashmap_remove_and_replace(Hashmap *h, const void *old_key, const void *new_key, void *value);
int hashmap_merge(Hashmap *h, Hashmap *other);
void hashmap_move(Hashmap *h, Hashmap *other);
@@ -86,13 +80,10 @@ void hashmap_clear_free(Hashmap *h);
void hashmap_clear_free_free(Hashmap *h);
void *hashmap_steal_first(Hashmap *h);
-void *hashmap_steal_first_key(Hashmap *h);
void *hashmap_first(Hashmap *h) _pure_;
void *hashmap_first_key(Hashmap *h) _pure_;
void *hashmap_last(Hashmap *h) _pure_;
-void *hashmap_next(Hashmap *h, const void *key);
-
char **hashmap_get_strv(Hashmap *h);
#define HASHMAP_FOREACH(e, h, i) \
diff --git a/src/libudev/log.c b/src/libudev/log.c
index 778c0e2ea9..64baa9a3b3 100644
--- a/src/libudev/log.c
+++ b/src/libudev/log.c
@@ -287,20 +287,12 @@ void log_close(void) {
log_close_console();
}
-void log_forget_fds(void) {
- console_fd = kmsg_fd = syslog_fd = journal_fd = -1;
-}
-
void log_set_max_level(int level) {
assert((level & LOG_PRIMASK) == level);
log_max_level = level;
}
-void log_set_facility(int facility) {
- log_facility = facility;
-}
-
static int write_to_console(
int level,
const char*file,
@@ -661,26 +653,6 @@ int log_metav_object(
object_name, object, buffer);
}
-int log_meta_object(
- int level,
- const char*file,
- int line,
- const char *func,
- const char *object_name,
- const char *object,
- const char *format, ...) {
-
- int r;
- va_list ap;
-
- va_start(ap, format);
- r = log_metav_object(level, file, line, func,
- object_name, object, format, ap);
- va_end(ap);
-
- return r;
-}
-
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
_noreturn_ static void log_assert(const char *text, const char *file, int line, const char *func, const char *format) {
@@ -709,152 +681,6 @@ int log_oom_internal(const char *file, int line, const char *func) {
return -ENOMEM;
}
-int log_struct_internal(
- int level,
- const char *file,
- int line,
- const char *func,
- const char *format, ...) {
-
- PROTECT_ERRNO;
- va_list ap;
- int r;
-
- if (_likely_(LOG_PRI(level) > log_max_level))
- return 0;
-
- if (log_target == LOG_TARGET_NULL)
- return 0;
-
- if ((level & LOG_FACMASK) == 0)
- level = log_facility | LOG_PRI(level);
-
- if ((log_target == LOG_TARGET_AUTO ||
- log_target == LOG_TARGET_JOURNAL_OR_KMSG ||
- log_target == LOG_TARGET_JOURNAL) &&
- journal_fd >= 0) {
-
- char header[LINE_MAX];
- struct iovec iovec[17] = {};
- unsigned n = 0, i;
- struct msghdr mh = {
- .msg_iov = iovec,
- };
- static const char nl = '\n';
-
- /* If the journal is available do structured logging */
- log_do_header(header, sizeof(header), level,
- file, line, func, NULL, NULL);
- IOVEC_SET_STRING(iovec[n++], header);
-
- va_start(ap, format);
- while (format && n + 1 < ELEMENTSOF(iovec)) {
- char *buf;
- va_list aq;
-
- /* We need to copy the va_list structure,
- * since vasprintf() leaves it afterwards at
- * an undefined location */
-
- va_copy(aq, ap);
- if (vasprintf(&buf, format, aq) < 0) {
- va_end(aq);
- r = -ENOMEM;
- goto finish;
- }
- va_end(aq);
-
- /* Now, jump enough ahead, so that we point to
- * the next format string */
- VA_FORMAT_ADVANCE(format, ap);
-
- IOVEC_SET_STRING(iovec[n++], buf);
-
- iovec[n].iov_base = (char*) &nl;
- iovec[n].iov_len = 1;
- n++;
-
- format = va_arg(ap, char *);
- }
-
- mh.msg_iovlen = n;
-
- if (sendmsg(journal_fd, &mh, MSG_NOSIGNAL) < 0)
- r = -errno;
- else
- r = 1;
-
- finish:
- va_end(ap);
- for (i = 1; i < n; i += 2)
- free(iovec[i].iov_base);
-
- } else {
- char buf[LINE_MAX];
- bool found = false;
-
- /* Fallback if journal logging is not available */
-
- va_start(ap, format);
- while (format) {
- va_list aq;
-
- va_copy(aq, ap);
- vsnprintf(buf, sizeof(buf), format, aq);
- va_end(aq);
- char_array_0(buf);
-
- if (startswith(buf, "MESSAGE=")) {
- found = true;
- break;
- }
-
- VA_FORMAT_ADVANCE(format, ap);
-
- format = va_arg(ap, char *);
- }
- va_end(ap);
-
- if (found)
- r = log_dispatch(level, file, line, func,
- NULL, NULL, buf + 8);
- else
- r = -EINVAL;
- }
-
- return r;
-}
-
-int log_set_target_from_string(const char *e) {
- LogTarget t;
-
- t = log_target_from_string(e);
- if (t < 0)
- return -EINVAL;
-
- log_set_target(t);
- return 0;
-}
-
-int log_set_max_level_from_string(const char *e) {
- int t;
-
- t = log_level_from_string(e);
- if (t < 0)
- return t;
-
- log_set_max_level(t);
- return 0;
-}
-
-LogTarget log_get_target(void) {
- return log_target;
-}
-
-int log_get_max_level(void) {
- return log_max_level;
-}
-
void log_show_color(bool b) {
show_color = b;
}
@@ -863,35 +689,6 @@ void log_show_location(bool b) {
show_location = b;
}
-int log_show_color_from_string(const char *e) {
- int t;
-
- t = parse_boolean(e);
- if (t < 0)
- return t;
-
- log_show_color(t);
- return 0;
-}
-
-int log_show_location_from_string(const char *e) {
- int t;
-
- t = parse_boolean(e);
- if (t < 0)
- return t;
-
- log_show_location(t);
- return 0;
-}
-
-bool log_on_console(void) {
- if (log_target == LOG_TARGET_CONSOLE)
- return true;
-
- return syslog_fd < 0 && kmsg_fd < 0 && journal_fd < 0;
-}
-
static const char *const log_target_table[] = {
[LOG_TARGET_CONSOLE] = "console",
[LOG_TARGET_KMSG] = "kmsg",
diff --git a/src/libudev/log.h b/src/libudev/log.h
index d47983c0da..fde84724e8 100644
--- a/src/libudev/log.h
+++ b/src/libudev/log.h
@@ -44,23 +44,12 @@ typedef enum LogTarget{
void log_set_target(LogTarget target);
void log_set_max_level(int level);
-void log_set_facility(int facility);
-
-int log_set_target_from_string(const char *e);
-int log_set_max_level_from_string(const char *e);
void log_show_color(bool b);
void log_show_location(bool b);
-int log_show_color_from_string(const char *e);
-int log_show_location_from_string(const char *e);
-
-LogTarget log_get_target(void) _pure_;
-int log_get_max_level(void) _pure_;
-
int log_open(void);
void log_close(void);
-void log_forget_fds(void);
void log_close_syslog(void);
void log_close_journal(void);
@@ -82,15 +71,6 @@ int log_metav(
const char *format,
va_list ap) _printf_attr_(5,0);
-int log_meta_object(
- int level,
- const char*file,
- int line,
- const char *func,
- const char *object_name,
- const char *object,
- const char *format, ...) _printf_attr_(7,8);
-
int log_metav_object(
int level,
const char*file,
@@ -101,13 +81,6 @@ int log_metav_object(
const char *format,
va_list ap) _printf_attr_(7,0);
-int log_struct_internal(
- int level,
- const char *file,
- int line,
- const char *func,
- const char *format, ...) _printf_attr_(5,0) _sentinel_;
-
int log_oom_internal(
const char *file,
int line,
@@ -141,15 +114,11 @@ _noreturn_ void log_assert_failed_unreachable(
#define log_warning(...) log_meta(LOG_WARNING, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define log_error(...) log_meta(LOG_ERR, __FILE__, __LINE__, __func__, __VA_ARGS__)
-#define log_struct(level, ...) log_struct_internal(level, __FILE__, __LINE__, __func__, __VA_ARGS__)
-
#define log_oom() log_oom_internal(__FILE__, __LINE__, __func__)
/* This modifies the buffer passed! */
#define log_dump(level, buffer) log_dump_internal(level, __FILE__, __LINE__, __func__, buffer)
-bool log_on_console(void) _pure_;
-
const char *log_target_to_string(LogTarget target) _const_;
LogTarget log_target_from_string(const char *s) _pure_;
diff --git a/src/libudev/path-util.c b/src/libudev/path-util.c
index d7f21b3322..d87e60ac8b 100644
--- a/src/libudev/path-util.c
+++ b/src/libudev/path-util.c
@@ -41,10 +41,6 @@ bool path_is_absolute(const char *p) {
return p[0] == '/';
}
-bool is_path(const char *p) {
- return !!strchr(p, '/');
-}
-
char *path_get_file_name(const char *p) {
char *r;
@@ -98,21 +94,6 @@ int path_get_parent(const char *path, char **_r) {
return 0;
}
-char **path_split_and_make_absolute(const char *p) {
- char **l;
- assert(p);
-
- if (!(l = strv_split(p, ":")))
- return NULL;
-
- if (!path_strv_make_absolute_cwd(l)) {
- strv_free(l);
- return NULL;
- }
-
- return l;
-}
-
char *path_make_absolute(const char *p, const char *prefix) {
assert(p);
diff --git a/src/libudev/path-util.h b/src/libudev/path-util.h
index 78413c9aa2..9749cde66b 100644
--- a/src/libudev/path-util.h
+++ b/src/libudev/path-util.h
@@ -23,8 +23,6 @@
#include <stdbool.h>
-bool is_path(const char *p) _pure_;
-char** path_split_and_make_absolute(const char *p);
char* path_get_file_name(const char *p) _pure_;
int path_get_parent(const char *path, char **parent);
bool path_is_absolute(const char *p) _pure_;
diff --git a/src/libudev/set.c b/src/libudev/set.c
index 5f83c50839..0dcfcb10b9 100644
--- a/src/libudev/set.c
+++ b/src/libudev/set.c
@@ -41,18 +41,10 @@ void set_free_free(Set *s) {
hashmap_free_free(MAKE_HASHMAP(s));
}
-int set_ensure_allocated(Set **s, hash_func_t hash_func, compare_func_t compare_func) {
- return hashmap_ensure_allocated((Hashmap**) s, hash_func, compare_func);
-}
-
int set_put(Set *s, void *value) {
return hashmap_put(MAKE_HASHMAP(s), value, value);
}
-int set_replace(Set *s, void *value) {
- return hashmap_replace(MAKE_HASHMAP(s), value, value);
-}
-
void *set_get(Set *s, void *value) {
return hashmap_get(MAKE_HASHMAP(s), value);
}
@@ -65,18 +57,6 @@ void *set_remove(Set *s, void *value) {
return hashmap_remove(MAKE_HASHMAP(s), value);
}
-int set_remove_and_put(Set *s, void *old_value, void *new_value) {
- return hashmap_remove_and_put(MAKE_HASHMAP(s), old_value, new_value, new_value);
-}
-
-unsigned set_size(Set *s) {
- return hashmap_size(MAKE_HASHMAP(s));
-}
-
-bool set_isempty(Set *s) {
- return hashmap_isempty(MAKE_HASHMAP(s));
-}
-
void *set_iterate(Set *s, Iterator *i) {
return hashmap_iterate(MAKE_HASHMAP(s), i, NULL);
}
@@ -85,46 +65,10 @@ void *set_iterate_backwards(Set *s, Iterator *i) {
return hashmap_iterate_backwards(MAKE_HASHMAP(s), i, NULL);
}
-void *set_iterate_skip(Set *s, void *value, Iterator *i) {
- return hashmap_iterate_skip(MAKE_HASHMAP(s), value, i);
-}
-
-void *set_steal_first(Set *s) {
- return hashmap_steal_first(MAKE_HASHMAP(s));
-}
-
-void* set_first(Set *s) {
- return hashmap_first(MAKE_HASHMAP(s));
-}
-
-void* set_last(Set *s) {
- return hashmap_last(MAKE_HASHMAP(s));
-}
-
-int set_merge(Set *s, Set *other) {
- return hashmap_merge(MAKE_HASHMAP(s), MAKE_HASHMAP(other));
-}
-
void set_move(Set *s, Set *other) {
return hashmap_move(MAKE_HASHMAP(s), MAKE_HASHMAP(other));
}
-int set_move_one(Set *s, Set *other, void *value) {
- return hashmap_move_one(MAKE_HASHMAP(s), MAKE_HASHMAP(other), value);
-}
-
-Set* set_copy(Set *s) {
- return MAKE_SET(hashmap_copy(MAKE_HASHMAP(s)));
-}
-
void set_clear(Set *s) {
hashmap_clear(MAKE_HASHMAP(s));
}
-
-void set_clear_free(Set *s) {
- hashmap_clear_free(MAKE_HASHMAP(s));
-}
-
-char **set_get_strv(Set *s) {
- return hashmap_get_strv(MAKE_HASHMAP(s));
-}
diff --git a/src/libudev/set.h b/src/libudev/set.h
index 8864f7b34e..1787d0df18 100644
--- a/src/libudev/set.h
+++ b/src/libudev/set.h
@@ -42,35 +42,17 @@ static inline void set_free_freep(Set **s) {
set_free_free(*s);
}
-Set* set_copy(Set *s);
-int set_ensure_allocated(Set **s, hash_func_t hash_func, compare_func_t compare_func);
-
int set_put(Set *s, void *value);
-int set_replace(Set *s, void *value);
void *set_get(Set *s, void *value);
bool set_contains(Set *s, void *value);
void *set_remove(Set *s, void *value);
-int set_remove_and_put(Set *s, void *old_value, void *new_value);
-int set_merge(Set *s, Set *other);
void set_move(Set *s, Set *other);
-int set_move_one(Set *s, Set *other, void *value);
-
-unsigned set_size(Set *s);
-bool set_isempty(Set *s);
void *set_iterate(Set *s, Iterator *i);
void *set_iterate_backwards(Set *s, Iterator *i);
-void *set_iterate_skip(Set *s, void *value, Iterator *i);
void set_clear(Set *s);
-void set_clear_free(Set *s);
-
-void *set_steal_first(Set *s);
-void* set_first(Set *s);
-void* set_last(Set *s);
-
-char **set_get_strv(Set *s);
#define SET_FOREACH(e, s, i) \
for ((i) = ITERATOR_FIRST, (e) = set_iterate((s), &(i)); (e); (e) = set_iterate((s), &(i)))
diff --git a/src/libudev/strv.c b/src/libudev/strv.c
index a5ce7e9593..d2b083218a 100644
--- a/src/libudev/strv.c
+++ b/src/libudev/strv.c
@@ -40,18 +40,6 @@ char *strv_find(char **l, const char *name) {
return NULL;
}
-char *strv_find_prefix(char **l, const char *name) {
- char **i;
-
- assert(name);
-
- STRV_FOREACH(i, l)
- if (startswith(*i, name))
- return *i;
-
- return NULL;
-}
-
void strv_free(char **l) {
char **k;
@@ -199,41 +187,6 @@ fail:
return NULL;
}
-char **strv_merge_concat(char **a, char **b, const char *suffix) {
- char **r, **k;
-
- /* Like strv_merge(), but appends suffix to all strings in b, before adding */
-
- if (!b)
- return strv_copy(a);
-
- r = new(char*, strv_length(a) + strv_length(b) + 1);
- if (!r)
- return NULL;
-
- k = r;
- if (a)
- for (; *a; k++, a++) {
- *k = strdup(*a);
- if (!*k)
- goto fail;
- }
-
- for (; *b; k++, b++) {
- *k = strappend(*b, suffix);
- if (!*k)
- goto fail;
- }
-
- *k = NULL;
- return r;
-
-fail:
- strv_free(r);
- return NULL;
-
-}
-
char **strv_split(const char *s, const char *separator) {
char *state;
char *w;
@@ -297,65 +250,6 @@ char **strv_split_quoted(const char *s) {
return r;
}
-char **strv_split_newlines(const char *s) {
- char **l;
- unsigned n;
-
- assert(s);
-
- /* Special version of strv_split() that splits on newlines and
- * suppresses an empty string at the end */
-
- l = strv_split(s, NEWLINE);
- if (!l)
- return NULL;
-
- n = strv_length(l);
- if (n <= 0)
- return l;
-
- if (isempty(l[n-1])) {
- free(l[n-1]);
- l[n-1] = NULL;
- }
-
- return l;
-}
-
-char *strv_join(char **l, const char *separator) {
- char *r, *e;
- char **s;
- size_t n, k;
-
- if (!separator)
- separator = " ";
-
- k = strlen(separator);
-
- n = 0;
- STRV_FOREACH(s, l) {
- if (n != 0)
- n += k;
- n += strlen(*s);
- }
-
- r = new(char, n+1);
- if (!r)
- return NULL;
-
- e = r;
- STRV_FOREACH(s, l) {
- if (e != r)
- e = stpcpy(e, separator);
-
- e = stpcpy(e, *s);
- }
-
- *e = 0;
-
- return r;
-}
-
char **strv_append(char **l, const char *s) {
char **r, **k;
@@ -461,77 +355,6 @@ char **strv_remove(char **l, const char *s) {
return l;
}
-char **strv_remove_prefix(char **l, const char *s) {
- char **f, **t;
-
- if (!l)
- return NULL;
-
- assert(s);
-
- /* Drops every occurrence of a string prefixed with s in the
- * string list, edits in-place. */
-
- for (f = t = l; *f; f++) {
-
- if (startswith(*f, s)) {
- free(*f);
- continue;
- }
-
- *(t++) = *f;
- }
-
- *t = NULL;
- return l;
-}
-
-char **strv_parse_nulstr(const char *s, size_t l) {
- const char *p;
- unsigned c = 0, i = 0;
- char **v;
-
- assert(s || l <= 0);
-
- if (l <= 0)
- return strv_new(NULL, NULL);
-
- for (p = s; p < s + l; p++)
- if (*p == 0)
- c++;
-
- if (s[l-1] != 0)
- c++;
-
- v = new0(char*, c+1);
- if (!v)
- return NULL;
-
- p = s;
- while (p < s + l) {
- const char *e;
-
- e = memchr(p, 0, s + l - p);
-
- v[i] = strndup(p, e ? e - p : s + l - p);
- if (!v[i]) {
- strv_free(v);
- return NULL;
- }
-
- i++;
-
- if (!e)
- break;
-
- p = e + 1;
- }
-
- assert(i == c);
-
- return v;
-}
-
char **strv_split_nulstr(const char *s) {
const char *i;
char **r = NULL;
@@ -548,40 +371,8 @@ char **strv_split_nulstr(const char *s) {
return r;
}
-bool strv_overlap(char **a, char **b) {
- char **i, **j;
-
- STRV_FOREACH(i, a) {
- STRV_FOREACH(j, b) {
- if (streq(*i, *j))
- return true;
- }
- }
-
- return false;
-}
-
static int str_compare(const void *_a, const void *_b) {
const char **a = (const char**) _a, **b = (const char**) _b;
return strcmp(*a, *b);
}
-
-char **strv_sort(char **l) {
-
- if (strv_isempty(l))
- return l;
-
- qsort(l, strv_length(l), sizeof(char*), str_compare);
- return l;
-}
-
-void strv_print(char **l) {
- char **s;
-
- if (!l)
- return;
-
- STRV_FOREACH(s, l)
- puts(*s);
-}
diff --git a/src/libudev/strv.h b/src/libudev/strv.h
index e35118752f..aaab71fc34 100644
--- a/src/libudev/strv.h
+++ b/src/libudev/strv.h
@@ -27,7 +27,6 @@
#include "macro.h"
char *strv_find(char **l, const char *name) _pure_;
-char *strv_find_prefix(char **l, const char *name) _pure_;
void strv_free(char **l);
static inline void strv_freep(char ***l) {
@@ -40,13 +39,11 @@ char **strv_copy(char * const *l);
unsigned strv_length(char * const *l) _pure_;
char **strv_merge(char **a, char **b);
-char **strv_merge_concat(char **a, char **b, const char *suffix);
char **strv_append(char **l, const char *s);
int strv_extend(char ***l, const char *value);
int strv_push(char ***l, char *value);
char **strv_remove(char **l, const char *s);
-char **strv_remove_prefix(char **l, const char *s);
char **strv_uniq(char **l);
#define strv_contains(l, s) (!!strv_find((l), (s)))
@@ -64,15 +61,9 @@ static inline bool strv_isempty(char * const *l) {
char **strv_split(const char *s, const char *separator);
char **strv_split_quoted(const char *s);
-char **strv_split_newlines(const char *s);
-char *strv_join(char **l, const char *separator);
-
-char **strv_parse_nulstr(const char *s, size_t l);
char **strv_split_nulstr(const char *s);
-bool strv_overlap(char **a, char **b) _pure_;
-
#define STRV_FOREACH(s, l) \
for ((s) = (l); (s) && *(s); (s)++)
@@ -82,6 +73,3 @@ bool strv_overlap(char **a, char **b) _pure_;
#define STRV_FOREACH_PAIR(x, y, l) \
for ((x) = (l), (y) = (x+1); (x) && *(x) && *(y); (x) += 2, (y) = (x + 1))
-
-char **strv_sort(char **l);
-void strv_print(char **l);