diff options
Diffstat (limited to 'src/webidl-ast.c')
-rw-r--r-- | src/webidl-ast.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/webidl-ast.c b/src/webidl-ast.c index 75dbdeb..7e6fc2c 100644 --- a/src/webidl-ast.c +++ b/src/webidl-ast.c @@ -359,23 +359,25 @@ int webidl_ast_dump(struct webidl_node *node, int indent) static FILE *idlopen(const char *filename) { FILE *idlfile; + char *fullname; + int fulllen; if (options->idlpath == NULL) { if (options->verbose) { printf("Opening IDL file %s\n", filename); } - idlfile = fopen(filename, "r"); - } else { - char *fullname; - int fulllen = strlen(options->idlpath) + strlen(filename) + 2; - fullname = malloc(fulllen); - snprintf(fullname, fulllen, "%s/%s", options->idlpath, filename); - if (options->verbose) { - printf("Opening IDL file %s\n", fullname); - } - idlfile = fopen(fullname, "r"); - free(fullname); + return fopen(filename, "r"); + } + + fulllen = strlen(options->idlpath) + strlen(filename) + 2; + fullname = malloc(fulllen); + snprintf(fullname, fulllen, "%s/%s", options->idlpath, filename); + if (options->verbose) { + printf("Opening IDL file %s\n", fullname); } + idlfile = fopen(fullname, "r"); + free(fullname); + return idlfile; } |