static void xslt_generic_error_handler(void * ctx, const char *msg, ...) { char * message; va_list args; va_start(args, msg); vasprintf(&message, msg, args); va_end(args); rb_str_cat2((VALUE)ctx, message); vasprintf_free(message); }
static void xslt_generic_error_handler(void * ctx, const char *msg, ...) { char * message; VALUE exception; va_list args; va_start(args, msg); vasprintf(&message, msg, args); va_end(args); exception = rb_exc_new2(rb_eRuntimeError, message); vasprintf_free(message); rb_exc_raise(exception); }
static void error_func(void * ctx, const char *msg, ...) { VALUE self = NOKOGIRI_SAX_SELF(ctx); VALUE doc = rb_iv_get(self, "@document"); char * message; VALUE ruby_message; va_list args; va_start(args, msg); vasprintf(&message, msg, args); va_end(args); ruby_message = NOKOGIRI_STR_NEW2(message); vasprintf_free(message); rb_funcall(doc, id_error, 1, ruby_message); }