diff options
Diffstat (limited to 'source.c')
-rw-r--r-- | source.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -34,6 +34,7 @@ uc_source_new_file(const char *path) src->fp = fp; src->buffer = NULL; src->filename = strcpy((char *)src + ALIGN(sizeof(*src)), path); + src->runpath = src->filename; src->usecount = 1; @@ -113,6 +114,9 @@ uc_source_put(uc_source_t *source) return; } + if (source->runpath != source->filename) + free(source->runpath); + uc_vector_clear(&source->lineinfo); fclose(source->fp); free(source->buffer); @@ -211,3 +215,12 @@ uc_source_line_update(uc_source_t *source, size_t off) } } } + +void +uc_source_runpath_set(uc_source_t *source, const char *runpath) +{ + if (source->runpath != source->filename) + free(source->runpath); + + source->runpath = xstrdup(runpath); +} |