basic: introduce *_to_string_with_check() functions

They are used in later commits.
This commit is contained in:
Yu Watanabe
2018-01-02 02:23:24 +09:00
parent 6f90844fe2
commit 33d12153da
5 changed files with 28 additions and 1 deletions
+4
View File
@@ -20,6 +20,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdbool.h>
/*
* MAX_ERRNO is defined as 4095 in linux/err.h
* We use the same value here.
@@ -28,3 +29,6 @@
const char *errno_to_name(int id);
int errno_from_name(const char *name);
static inline bool errno_is_valid(int n) {
return n > 0 && n <= ERRNO_MAX;
}