This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH v7 3/6] linux ttyname: Change return type of is_pty from int to bool
- From: Luke Shumaker <lukeshu at lukeshu dot com>
- To: libc-alpha at sourceware dot org
- Cc: christian dot brauner at mailbox dot org
- Date: Mon, 13 Nov 2017 16:28:38 -0500
- Subject: [PATCH v7 3/6] linux ttyname: Change return type of is_pty from int to bool
- Authentication-results: sourceware.org; auth=none
- References: <20171113212841.28518-1-lukeshu@lukeshu.com>
From: Luke Shumaker <lukeshu@parabola.nu>
is_pty returning a bool is fine since there's no possible outcome other
than true or false, and bool is used throughout the codebase.
v2:
- Introduce as part of another commit
v3:
- Split into a separate commit
v7:
- Include <stdbool.h>
---
ChangeLog | 3 +++
sysdeps/unix/sysv/linux/ttyname.h | 3 ++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index fd1124bd95..7035df540d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2017-11-07 Luke Shumaker <lukeshu@parabola.nu>
+ * sysdeps/unix/sysv/linux/ttyname.h (is_pty): Change return type from
+ int to bool.
+
* sysdeps/unix/sysv/linux/ttyname.h (is_pty): Update doc reference.
* manual/terminal.texi (Is It a Terminal):
diff --git a/sysdeps/unix/sysv/linux/ttyname.h b/sysdeps/unix/sysv/linux/ttyname.h
index cbcdbab607..cdaf60fb87 100644
--- a/sysdeps/unix/sysv/linux/ttyname.h
+++ b/sysdeps/unix/sysv/linux/ttyname.h
@@ -16,6 +16,7 @@
not, see <http://www.gnu.org/licenses/>. */
#include <unistd.h>
+#include <stdbool.h>
#include <sys/sysmacros.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -23,7 +24,7 @@
/* Return true if this is a UNIX98 pty device, as defined in
linux/Documentation/devices.txt (on linux < 4.10) or
linux/Documentation/admin-guide/devices.txt (on linux >= 4.10). */
-static inline int
+static inline bool
is_pty (struct stat64 *sb)
{
#ifdef _STATBUF_ST_RDEV
--
2.15.0