Reduce if

This commit is contained in:
Kitaiti Makoto 2026-05-08 15:28:34 +09:00
parent f55f3f347c
commit 3bae1e2f1b
2 changed files with 14 additions and 13 deletions

View File

@ -132,19 +132,11 @@ typedef struct {
#define GetParakeetParams(obj, rwpp) do { \
TypedData_Get_Struct((obj), ruby_whisper_parakeet_params, &ruby_whisper_parakeet_params_type, (rwpp)); \
if (!(rwpp)->new_segment_callback_container) { \
rb_raise(rb_eRuntimeError, "Not initialized"); \
} \
if (!(rwpp)->new_token_callback_container) { \
rb_raise(rb_eRuntimeError, "Not initialized"); \
} \
if (!(rwpp)->progress_callback_container) { \
rb_raise(rb_eRuntimeError, "Not initialized"); \
} \
if (!(rwpp)->encoder_begin_callback_container) { \
rb_raise(rb_eRuntimeError, "Not initialized"); \
} \
if (!(rwpp)->abort_callback_container) { \
if (!(rwpp)->new_segment_callback_container || \
!(rwpp)->new_token_callback_container || \
!(rwpp)->progress_callback_container || \
!(rwpp)->encoder_begin_callback_container || \
!(rwpp)->abort_callback_container) { \
rb_raise(rb_eRuntimeError, "Not initialized"); \
} \
} while (0)

View File

@ -0,0 +1,9 @@
#include "ruby_whisper.h"
void
init_ruby_whisper_parakeet_context(VALUE *mParakeet)
{
VALUE cParakeetContext = rb_define_class_under(*mParakeet, "Context", rb_cObject);
}