Skip to content

Commit 0b29ec3

Browse files
committed
lib+common: Fixups for big refactor in 2bd1b4b
Remove debug print & fix a warning.
1 parent 1bd4f71 commit 0b29ec3

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/common/loaders/formats/wavefront/wavefront.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,11 @@ float get_poly_area(struct cr_face *p, struct vector *vertices) {
9797
return vec_length(cross) / 2.0f;
9898
}
9999

100-
#include <stdio.h>
101100
struct mesh_parse_result parse_wavefront(const char *file_path) {
102101
file_data input = file_load(file_path);
103102
if (!input)
104103
return (struct mesh_parse_result){ 0 };
105104
logr(debug, "Loading OBJ %s\n", file_path);
106-
fprintf(stderr, "\n\nlen is %zu\n\n", v_arr_len(input));
107105
textBuffer *file = newTextBuffer((char *)input, v_arr_len(input));
108106
char *assetPath = get_file_path(file_path);
109107

src/lib/datatypes/tile.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,12 @@ static unsigned int rand_interval(unsigned int min, unsigned int max, pcg32_rand
158158

159159
static void reorder_random(struct render_tile **tiles) {
160160
pcg32_random_t rng;
161+
size_t len = v_arr_len(*tiles);
162+
if (!len)
163+
return;
161164
pcg32_srandom_r(&rng, 3141592, 0);
162-
for (unsigned i = 0; i < v_arr_len(*tiles); ++i) {
163-
unsigned random = rand_interval(0, v_arr_len(tiles) - 1, &rng);
165+
for (size_t i = 0; i < len; ++i) {
166+
unsigned random = rand_interval(0, len - 1, &rng);
164167

165168
struct render_tile temp = (*tiles)[i];
166169
(*tiles)[i] = (*tiles)[random];

0 commit comments

Comments
 (0)