giochannel: Add G_IO_FLAG_NONE

This makes the state where no flags are set a bit more self-documenting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2022-06-23 10:12:44 +01:00
parent cc528f6c2e
commit cef780e9ef
3 changed files with 3 additions and 1 deletions

View File

@ -946,6 +946,7 @@ g_io_channel_get_line_term (GIOChannel *channel,
**/ **/
/** /**
* GIOFlags: * GIOFlags:
* @G_IO_FLAG_NONE: no special flags set. Since: 2.74
* @G_IO_FLAG_APPEND: turns on append mode, corresponds to %O_APPEND * @G_IO_FLAG_APPEND: turns on append mode, corresponds to %O_APPEND
* (see the documentation of the UNIX open() syscall) * (see the documentation of the UNIX open() syscall)
* @G_IO_FLAG_NONBLOCK: turns on nonblocking mode, corresponds to * @G_IO_FLAG_NONBLOCK: turns on nonblocking mode, corresponds to

View File

@ -85,6 +85,7 @@ typedef enum
typedef enum typedef enum
{ {
G_IO_FLAG_NONE GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 0,
G_IO_FLAG_APPEND = 1 << 0, G_IO_FLAG_APPEND = 1 << 0,
G_IO_FLAG_NONBLOCK = 1 << 1, G_IO_FLAG_NONBLOCK = 1 << 1,
G_IO_FLAG_IS_READABLE = 1 << 2, /* Read only flag */ G_IO_FLAG_IS_READABLE = 1 << 2, /* Read only flag */

View File

@ -400,7 +400,7 @@ g_io_unix_set_flags (GIOChannel *channel,
static GIOFlags static GIOFlags
g_io_unix_get_flags (GIOChannel *channel) g_io_unix_get_flags (GIOChannel *channel)
{ {
GIOFlags flags = 0; GIOFlags flags = G_IO_FLAG_NONE;
glong fcntl_flags; glong fcntl_flags;
GIOUnixChannel *unix_channel = (GIOUnixChannel *) channel; GIOUnixChannel *unix_channel = (GIOUnixChannel *) channel;