Merge pull request #296 from kichikuou/alignment-fix

Use xcalloc_aligned for allocating structures containing mat4
This commit is contained in:
Nunuhara Cabbage
2026-01-12 17:08:34 -08:00
committed by GitHub
6 changed files with 6 additions and 7 deletions
+1 -1
View File
@@ -518,7 +518,7 @@ struct model *model_load(struct archive *aar, const char *path)
model->bone_map = ht_create(pol->nr_bones * 3 / 2);
model->bone_name_map = ht_create(pol->nr_bones * 3 / 2);
model->mot_cache = ht_create(16);
model->bones = xcalloc(pol->nr_bones, sizeof(struct bone));
model->bones = xcalloc_aligned(pol->nr_bones, struct bone);
for (uint32_t i = 0; i < pol->nr_bones; i++) {
add_bone(model, pol, &pol->bones[i]);
}
+2 -2
View File
@@ -38,7 +38,7 @@ enum RE_plugin_version re_plugin_version;
static struct RE_instance *create_instance(struct RE_plugin *plugin)
{
struct RE_instance *instance = xcalloc(1, sizeof(struct RE_instance));
struct RE_instance *instance = xcalloc_aligned(1, struct RE_instance);
instance->plugin = plugin;
for (int i = 0; i < RE_NR_INSTANCE_TARGETS; i++)
instance->target[i] = -1;
@@ -229,7 +229,7 @@ struct RE_plugin *RE_plugin_new(enum RE_plugin_version version)
if (!aar)
return NULL;
struct RE_plugin *plugin = xcalloc(1, sizeof(struct RE_plugin));
struct RE_plugin *plugin = xcalloc_aligned(1, struct RE_plugin);
plugin->plugin.name = "ReignEngine";
plugin->plugin.update = RE_render;
plugin->plugin.to_json = RE_to_json;
+1 -1
View File
@@ -60,7 +60,7 @@ struct dungeon_context *dungeon_get_context(int surface)
struct dungeon_context *dungeon_context_create(enum draw_dungeon_version version, int width, int height)
{
struct dungeon_context *ctx = xcalloc(1, sizeof(struct dungeon_context));
struct dungeon_context *ctx = xcalloc_aligned(1, struct dungeon_context);
ctx->plugin.name = plugin_name;
ctx->plugin.free = dungeon_context_free;
ctx->plugin.update = dungeon_render;
+1 -1
View File
@@ -153,7 +153,7 @@ static struct parts_flash_object *update_object(struct parts_flash_object *obj,
{
if (!obj) {
if (tag->flags & PLACE_FLAG_HAS_CHARACTER) {
obj = xcalloc(1, sizeof(struct parts_flash_object));
obj = xcalloc_aligned(1, struct parts_flash_object);
obj->depth = tag->depth;
} else {
ERROR("no object to update (depth=%d)", tag->depth);
-1
View File
@@ -419,7 +419,6 @@ int main(int argc, char *argv[])
{
sys_error_handler = error_handler;
initialize_instructions();
char *ainfile;
int err = AIN_SUCCESS;
bool audit = false;