diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2009-11-02 15:21:07 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2009-11-02 15:21:07 -0800 |
commit | 69a1cbeccd0834937a46c95da08948d684868c17 (patch) | |
tree | 4e721dab2e2442d3e7a0f390d6679f46d7a55da1 /lib.c | |
parent | 6191fbb2ca7a9ac339dd3994bdea8273ceb0a24d (diff) | |
download | txr-69a1cbeccd0834937a46c95da08948d684868c17.tar.gz txr-69a1cbeccd0834937a46c95da08948d684868c17.tar.bz2 txr-69a1cbeccd0834937a46c95da08948d684868c17.zip |
Lazy string fix.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -836,7 +836,8 @@ obj_t *sub_str(obj_t *str_in, obj_t *from, obj_t *to) } else { size_t size = c_num(to) - c_num(from) + 1; char *sub = chk_malloc(size); - strncpy(sub, c_str(str_in) + c_num(from), size); + const char *str = c_str(lazy_stringp(str_in) ? str_in->ls.prefix : str_in); + strncpy(sub, str + c_num(from), size); sub[size-1] = 0; return string_own(sub); } |