diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-01-30 00:21:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-30 00:21:04 +0100 |
commit | 3878da883b8a54fb863fc6dcd9b9b8949caa6300 (patch) | |
tree | d4080e561b42f0ae706efe07b7158e9555eab708 /source.c | |
parent | ddc5aa7cd3121300f2ba6e68cb038258a616d4e4 (diff) | |
parent | 2cb627f3ba79bfce98e4cf6ab4b2e8029e8cb09e (diff) |
Merge pull request #36 from jow-/bytecode-fixes
Bytecode fixes
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); +} |