basic/errno-list: remove errno_max() and define ERRNO_MAX as 4095
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 11 Nov 2017 12:26:10 +0000 (21:26 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 11 Nov 2017 12:28:25 +0000 (21:28 +0900)
In Linux kernel code, MAX_ERRNO is defined as 4095.
Here, we use that value for ERRNO_MAX.

src/basic/errno-list.c
src/basic/errno-list.h

index c6a01ee..f0b7475 100644 (file)
@@ -51,7 +51,3 @@ int errno_from_name(const char *name) {
         assert(sc->id > 0);
         return sc->id;
 }
-
-int errno_max(void) {
-        return ELEMENTSOF(errno_names);
-}
index 4eec0cc..c8e5205 100644 (file)
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
+/*
+ * MAX_ERRNO is defined as 4095 in linux/err.h
+ * We use the same value here.
+ */
+#define ERRNO_MAX 4095
+
 const char *errno_to_name(int id);
 int errno_from_name(const char *name);
-
-int errno_max(void);