chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build-sys: drop -Wunsafe-loop-optimizations
[elogind.git]
/
util.h
diff --git
a/util.h
b/util.h
index a1e79d47b1d491060e7a420b6e4dd62e63cc9815..af39accc946c47c079ace7164f9e65c38d7f86db 100644
(file)
--- a/
util.h
+++ b/
util.h
@@
-163,10
+163,14
@@
bool ignore_file(const char *filename);
} \
type name##_from_string(const char *s) { \
type i; \
} \
type name##_from_string(const char *s) { \
type i; \
+ unsigned u; \
assert(s); \
for (i = 0; i < (type)ELEMENTSOF(name##_table); i++) \
if (streq(name##_table[i], s)) \
return i; \
assert(s); \
for (i = 0; i < (type)ELEMENTSOF(name##_table); i++) \
if (streq(name##_table[i], s)) \
return i; \
+ if (safe_atou(s, &u) >= 0 && \
+ u < ELEMENTSOF(name##_table)) \
+ return (type) u; \
return (type) -1; \
} \
struct __useless_struct_to_allow_trailing_semicolon__
return (type) -1; \
} \
struct __useless_struct_to_allow_trailing_semicolon__
@@
-177,6
+181,8
@@
int fd_cloexec(int fd, bool cloexec);
int close_all_fds(const int except[], unsigned n_except);
int close_all_fds(const int except[], unsigned n_except);
+extern char * __progname;
+
const char *ioprio_class_to_string(int i);
int ioprio_class_from_string(const char *s);
const char *ioprio_class_to_string(int i);
int ioprio_class_from_string(const char *s);