aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/message.c
diff options
context:
space:
mode:
authorMichael Reed <m.reed@mykolab.com>2015-03-14 19:44:01 -0400
committerJustin M. Keyes <justinkz@gmail.com>2015-03-19 18:33:39 -0400
commit8f6ecc40894174f8c100a2f012a0199fada62c27 (patch)
tree4e994d34bd34e7ebc90e61f4cb14302519c3e842 /src/nvim/message.c
parent21a53265279e3357ea7c694f3e3115921c8a719f (diff)
downloadrneovim-8f6ecc40894174f8c100a2f012a0199fada62c27.tar.gz
rneovim-8f6ecc40894174f8c100a2f012a0199fada62c27.tar.bz2
rneovim-8f6ecc40894174f8c100a2f012a0199fada62c27.zip
misc2.c: Move emsg* functions to message.c #2152
Clean up said functions and some outdated comments while we're at it.
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r--src/nvim/message.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 91c7d05ff4..b2e9488388 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -325,7 +325,6 @@ void trunc_string(char_u *s, char_u *buf, int room, int buflen)
}
/*
- * Automatic prototype generation does not understand this function.
* Note: Caller of smgs() and smsg_attr() must check the resulting string is
* shorter than IOSIZE!!!
*/
@@ -581,13 +580,44 @@ int emsg2(char_u *s, char_u *a1)
return emsg3(s, a1, NULL);
}
-/* emsg3() and emsgn() are in misc2.c to avoid warnings for the prototypes. */
-
void emsg_invreg(int name)
{
EMSG2(_("E354: Invalid register name: '%s'"), transchar(name));
}
+/// Print an error message with one or two "%s" and one or two string arguments.
+int emsg3(char_u *s, char_u *a1, char_u *a2)
+{
+ if (emsg_not_now()) {
+ return TRUE; // no error messages at the moment
+ }
+
+ vim_snprintf((char *)IObuff, IOSIZE, (char *)s, a1, a2);
+ return emsg(IObuff);
+}
+
+/// Print an error message with one "%" PRId64 and one (int64_t) argument.
+int emsgn(char_u *s, int64_t n)
+{
+ if (emsg_not_now()) {
+ return TRUE; // no error messages at the moment
+ }
+
+ vim_snprintf((char *)IObuff, IOSIZE, (char *)s, n);
+ return emsg(IObuff);
+}
+
+/// Print an error message with one "%" PRIu64 and one (uint64_t) argument.
+int emsgu(char_u *s, uint64_t n)
+{
+ if (emsg_not_now()) {
+ return TRUE; // no error messages at the moment
+ }
+
+ vim_snprintf((char *)IObuff, IOSIZE, (char *)s, n);
+ return emsg(IObuff);
+}
+
/*
* Like msg(), but truncate to a single line if p_shm contains 't', or when
* "force" is TRUE. This truncates in another way as for normal messages.
@@ -3051,9 +3081,6 @@ static double tv_float(typval_T *tvs, int *idxp)
* "typval_T". When the latter is not used it must be NULL.
*/
-/* When generating prototypes all of this is skipped, cproto doesn't
- * understand this. */
-
/* Like vim_vsnprintf() but append to the string. */
int vim_snprintf_add(char *str, size_t str_m, char *fmt, ...)
{