mirror of
https://github.com/neovim/neovim.git
synced 2025-10-09 19:36:40 +00:00
Change mch_errmsg and mch_msg from macro to function
This commit is contained in:
@@ -35,10 +35,6 @@ enum { NUMBUFLEN = 65 };
|
||||
|
||||
#include "nvim/gettext.h"
|
||||
|
||||
#ifdef WIN32
|
||||
# include "nvim/mbyte.h" // for utf8_to_utf16
|
||||
#endif
|
||||
|
||||
// special attribute addition: Put message in history
|
||||
#define MSG_HIST 0x1000
|
||||
|
||||
@@ -291,30 +287,7 @@ enum { FOLD_TEXT_LEN = 51 }; //!< buffer size for get_foldtext()
|
||||
// functions of these names. The declarations would break if the defines had
|
||||
// been seen at that stage. But it must be before globals.h, where error_ga
|
||||
// is declared.
|
||||
#ifdef WIN32
|
||||
# define mch_errmsg(str) \
|
||||
do { \
|
||||
wchar_t *utf16str; \
|
||||
int conversion_result = utf8_to_utf16((str), &utf16str); \
|
||||
if (conversion_result != 0) { \
|
||||
EMSG2("utf8_to_utf16 failed: %d", conversion_result); \
|
||||
} else { \
|
||||
fwprintf(stderr, L"%ls", utf16str); \
|
||||
xfree(utf16str); \
|
||||
} \
|
||||
} while (0)
|
||||
# define mch_msg(str) \
|
||||
do { \
|
||||
wchar_t *utf16str; \
|
||||
int conversion_result = utf8_to_utf16((str), &utf16str); \
|
||||
if (conversion_result != 0) { \
|
||||
EMSG2("utf8_to_utf16 failed: %d", conversion_result); \
|
||||
} else { \
|
||||
wprintf(L"%ls", utf16str); \
|
||||
xfree(utf16str); \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
#ifndef WIN32
|
||||
# define mch_errmsg(str) fprintf(stderr, "%s", (str))
|
||||
# define mch_msg(str) printf("%s", (str))
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user