generated from ParadoxV5/template-ruby-gem
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Mark things `static` and `const` as appropriate * Move “level wasn’t set up” warning to the central method * Inline `err` as the errno returns are unused for beïng cryptic
- Loading branch information
Showing
2 changed files
with
13 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
#include "cleanup.h" | ||
|
||
void godot_rb_cleanup_core() { | ||
if(godot_rb_init_levels[GDEXTENSION_INITIALIZATION_CORE]) { | ||
int err = ruby_cleanup(EXIT_SUCCESS); | ||
if(err) | ||
godot_rb_error("Ruby ran into a problem while exiting.", __func__, __FILE__, __LINE__); | ||
} else | ||
godot_rb_warn("Godot.rb hasn't set this init level up.", __func__, __FILE__, __LINE__); | ||
static void godot_rb_cleanup_core() { | ||
if(ruby_cleanup(EXIT_SUCCESS)) | ||
godot_rb_error("Ruby ran into a problem while exiting.", __func__, __FILE__, __LINE__); | ||
} | ||
|
||
void (*godot_rb_cleanup_functions[GDEXTENSION_MAX_INITIALIZATION_LEVEL])(void) = { | ||
static void (* const godot_rb_cleanup_functions[GDEXTENSION_MAX_INITIALIZATION_LEVEL])(void) = { | ||
[GDEXTENSION_INITIALIZATION_CORE] = godot_rb_cleanup_core | ||
}; | ||
void godot_rb_cleanup(__attribute__((unused)) void* userdata, GDExtensionInitializationLevel p_level) { | ||
void (*func)(void) = godot_rb_cleanup_functions[p_level]; | ||
if(func) { | ||
printf("cleaning up Godot.rb init level %u...\n", p_level); | ||
func(); | ||
godot_rb_init_levels[p_level] = false; | ||
printf("Godot.rb init level %u cleaned up.\n", p_level); | ||
if(godot_rb_init_levels[p_level]) { | ||
func(); | ||
godot_rb_init_levels[p_level] = false; | ||
printf("Godot.rb init level %u cleaned up.\n", p_level); | ||
} else | ||
godot_rb_warn("Godot.rb hasn't set this init level up.", __func__, __FILE__, __LINE__); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters