diff options
author | David Robillard <d@drobilla.net> | 2018-05-12 20:39:23 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-05-27 21:10:21 +0200 |
commit | c4b5d8a5f6973952b510ebd321cbac8aa5fb5267 (patch) | |
tree | c4b80c9b612f3f6bb8eb2561da9cd26f826579cb /src/serdi.c | |
parent | 582bfbe1cb0a6aa833f56c5bd8cf42abe5c5d13a (diff) | |
download | serd-c4b5d8a5f6973952b510ebd321cbac8aa5fb5267.tar.gz serd-c4b5d8a5f6973952b510ebd321cbac8aa5fb5267.tar.bz2 serd-c4b5d8a5f6973952b510ebd321cbac8aa5fb5267.zip |
Use fixed size stack
Diffstat (limited to 'src/serdi.c')
-rw-r--r-- | src/serdi.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/serdi.c b/src/serdi.c index 1f12812b..20690c37 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -20,9 +20,11 @@ #include "serd/serd.h" +#include <limits.h> #include <stdbool.h> +#include <stdint.h> #include <stdio.h> -#include <string.h> +#include <stdlib.h> #define SERDI_ERROR(msg) fprintf(stderr, "serdi: " msg); #define SERDI_ERRORF(fmt, ...) fprintf(stderr, "serdi: " fmt, __VA_ARGS__); @@ -135,6 +137,7 @@ main(int argc, char** argv) bool lax = false; bool use_model = false; bool quiet = false; + long stack_size = 4194304; const char* add_prefix = NULL; const char* chop_prefix = NULL; const char* root_uri = NULL; @@ -171,6 +174,15 @@ main(int argc, char** argv) } else if (!(input_syntax = get_syntax(argv[a]))) { return print_usage(argv[0], true); } + } else if (argv[a][1] == 'k') { + if (++a == argc) { + return missing_arg(argv[0], 'k'); + } + stack_size = strtol(argv[a], NULL, 10); + if (stack_size <= 0 || stack_size == LONG_MAX) { + SERDI_ERRORF("stack size `%ld' out of range\n", stack_size); + return 1; + } } else if (argv[a][1] == 'o') { if (++a == argc) { return missing_arg(argv[0], 'o'); @@ -263,7 +275,7 @@ main(int argc, char** argv) sink = serd_writer_get_sink_interface(writer); } - reader = serd_reader_new(world, input_syntax, sink); + reader = serd_reader_new(world, input_syntax, sink, stack_size); serd_reader_set_strict(reader, !lax); if (quiet) { serd_world_set_error_sink(world, quiet_error_sink, NULL); |