Skip to content

Commit 6647212

Browse files
authored
fix: segfault caused by path.shorten in nvim-0.7 (#321)
signature of `shorten_dir` changed in upstream update ffi calls accordingly fixes #320
1 parent e86dc9b commit 6647212

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lua/plenary/path.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ local shorten = (function()
397397
local ffi = require "ffi"
398398
ffi.cdef [[
399399
typedef unsigned char char_u;
400-
char_u *shorten_dir(char_u *str);
400+
void shorten_dir(char_u *str);
401401
]]
402402
return function(filename)
403403
if not filename or is_uri(filename) then
@@ -406,7 +406,8 @@ local shorten = (function()
406406

407407
local c_str = ffi.new("char[?]", #filename + 1)
408408
ffi.copy(c_str, filename)
409-
return ffi.string(ffi.C.shorten_dir(c_str))
409+
ffi.C.shorten_dir(c_str)
410+
return ffi.string(c_str)
410411
end
411412
end
412413
return function(filename)

0 commit comments

Comments
 (0)