Commit 9bd004d8 authored by Niklas Haas's avatar Niklas Haas
Browse files

demos/plplay: drop use of reallocarray

I'm really not worried about overflow, so easiest is to just drop it
entirely.

Fixes #138
parent 8da1badd
Pipeline #83705 passed with stages
in 8 minutes and 30 seconds
......@@ -529,11 +529,11 @@ static void add_hook(struct plplay *p, const struct pl_hook *hook, const char *p
if (p->shader_num == p->shader_size) {
// Grow array if needed
size_t new_size = p->shader_size ? p->shader_size * 2 : 16;
void *new_hooks = reallocarray(p->shader_hooks, new_size, sizeof(void *));
void *new_hooks = realloc(p->shader_hooks, new_size * sizeof(void *));
if (!new_hooks)
goto error;
p->shader_hooks = new_hooks;
char **new_paths = reallocarray(p->shader_paths, new_size, sizeof(char *));
char **new_paths = realloc(p->shader_paths, new_size * sizeof(char *));
if (!new_paths)
goto error;
p->shader_paths = new_paths;
......
......@@ -81,7 +81,7 @@ static void drop_cb(GLFWwindow *win, int num, const char *files[])
for (int i = 0; i < num; i++) {
if (p->files_num == p->files_size) {
size_t new_size = p->files_size ? p->files_size * 2 : 16;
char **new_files = reallocarray(p->files, new_size, sizeof(char *));
char **new_files = realloc(p->files, new_size * sizeof(char *));
if (!new_files)
return;
p->files = new_files;
......
......@@ -220,7 +220,7 @@ static inline void handle_event(struct priv *p, SDL_Event *event)
case SDL_DROPFILE:
if (p->files_num == p->files_size) {
size_t new_size = p->files_size ? p->files_size * 2 : 16;
char **new_files = reallocarray(p->files, new_size, sizeof(char *));
char **new_files = realloc(p->files, new_size * sizeof(char *));
if (!new_files)
return;
p->files = new_files;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment