Alloc token data in factory instead of alloc func
This commit is contained in:
parent
5b2bdc84fc
commit
b655b3ddd4
|
|
@ -101,7 +101,7 @@ ruby_whisper_parakeet_token_s_allocate(VALUE klass)
|
|||
ruby_whisper_parakeet_token *rwpt;
|
||||
VALUE token = TypedData_Make_Struct(klass, ruby_whisper_parakeet_token, &ruby_whisper_parakeet_token_type, rwpt);
|
||||
|
||||
rwpt->token_data = ALLOC(parakeet_token_data);
|
||||
rwpt->token_data = NULL;
|
||||
rwpt->text = Qnil;
|
||||
|
||||
return token;
|
||||
|
|
@ -114,6 +114,7 @@ ruby_whisper_parakeet_token_s_from_token_data(struct parakeet_context *context,
|
|||
ruby_whisper_parakeet_token *rwpt;
|
||||
TypedData_Get_Struct(token, ruby_whisper_parakeet_token, &ruby_whisper_parakeet_token_type, rwpt);
|
||||
|
||||
rwpt->token_data = ALLOC(parakeet_token_data);
|
||||
*rwpt->token_data = *token_data;
|
||||
rwpt->text = rb_utf8_str_new_cstr(parakeet_token_to_str(context, token_data->id));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue