+ error_cb(code, msg);
+}
+
+/*
+=item i_push_errorvf(int code, char const *fmt, va_list ap)
+
+Intended for use by higher level functions, takes a varargs pointer
+and a format to produce the finally pushed error message.
+
+=cut
+*/
+void i_push_errorvf(int code, char const *fmt, va_list ap) {
+ char buf[1024];
+#if defined(_MSC_VER)
+ _vsnprintf(buf, sizeof(buf), fmt, ap);
+#else
+ /* is there a way to detect vsnprintf()?
+ for this and other functions we need some mechanism to handle
+ detection (like perl's Configure, or autoconf)
+ */
+ vsprintf(buf, fmt, ap);
+#endif
+ i_push_error(code, buf);
+}
+
+/*
+=item i_push_errorf(int code, char const *fmt, ...)
+
+A version of i_push_error() that does printf() like formating.
+
+=cut
+*/
+void i_push_errorf(int code, char const *fmt, ...) {
+ va_list ap;
+ va_start(ap, fmt);
+ i_push_errorvf(code, fmt, ap);
+ va_end(ap);