From 5a1123ed22002dad48a0def01ace19332069f3bd Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Mon, 5 Jan 2026 08:55:53 +0900 Subject: [PATCH] mruby-io: remove unused flock function The local flock() function for Windows is now dead code since the HAL refactoring. The Windows implementation is in hal-win-io which provides mrb_hal_io_flock(). Fixes warning: 'flock' defined but not used [-Wunused-function] Co-authored-by: Claude --- mrbgems/mruby-io/src/file.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/mrbgems/mruby-io/src/file.c b/mrbgems/mruby-io/src/file.c index 2368f9648..30ecd22a0 100644 --- a/mrbgems/mruby-io/src/file.c +++ b/mrbgems/mruby-io/src/file.c @@ -100,20 +100,6 @@ # define mrb_fstat(fd, sb) _fstat64(fd, sb) #endif -#ifdef _WIN32 -static int -flock(int fd, int operation) -{ - HANDLE h = (HANDLE)_get_osfhandle(fd); - DWORD flags; - flags = ((operation & LOCK_NB) ? LOCKFILE_FAIL_IMMEDIATELY : 0) - | ((operation & LOCK_SH) ? LOCKFILE_EXCLUSIVE_LOCK : 0); - static const OVERLAPPED zero_ov = {0}; - OVERLAPPED ov = zero_ov; - return LockFileEx(h, flags, 0, 0xffffffff, 0xffffffff, &ov) ? 0 : -1; -} -#endif - /* * call-seq: * File.umask([mask]) -> integer