diff options
Diffstat (limited to 'mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c')
| -rwxr-xr-x | mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c b/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c index 734f03f0a..999bd6328 100755 --- a/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c +++ b/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c @@ -48,15 +48,15 @@ build_path(mrb_state *mrb, const char *dir, const char *base) len += strlen(dir) + strlen("/"); } - if ((path = mrb_malloc(mrb, len)) != NULL) { - memset(path, 0, len); + path = mrb_malloc(mrb, len); + memset(path, 0, len); - if (strcmp(dir, ".")) { - strcat(path, dir); - strcat(path, "/"); - } - strcat(path, base); + if (strcmp(dir, ".")) { + strcat(path, dir); + strcat(path, "/"); } + strcat(path, base); + return path; } @@ -73,10 +73,10 @@ dirname(mrb_state *mrb, const char *path) p = strrchr(path, '/'); len = p != NULL ? p - path : strlen(path); - if ((dir = mrb_malloc(mrb, len + 1)) != NULL) { - strncpy(dir, path, len); - dir[len] = '\0'; - } + dir = mrb_malloc(mrb, len + 1); + strncpy(dir, path, len); + dir[len] = '\0'; + return dir; } @@ -85,9 +85,7 @@ source_file_new(mrb_state *mrb, mrb_debug_context *dbg, char *filename) { source_file *file = NULL; - if ((file = mrb_malloc(mrb, sizeof(source_file))) == NULL) { - return NULL; - } + file = mrb_malloc(mrb, sizeof(source_file)); memset(file, '\0', sizeof(source_file)); file->fp = fopen(filename, "rb"); |
