File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -154,10 +154,14 @@ pub unsafe fn luaL_opt<T>(
154154// Generic Buffer Manipulation
155155//
156156
157+ #[ cfg( target_arch = "wasm32" ) ]
158+ const BUFSIZ : usize = 1024 ; // WASI libc's BUFSIZ is 1024
159+ #[ cfg( not( target_arch = "wasm32" ) ) ]
160+ const BUFSIZ : usize = libc:: BUFSIZ as usize ;
161+
157162// The buffer size used by the lauxlib buffer system.
158163// The "16384" workaround is taken from the LuaJIT source code.
159- #[ rustfmt:: skip]
160- pub const LUAL_BUFFERSIZE : usize = if libc:: BUFSIZ > 16384 { 8192 } else { libc:: BUFSIZ as usize } ;
164+ pub const LUAL_BUFFERSIZE : usize = if BUFSIZ > 16384 { 8192 } else { BUFSIZ } ;
161165
162166#[ repr( C ) ]
163167pub struct luaL_Buffer {
Original file line number Diff line number Diff line change @@ -189,10 +189,14 @@ pub unsafe fn luaL_opt<T>(
189189// Generic Buffer Manipulation
190190//
191191
192+ #[ cfg( target_arch = "wasm32" ) ]
193+ const BUFSIZ : usize = 1024 ; // WASI libc's BUFSIZ is 1024
194+ #[ cfg( not( target_arch = "wasm32" ) ) ]
195+ const BUFSIZ : usize = libc:: BUFSIZ as usize ;
196+
192197// The buffer size used by the lauxlib buffer system.
193198// The "16384" workaround is taken from the LuaJIT source code.
194- #[ rustfmt:: skip]
195- pub const LUAL_BUFFERSIZE : usize = if libc:: BUFSIZ > 16384 { 8192 } else { libc:: BUFSIZ as usize } ;
199+ pub const LUAL_BUFFERSIZE : usize = if BUFSIZ > 16384 { 8192 } else { BUFSIZ } ;
196200
197201#[ repr( C ) ]
198202pub struct luaL_Buffer {
You can’t perform that action at this time.
0 commit comments