diff options
Diffstat (limited to 'mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c')
| -rwxr-xr-x | mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c b/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c index f1bf34a06..9515e8be4 100755 --- a/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +++ b/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c @@ -14,6 +14,7 @@ #include "mruby/variable.h" #include "mrdberror.h" #include "apibreak.h" +#include "apistring.h" #define MAX_BREAKPOINTNO (MAX_BREAKPOINT * 1024) #define MRB_DEBUG_BP_FILE_OK (0x0001) @@ -202,7 +203,7 @@ mrb_debug_set_break_line( mrb_state *mrb, mrb_debug_context *dbg, const char *fi return MRB_DEBUG_BREAK_INVALID_LINENO; } - set_file = mrb_malloc(mrb, strlen(file) + 1); + set_file = mrb_debug_strdup(mrb, file); if(set_file == NULL) { return MRB_DEBUG_NOBUF; } @@ -215,8 +216,6 @@ mrb_debug_set_break_line( mrb_state *mrb, mrb_debug_context *dbg, const char *fi dbg->bp[index].point.linepoint.lineno = lineno; dbg->bpnum++; - strncpy(set_file, file, strlen(file) + 1); - dbg->bp[index].point.linepoint.file = set_file; return dbg->bp[index].bpno; @@ -242,18 +241,16 @@ mrb_debug_set_break_method( mrb_state *mrb, mrb_debug_context *dbg, const char * } if(class_name != NULL) { - set_class = mrb_malloc(mrb, strlen(class_name) + 1); + set_class = mrb_debug_strdup(mrb, class_name); if(set_class == NULL) { return MRB_DEBUG_NOBUF; } - - strncpy(set_class, class_name, strlen(class_name) + 1); } else { set_class = NULL; } - set_method = mrb_malloc(mrb, strlen(method_name) + 1); + set_method = mrb_debug_strdup(mrb, method_name); if(set_method == NULL) { if(set_class != NULL) { mrb_free(mrb, (void*)set_class); @@ -261,8 +258,6 @@ mrb_debug_set_break_method( mrb_state *mrb, mrb_debug_context *dbg, const char * return MRB_DEBUG_NOBUF; } - strncpy(set_method, method_name, strlen(method_name) + 1); - index = dbg->bpnum; dbg->bp[index].bpno = dbg->next_bpno; dbg->next_bpno++; |
