From a5169d6d21d00b51982a4ccb71147c67be58f1e0 Mon Sep 17 00:00:00 2001 From: kinamura Date: Sun, 22 Feb 2026 19:28:11 +0900 Subject: [PATCH 1/4] fix: oneline compiling for submit --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d9d4553..70254eb 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,8 @@ ARCH ?= $(shell uname -m || echo unknown) ifeq ($(shell uname -s),Darwin) PLATFORM := macOS PLATFORM_DIR := mac - THREADS := $(shell sysctl -n hw.ncpu || echo 1) + THREADS := 1 +# THREADS := $(shell sysctl -n hw.ncpu || echo 1) OS_LIBFT := libft/mac MLX_DIR := $(MLX)_macos MLX_A := $(MLX_DIR)/libmlx.a @@ -38,7 +39,8 @@ ifeq ($(shell uname -s),Darwin) else PLATFORM := $(shell uname -s || echo unknown) PLATFORM_DIR := linux - THREADS := $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1) + THREADS := 1 +# THREADS := $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1) OS_LIBFT := libft/linux MLX_DIR := $(MLX)-linux MLX_A := $(MLX_DIR)/libmlx_Linux.a From f0557c9d8212dbe534d5bbf13328068349aa6336 Mon Sep 17 00:00:00 2001 From: shorei <160503699+gaotoast@users.noreply.github.com> Date: Sun, 22 Feb 2026 19:46:05 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[fix]=20free=5Fscene=E9=96=A2=E6=95=B0?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/miniRT.h | 2 +- srcs/free.c | 27 +++++++++++++-------------- srcs/parsing/parse.c | 4 ++-- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/includes/miniRT.h b/includes/miniRT.h index b382043..af549e8 100644 --- a/includes/miniRT.h +++ b/includes/miniRT.h @@ -60,7 +60,7 @@ int clamp_color(double value); void print_error(char *msg, ...); // free -void free_scene(t_scene *scene); +void free_scene(t_scene **scene); void free_ctx(t_ctx *ctx); #endif diff --git a/srcs/free.c b/srcs/free.c index aa53e96..087ffe6 100644 --- a/srcs/free.c +++ b/srcs/free.c @@ -12,27 +12,26 @@ #include "miniRT.h" -void free_scene(t_scene *scene) +void free_scene(t_scene **scene) { t_obj *current; t_obj *next; - if (scene) + if (!scene || !*scene) + return ; + if ((*scene)->objects) { - if (scene->objects) + current = (*scene)->objects; + while (current) { - current = scene->objects; - while (current) - { - next = current->next; - free(current->obj_data); - free(current); - current = next; - } + next = current->next; + free(current->obj_data); + free(current); + current = next; } - free(scene); } - scene = NULL; + free(*scene); + *scene = NULL; } void free_ctx(t_ctx *ctx) @@ -42,6 +41,6 @@ void free_ctx(t_ctx *ctx) if (ctx->img) free(ctx->img); if (ctx->scene) - free_scene(ctx->scene); + free_scene(&ctx->scene); free(ctx); } diff --git a/srcs/parsing/parse.c b/srcs/parsing/parse.c index 9622f01..b2c117c 100644 --- a/srcs/parsing/parse.c +++ b/srcs/parsing/parse.c @@ -110,12 +110,12 @@ t_scene *parse_scene(char *filename) read_flags = 0; if (parse_file(filename, scene, &read_flags) < 0) { - free_scene(scene); + free_scene(&scene); return (NULL); } if (!validate_scene(read_flags)) { - free_scene(scene); + free_scene(&scene); return (NULL); } return (scene); From 582bac22b9220cde1c6fe07c047d543a5af4ab8e Mon Sep 17 00:00:00 2001 From: shorei <160503699+gaotoast@users.noreply.github.com> Date: Sun, 22 Feb 2026 19:46:44 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[fix]=20=E6=AD=A3=E8=A6=8F=E5=8C=96?= =?UTF-8?q?=E3=83=99=E3=82=AF=E3=83=88=E3=83=AB=E3=81=AE=E6=A4=9C=E8=A8=BC?= =?UTF-8?q?=E3=81=AB=E4=BD=BF=E7=94=A8=E3=81=99=E3=82=8BNORM=5FEPSILON?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ESC_KEYの重複定義を削除 --- includes/config.h | 8 +------- srcs/parsing/validate_values.c | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/includes/config.h b/includes/config.h index fb87720..e5abc6a 100644 --- a/includes/config.h +++ b/includes/config.h @@ -19,6 +19,7 @@ # define PROGRAM "miniRT" # define EXECUTION "./miniRT" # define EPSILON 1e-6 +# define NORM_EPSILON 1e-3 # define DBL_MAX __DBL_MAX__ # if defined(__APPLE__) @@ -77,13 +78,6 @@ # define MOUSE_SCROLL_UP 4 # define MOUSE_SCROLL_DOWN 5 -# if defined(__APPLE__) -# define ESC_KEY 53 -# else -# include -# define ESC_KEY XK_Escape -# endif - # define VALID 1 # define INVALID 0 diff --git a/srcs/parsing/validate_values.c b/srcs/parsing/validate_values.c index f64caff..b4f8b30 100644 --- a/srcs/parsing/validate_values.c +++ b/srcs/parsing/validate_values.c @@ -42,7 +42,7 @@ int validate_normalized_vec3(t_vec3 vec) double len_squared; len_squared = vec3_dot(vec, vec); - if (fabs(len_squared - 1.0) > EPSILON) + if (fabs(len_squared - 1.0) > NORM_EPSILON) return (INVALID); return (VALID); } From 291b6311e9553bedbbe802c20fabb4229e1237c5 Mon Sep 17 00:00:00 2001 From: shorei <160503699+gaotoast@users.noreply.github.com> Date: Sun, 22 Feb 2026 19:48:27 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[fix]=20create=5Fobject=5Fnode=E9=96=A2?= =?UTF-8?q?=E6=95=B0=E3=81=A7=E3=81=AE=E3=82=A8=E3=83=A9=E3=83=BC=E3=83=A1?= =?UTF-8?q?=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=82=92=E6=94=B9=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- srcs/parsing/object_list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srcs/parsing/object_list.c b/srcs/parsing/object_list.c index ab8abdc..7728139 100644 --- a/srcs/parsing/object_list.c +++ b/srcs/parsing/object_list.c @@ -19,7 +19,7 @@ t_obj *create_object_node(t_obj_type type, void *obj) node = (t_obj *)malloc(sizeof(t_obj)); if (!node) { - perror(""); + print_error(ERR_MSG_MALLOC); return (NULL); } node->type = type;