From 1db5001260ee2e745e2863e2eba59cd307f126a5 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 27 Feb 2019 19:47:12 +0000 Subject: [PATCH] Replace a couple more #defines with inline functions. My trawl of all the vtable systems in the code spotted a couple of other function-like macros in passing, which might as well be rewritten as inline functions too for the same reasons. --- terminal.h | 5 ++++- windows/winstuff.h | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/terminal.h b/terminal.h index 24c5ac0b..b130f886 100644 --- a/terminal.h +++ b/terminal.h @@ -330,6 +330,9 @@ struct terminal_tag { int mouse_paste_clipboard; }; -#define in_utf(term) ((term)->utf || (term)->ucsdata->line_codepage==CP_UTF8) +static inline bool in_utf(Terminal *term) +{ + return term->utf || term->ucsdata->line_codepage == CP_UTF8; +} #endif diff --git a/windows/winstuff.h b/windows/winstuff.h index 3334674b..f0daa6ab 100644 --- a/windows/winstuff.h +++ b/windows/winstuff.h @@ -41,7 +41,11 @@ struct Filename { char *path; }; -#define f_open(filename, mode, isprivate) ( fopen((filename)->path, (mode)) ) +static inline FILE *f_open(const Filename *filename, const char *mode, + bool isprivate) +{ + return fopen(filename->path, mode); +} struct FontSpec { char *name;