diff options
Diffstat (limited to 'glnx-fdio.h')
-rw-r--r-- | glnx-fdio.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/glnx-fdio.h b/glnx-fdio.h index f459e93..150b22e 100644 --- a/glnx-fdio.h +++ b/glnx-fdio.h @@ -50,6 +50,23 @@ const char *glnx_basename (const char *path) return (basename) (path); } +/* Utilities for standard FILE* */ +static inline void +glnx_stdio_file_cleanup (void *filep) +{ + FILE *f = filep; + if (f) + fclose (f); +} +G_DEFINE_AUTOPTR_CLEANUP_FUNC(FILE, glnx_stdio_file_cleanup) + +/** + * glnx_stdio_file_flush: + * Call fflush() and check ferror(). + */ +gboolean +glnx_stdio_file_flush (FILE *f, GError **error); + typedef struct { gboolean initialized; gboolean anonymous; |