<commit_before>// Hiro Framework - Copyright 2017 <NAME>.

#ifndef _HIRO_GAME_H
#define _HIRO_GAME_H

#include "hiro.h"

// Object Define
struct hiro_game {
  int           stop;
  SDL_Window*   window;
  SDL_Renderer* renderer;
};

static void hiro_free_game(mrb_state*, void* ptr);
static const struct mrb_data_type hiro_game_type = { "game", hiro_free_game };
mrb_value hiro_game_object(mrb_state*, struct hiro_game*);
struct hiro_game* hiro_game_ptr(mrb_state*, mrb_value);
struct hiro_game* hiro_create_game(mrb_state*);

void hiro_free_game(mrb_state* mrb, void *ptr) {
  struct hiro_game* game = (struct hiro_game*)ptr;
  if(game) {
    SDL_DestroyWindow(game->window);
    SDL_DestroyRenderer(game->renderer);
    mrb_free(mrb, game);
  }
}

// C API
void hiro_game_draw(mrb_state*, mrb_value);
void hiro_game_update(mrb_state*, mrb_value, mrb_int);
void hiro_game_poll_event(mrb_state*, mrb_value);

// Ruby API
mrb_value hiro_game_mrb_init(mrb_state*, mrb_value);
mrb_value hiro_game_mrb_start(mrb_state*, mrb_value);
mrb_value hiro_game_mrb_stop_bang(mrb_state*, mrb_value);

void hiro_game_init(mrb_state*);

#endif<commit_msg>Improve code to skip not necessary null check<commit_after>// Hiro Framework - Copyright 2017 <NAME>.

#ifndef _HIRO_GAME_H
#define _HIRO_GAME_H

#include "hiro.h"

// Object Define
struct hiro_game {
  int           stop;
  SDL_Window*   window;
  SDL_Renderer* renderer;
};

static void hiro_free_game(mrb_state*, void* ptr);
static const struct mrb_data_type hiro_game_type = { "game", hiro_free_game };
mrb_value hiro_game_object(mrb_state*, struct hiro_game*);
struct hiro_game* hiro_game_ptr(mrb_state*, mrb_value);
struct hiro_game* hiro_create_game(mrb_state*);

void hiro_free_game(mrb_state* mrb, void *ptr) {
  struct hiro_game* game = (struct hiro_game*)ptr;
  SDL_DestroyWindow(game->window);
  SDL_DestroyRenderer(game->renderer);
  mrb_free(mrb, game);
}

// C API
void hiro_game_draw(mrb_state*, mrb_value);
void hiro_game_update(mrb_state*, mrb_value, mrb_int);
void hiro_game_poll_event(mrb_state*, mrb_value);

// Ruby API
mrb_value hiro_game_mrb_init(mrb_state*, mrb_value);
mrb_value hiro_game_mrb_start(mrb_state*, mrb_value);
mrb_value hiro_game_mrb_stop_bang(mrb_state*, mrb_value);

void hiro_game_init(mrb_state*);

#endif
{'fraction_non_alphanumeric': 0.10843900306077832, 'fraction_numerical': 0.0034980323567993005, 'mean_word_length': 6.4045307443365695, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3460533', 'n_tokens_mistral': 948, 'n_tokens_neox': 932, 'n_words': 177}