public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Christian Brauner <christian.brauner@ubuntu.com>
To: libc-alpha@sourceware.org
Cc: lukeshu@parabola.nu
Subject: [PATCH COMMITTED 3/6] linux ttyname: Change return type of is_pty from int to bool
Date: Wed, 15 Nov 2017 21:33:00 -0000	[thread overview]
Message-ID: <20171115213315.7300-3-christian.brauner@ubuntu.com> (raw)
In-Reply-To: <20171115213315.7300-1-christian.brauner@ubuntu.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.

Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
---
 ChangeLog                         | 3 +++
 sysdeps/unix/sysv/linux/ttyname.h | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 6194237230..bb960c04bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2017-11-15  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.14.1

  reply	other threads:[~2017-11-15 21:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15 21:33 [PATCH COMMITTED 1/6] manual: Update to mention ENODEV for ttyname and ttyname_r Christian Brauner
2017-11-15 21:33 ` Christian Brauner [this message]
2017-11-15 21:33 ` [PATCH COMMITTED 4/6] linux ttyname{_r}: Make tty checks consistent Christian Brauner
2017-11-15 21:33 ` [PATCH COMMITTED 5/6] linux ttyname{_r}: Don't bail prematurely [BZ #22145] Christian Brauner
2017-11-15 21:38 ` [PATCH COMMITTED 2/6] linux ttyname: Update a reference to kernel docs for kernel 4.10 Christian Brauner
2017-11-15 21:38 ` [PATCH COMMITTED 6/6] linux ttyname{_r}: Add tests Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171115213315.7300-3-christian.brauner@ubuntu.com \
    --to=christian.brauner@ubuntu.com \
    --cc=libc-alpha@sourceware.org \
    --cc=lukeshu@parabola.nu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).