diff options
author | bloodstalker <thabogre@gmail.com> | 2018-09-20 11:45:24 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2018-09-20 11:45:24 +0000 |
commit | a9ba7c19941ae6b47390a8f130a80edc4bad1df7 (patch) | |
tree | 49fbb55e19863d1edce44e5c3269579ec2abee3c /main.py | |
parent | added a new option --calloc. lets you choose whether to use caloc or malloc (diff) | |
download | faultreiber-a9ba7c19941ae6b47390a8f130a80edc4bad1df7.tar.gz faultreiber-a9ba7c19941ae6b47390a8f130a80edc4bad1df7.zip |
fixes #5
Diffstat (limited to '')
-rwxr-xr-x | main.py | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -180,10 +180,8 @@ class Argparser(object): parser.add_argument("--verbose", action="store_true", help="verbose", default=False) # TODO parser.add_argument("--forcenullterm", action="store_true", help="terminate all strings with null even if they are not originally null-terminated", default=False) - parser.add_argument("--strbuffersize", type=int, help="the size of the buffer for string reads", default=100) - parser.add_argument("--strbuffgrowfactor", type=float, help="the factor by which the strbuffer will grow", default=1.6) - parser.add_argument("--voidbuffersize", type=int, help="the size of the buffer for void* buffer", default=100) - parser.add_argument("--voidbuffgrowfactor", type=float, help="the factor by which the voidbuffer will grow", default=1.6) + parser.add_argument("--voidtraininitsize", type=int, help="the size of the void train, an integer", default=100) + parser.add_argument("--voidtrainfactor", type=float, help="the factor by which the voidtrain will grow, a float", default=2.0) parser.add_argument("--singlefile", action="store_true", help="the generated code will be put in a single file", default=False) parser.add_argument("--calloc", action="store_true", help="use calloc instead of malloc, defaults to false", default=False) parser.add_argument("--singlefilename", type=str, help="name of the single file") @@ -664,8 +662,8 @@ class CodeGen(object): struct_source_c.write(text.c_read_leb_u_def + "\n") struct_source_c.write(text.c_read_leb_s_def + "\n") struct_source_c.write(text.c_read_until_delimiter + "\n") - if self.argparser.args.calloc: struct_source_c.write(text.c_void_manager.replace("CCC", "ft_calloc") + "\n") - else: struct_source_c.write(text.c_void_manager.replace("CCC", "malloc") + "\n") + if self.argparser.args.calloc: struct_source_c.write(text.c_void_manager.replace("CCC", "ft_calloc").replace("XXX", repr(self.argparser.args.voidtraininitsize)).replace("YYY", repr(self.argparser.args.voidtrainfactor)) + "\n") + else: struct_source_c.write(text.c_void_manager.replace("CCC", "malloc").replace("XXX", repr(self.argparser.args.voidtraininitsize)).replace("YYY", repr(self.argparser.args.voidtrainfactor)) + "\n") struct_source.write("extern void** void_train;\n") struct_source.write("extern uint64_t current_void_size;\n") struct_source.write("extern uint64_t current_void_count;\n") |