[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220419004225.3952530-9-paulmck@kernel.org>
Date: Mon, 18 Apr 2022 17:41:33 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: linux-kernel@...r.kernel.org
Cc: gwml@...r.gnuweeb.org, kernel-team@...com, w@....eu,
Willy Tarreau <w@....eu>,
"Paul E . McKenney" <paulmck@...nel.org>
Subject: [PATCH nolibc 09/61] tools/nolibc/ctype: split the is* functions to ctype.h
From: Willy Tarreau <w@....eu>
In fact there's only isdigit() for now. More should definitely be added.
Signed-off-by: Willy Tarreau <w@....eu>
Signed-off-by: Paul E. McKenney <paulmck@...nel.org>
---
tools/include/nolibc/ctype.h | 22 ++++++++++++++++++++++
tools/include/nolibc/nolibc.h | 7 +------
2 files changed, 23 insertions(+), 6 deletions(-)
create mode 100644 tools/include/nolibc/ctype.h
diff --git a/tools/include/nolibc/ctype.h b/tools/include/nolibc/ctype.h
new file mode 100644
index 000000000000..6735bd906f25
--- /dev/null
+++ b/tools/include/nolibc/ctype.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
+/*
+ * ctype function definitions for NOLIBC
+ * Copyright (C) 2017-2021 Willy Tarreau <w@....eu>
+ */
+
+#ifndef _NOLIBC_CTYPE_H
+#define _NOLIBC_CTYPE_H
+
+#include "std.h"
+
+/*
+ * As much as possible, please keep functions alphabetically sorted.
+ */
+
+static __attribute__((unused))
+int isdigit(int c)
+{
+ return (unsigned int)(c - '0') <= 9;
+}
+
+#endif /* _NOLIBC_CTYPE_H */
diff --git a/tools/include/nolibc/nolibc.h b/tools/include/nolibc/nolibc.h
index b06bd5cb5651..c96c6cb7f3ae 100644
--- a/tools/include/nolibc/nolibc.h
+++ b/tools/include/nolibc/nolibc.h
@@ -87,18 +87,13 @@
#include "arch.h"
#include "types.h"
#include "sys.h"
+#include "ctype.h"
#include "stdlib.h"
#include "string.h"
/* Used by programs to avoid std includes */
#define NOLIBC
-static __attribute__((unused))
-int isdigit(int c)
-{
- return (unsigned int)(c - '0') <= 9;
-}
-
static __attribute__((unused))
const char *ltoa(long in)
{
--
2.31.1.189.g2e36527f23
Powered by blists - more mailing lists