diff options
| author | ruki <[email protected]> | 2025-11-10 23:20:49 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-11-10 23:20:49 +0800 |
| commit | 72f441c0a6f0ac864e7b4b0c06e8523434e4b599 (patch) | |
| tree | f1f9ab506cc6622c6a674d8a1d6d1c0b4d7a6479 | |
| parent | ef701a4dce8b7d9a663e084d1fc0b243ddae9397 (diff) | |
suppress compile warnings
| -rw-r--r-- | core/src/xmake/io/prefix.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/core/src/xmake/io/prefix.h b/core/src/xmake/io/prefix.h index 7c339cf36..67f7325f7 100644 --- a/core/src/xmake/io/prefix.h +++ b/core/src/xmake/io/prefix.h @@ -31,10 +31,6 @@ */ #define XM_IO_BLOCK_MAXN (TB_STREAM_BLOCK_MAXN * 10) -#define xm_io_file_is_file(file) ((file)->type == XM_IO_FILE_TYPE_FILE) -#define xm_io_file_is_std(file) ((file)->type != XM_IO_FILE_TYPE_FILE) -#define xm_io_file_is_tty(file) (!!((file)->type & XM_IO_FILE_FLAG_TTY)) - // return io error #define xm_io_return_error(lua, error) \ do { \ @@ -90,6 +86,18 @@ typedef struct __xm_io_file_t { tb_buffer_t wcache; // the write line cache buffer } xm_io_file_t; +static __tb_inline__ tb_bool_t xm_io_file_is_file(xm_io_file_t const *file) { + return file && file->type == XM_IO_FILE_TYPE_FILE; +} + +static __tb_inline__ tb_bool_t xm_io_file_is_std(xm_io_file_t const *file) { + return file && file->type != XM_IO_FILE_TYPE_FILE; +} + +static __tb_inline__ tb_bool_t xm_io_file_is_tty(xm_io_file_t const *file) { + return file && (file->type & XM_IO_FILE_FLAG_TTY); +} + // check pipe file static __tb_inline__ tb_bool_t xm_pipe_file_is_valid(lua_State *lua, tb_int_t index) { return xm_lua_ispointer(lua, index) || xm_lua_isinteger(lua, index); |
