diff options
Diffstat (limited to 'src/libudev')
-rw-r--r-- | src/libudev/hashmap.c | 19 | ||||
-rw-r--r-- | src/libudev/hashmap.h | 2 | ||||
-rw-r--r-- | src/libudev/log.c | 17 | ||||
-rw-r--r-- | src/libudev/path-util.c | 11 | ||||
-rw-r--r-- | src/libudev/path-util.h | 1 | ||||
-rw-r--r-- | src/libudev/set.c | 4 | ||||
-rw-r--r-- | src/libudev/set.h | 6 | ||||
-rw-r--r-- | src/libudev/util.c | 129 | ||||
-rw-r--r-- | src/libudev/util.h | 9 |
9 files changed, 0 insertions, 198 deletions
diff --git a/src/libudev/hashmap.c b/src/libudev/hashmap.c index 58702d7d59..c483fbad11 100644 --- a/src/libudev/hashmap.c +++ b/src/libudev/hashmap.c @@ -443,25 +443,6 @@ unsigned hashmap_size(Hashmap *h) { return h->n_entries; } -int hashmap_merge(Hashmap *h, Hashmap *other) { - struct hashmap_entry *e; - - assert(h); - - if (!other) - return 0; - - for (e = other->iterate_list_head; e; e = e->iterate_next) { - int r; - - if ((r = hashmap_put(h, e->key, e->value)) < 0) - if (r != -EEXIST) - return r; - } - - return 0; -} - char **hashmap_get_strv(Hashmap *h) { char **sv; Iterator it; diff --git a/src/libudev/hashmap.h b/src/libudev/hashmap.h index 4c17fe4d33..5135c885a0 100644 --- a/src/libudev/hashmap.h +++ b/src/libudev/hashmap.h @@ -57,8 +57,6 @@ int hashmap_put(Hashmap *h, const void *key, void *value); void *hashmap_get(Hashmap *h, const void *key); bool hashmap_contains(Hashmap *h, const void *key); -int hashmap_merge(Hashmap *h, Hashmap *other); - unsigned hashmap_size(Hashmap *h) _pure_; void *hashmap_iterate(Hashmap *h, Iterator *i, const void **key); diff --git a/src/libudev/log.c b/src/libudev/log.c index ba85494c4e..c06f05b799 100644 --- a/src/libudev/log.c +++ b/src/libudev/log.c @@ -576,23 +576,6 @@ static int log_dispatch( return r; } -int log_dump_internal( - int level, - const char*file, - int line, - const char *func, - char *buffer) { - - PROTECT_ERRNO; - - /* This modifies the buffer... */ - - if (_likely_(LOG_PRI(level) > log_max_level)) - return 0; - - return log_dispatch(level, file, line, func, NULL, NULL, buffer); -} - int log_metav( int level, const char*file, diff --git a/src/libudev/path-util.c b/src/libudev/path-util.c index b702b94218..fd67310474 100644 --- a/src/libudev/path-util.c +++ b/src/libudev/path-util.c @@ -331,14 +331,3 @@ fallback: return a.st_dev != b.st_dev; } - -int path_is_read_only_fs(const char *path) { - struct statvfs st; - - assert(path); - - if (statvfs(path, &st) < 0) - return -errno; - - return !!(st.f_flag & ST_RDONLY); -} diff --git a/src/libudev/path-util.h b/src/libudev/path-util.h index 74cec3b1da..653ae8d7c8 100644 --- a/src/libudev/path-util.h +++ b/src/libudev/path-util.h @@ -35,4 +35,3 @@ char** path_strv_canonicalize(char **l); char** path_strv_canonicalize_uniq(char **l); int path_is_mount_point(const char *path, bool allow_symlink); -int path_is_read_only_fs(const char *path); diff --git a/src/libudev/set.c b/src/libudev/set.c index fc506ea057..3a4f7d049a 100644 --- a/src/libudev/set.c +++ b/src/libudev/set.c @@ -37,10 +37,6 @@ void set_free(Set* s) { hashmap_free(MAKE_HASHMAP(s)); } -void set_free_free(Set *s) { - hashmap_free_free(MAKE_HASHMAP(s)); -} - int set_put(Set *s, void *value) { return hashmap_put(MAKE_HASHMAP(s), value, value); } diff --git a/src/libudev/set.h b/src/libudev/set.h index 5dd381c9f3..3296b2b6bf 100644 --- a/src/libudev/set.h +++ b/src/libudev/set.h @@ -37,11 +37,6 @@ static inline void set_freep(Set **s) { set_free(*s); } -void set_free_free(Set *s); -static inline void set_free_freep(Set **s) { - set_free_free(*s); -} - int set_put(Set *s, void *value); void *set_get(Set *s, void *value); bool set_contains(Set *s, void *value); @@ -56,4 +51,3 @@ void *set_iterate_backwards(Set *s, Iterator *i); for ((i) = ITERATOR_LAST, (e) = set_iterate_backwards((s), &(i)); (e); (e) = set_iterate_backwards((s), &(i))) #define _cleanup_set_free_ _cleanup_(set_freep) -#define _cleanup_set_free_free_ _cleanup_(set_free_freep) diff --git a/src/libudev/util.c b/src/libudev/util.c index dc1641c3bc..e447f89647 100644 --- a/src/libudev/util.c +++ b/src/libudev/util.c @@ -438,68 +438,6 @@ char *strappend(const char *s, const char *suffix) { return strnappend(s, suffix, suffix ? strlen(suffix) : 0); } -int readlink_malloc(const char *p, char **r) { - size_t l = 100; - - assert(p); - assert(r); - - for (;;) { - char *c; - ssize_t n; - - if (!(c = new(char, l))) - return -ENOMEM; - - if ((n = readlink(p, c, l-1)) < 0) { - int ret = -errno; - free(c); - return ret; - } - - if ((size_t) n < l-1) { - c[n] = 0; - *r = c; - return 0; - } - - free(c); - l *= 2; - } -} - -char hexchar(int x) { - static const char table[16] = "0123456789abcdef"; - - return table[x & 15]; -} - -int unhexchar(char c) { - - if (c >= '0' && c <= '9') - return c - '0'; - - if (c >= 'a' && c <= 'f') - return c - 'a' + 10; - - if (c >= 'A' && c <= 'F') - return c - 'A' + 10; - - return -1; -} - -char octchar(int x) { - return '0' + (x & 7); -} - -int unoctchar(char c) { - - if (c >= '0' && c <= '7') - return c - '0'; - - return -1; -} - _pure_ static bool ignore_file_allow_backup(const char *filename) { assert(filename); @@ -525,73 +463,6 @@ bool ignore_file(const char *filename) { return ignore_file_allow_backup(filename); } -_pure_ static bool fd_in_set(int fd, const int fdset[], unsigned n_fdset) { - unsigned i; - - assert(n_fdset == 0 || fdset); - - for (i = 0; i < n_fdset; i++) - if (fdset[i] == fd) - return true; - - return false; -} - -char *format_timespan(char *buf, size_t l, usec_t t) { - static const struct { - const char *suffix; - usec_t usec; - } table[] = { - { "w", USEC_PER_WEEK }, - { "d", USEC_PER_DAY }, - { "h", USEC_PER_HOUR }, - { "min", USEC_PER_MINUTE }, - { "s", USEC_PER_SEC }, - { "ms", USEC_PER_MSEC }, - { "us", 1 }, - }; - - unsigned i; - char *p = buf; - - assert(buf); - assert(l > 0); - - if (t == (usec_t) -1) - return NULL; - - if (t == 0) { - snprintf(p, l, "0"); - p[l-1] = 0; - return p; - } - - /* The result of this function can be parsed with parse_usec */ - - for (i = 0; i < ELEMENTSOF(table); i++) { - int k; - size_t n; - - if (t < table[i].usec) - continue; - - if (l <= 1) - break; - - k = snprintf(p, l, "%s%llu%s", p > buf ? " " : "", (unsigned long long) (t / table[i].usec), table[i].suffix); - n = MIN((size_t) k, l); - - l -= n; - p += n; - - t %= table[i].usec; - } - - *p = 0; - - return buf; -} - int open_terminal(const char *name, int mode) { int fd, r; unsigned c = 0; diff --git a/src/libudev/util.h b/src/libudev/util.h index 80a0c436ad..f98e6ee9ac 100644 --- a/src/libudev/util.h +++ b/src/libudev/util.h @@ -209,21 +209,12 @@ int read_one_line_file(const char *fn, char **line); char *strappend(const char *s, const char *suffix); char *strnappend(const char *s, const char *suffix, size_t length); -int readlink_malloc(const char *p, char **r); - char *truncate_nl(char *s); -char hexchar(int x) _const_; -int unhexchar(char c) _const_; -char octchar(int x) _const_; -int unoctchar(char c) _const_; - bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) _pure_; bool ignore_file(const char *filename) _pure_; -char *format_timespan(char *buf, size_t l, usec_t t); - /* For basic lookup tables with strictly enumerated entries */ #define __DEFINE_STRING_TABLE_LOOKUP(name,type,scope) \ scope const char *name##_to_string(type i) { \ |