From ff53c5585f46bed9622bd4a3071c8cf3db96a9ac Mon Sep 17 00:00:00 2001 From: Thomas Vigouroux Date: Fri, 9 Jul 2021 15:10:49 +0200 Subject: refactor(undo): don't assume curbuf in u_compute_hash --- src/nvim/fileio.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/nvim/fileio.c') diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 1203e231ac..ecea3fc01e 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -4967,13 +4967,10 @@ int buf_check_timestamp(buf_T *buf) buf_reload(buf, orig_mode); if (buf->b_p_udf && buf->b_ffname != NULL) { char_u hash[UNDO_HASH_SIZE]; - buf_T *save_curbuf = curbuf; - /* Any existing undo file is unusable, write it now. */ - curbuf = buf; - u_compute_hash(hash); - u_write_undo(NULL, FALSE, buf, hash); - curbuf = save_curbuf; + // Any existing undo file is unusable, write it now. + u_compute_hash(buf, hash); + u_write_undo(NULL, false, buf, hash); } } -- cgit