mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-compiler: Dynamically allocate options array.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
e242b46922
commit
c837f007e2
Notes:
Alexandre Julliard
2023-10-19 23:22:28 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Zebediah Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/381
@ -35,8 +35,6 @@
|
|||||||
#include <term.h>
|
#include <term.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_COMPILE_OPTIONS 6
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
OPTION_HELP = CHAR_MAX + 1,
|
OPTION_HELP = CHAR_MAX + 1,
|
||||||
@ -233,7 +231,7 @@ struct options
|
|||||||
uint32_t formatting;
|
uint32_t formatting;
|
||||||
bool explicit_colour;
|
bool explicit_colour;
|
||||||
|
|
||||||
struct vkd3d_shader_compile_option compile_options[MAX_COMPILE_OPTIONS];
|
struct vkd3d_shader_compile_option *compile_options;
|
||||||
unsigned int compile_option_count;
|
unsigned int compile_option_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -242,6 +240,7 @@ static void add_compile_option(struct options *options,
|
|||||||
{
|
{
|
||||||
struct vkd3d_shader_compile_option *o;
|
struct vkd3d_shader_compile_option *o;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
size_t size;
|
||||||
|
|
||||||
for (i = 0; i < options->compile_option_count; ++i)
|
for (i = 0; i < options->compile_option_count; ++i)
|
||||||
{
|
{
|
||||||
@ -254,9 +253,10 @@ static void add_compile_option(struct options *options,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options->compile_option_count >= ARRAY_SIZE(options->compile_options))
|
size = (options->compile_option_count + 1) * sizeof(*o);
|
||||||
|
if (!(options->compile_options = realloc(options->compile_options, size)))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Ignoring option.\n");
|
fprintf(stderr, "Out of memory.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user