VALUE rb_str_catf(VALUE str, const char *format, ...) { va_list ap; va_start(ap, format); str = rb_str_vcatf(str, format, ap); va_end(ap); return str; }
static VALUE compile_snprintf(rb_encoding *enc, const char *pre, const char *file, int line, const char *fmt, va_list args) { VALUE str = rb_enc_str_new(0, 0, enc); if (file) { rb_str_cat2(str, file); if (line) rb_str_catf(str, ":%d", line); rb_str_cat2(str, ": "); } if (pre) rb_str_cat2(str, pre); rb_str_vcatf(str, fmt, args); return str; }
static void warn_print(const char *fmt, va_list args) { VALUE str = rb_str_new(0, 0); VALUE file = rb_sourcefilename(); if (!NIL_P(file)) { int line = rb_sourceline(); str = rb_str_append(str, file); if (line) rb_str_catf(str, ":%d", line); rb_str_cat2(str, ": "); } rb_str_cat2(str, "warning: "); rb_str_vcatf(str, fmt, args); rb_str_cat2(str, "\n"); rb_write_error_str(str); }
static VALUE warning_string(rb_encoding *enc, const char *fmt, va_list args) { VALUE str = rb_enc_str_new(0, 0, enc); VALUE file = rb_sourcefilename(); if (!NIL_P(file)) { int line = rb_sourceline(); str = rb_str_append(str, file); if (line) rb_str_catf(str, ":%d", line); rb_str_cat2(str, ": "); } rb_str_cat2(str, "warning: "); rb_str_vcatf(str, fmt, args); rb_str_cat2(str, "\n"); return str; }