Skip to content
Merged

Next #1197

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/fast_io_core_impl/freestanding/algorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -768,10 +768,10 @@ inline constexpr ForwardIt uninitialized_fill(ForwardIt first, ForwardIt last, T
}

template <::std::input_iterator ForwardIt, typename T>
inline constexpr void uninitialized_fill_n(ForwardIt first, ::std::size_t n, T const &x) noexcept(
inline constexpr ForwardIt uninitialized_fill_n(ForwardIt first, ::std::size_t n, T const &x) noexcept(
::std::is_nothrow_copy_constructible_v<typename ::std::iterator_traits<ForwardIt>::value_type>)
{
::fast_io::freestanding::uninitialized_fill(first, ::std::next(first, n), x);
return ::fast_io::freestanding::uninitialized_fill(first, ::std::next(first, n), x);
}

template <::std::forward_iterator ForwardIt>
Expand Down
2 changes: 1 addition & 1 deletion include/fast_io_hosted/file_loaders/posix_file_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ inline void posix_unload_address(void *address, [[maybe_unused]] ::std::size_t f
{
if (address != (void *)-1) [[likely]]
{
sys_munmap(address, file_size);
sys_munmap_nothrow(address, file_size);
}
}

Expand Down
16 changes: 8 additions & 8 deletions include/fast_io_hosted/platforms/posix_mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ inline int sys_mprotect(void *start, ::std::size_t len, int prot)
return result;
}

inline int sys_munmap(void *addr, ::std::size_t len)
inline int sys_munmap_nothrow(void *addr, ::std::size_t len)
{
return
#if defined(__linux__) && defined(__NR_munmap)
Expand All @@ -79,9 +79,9 @@ inline int sys_munmap(void *addr, ::std::size_t len)
#endif
}

inline void sys_munmap_throw_error(void *addr, ::std::size_t len)
inline void sys_munmap(void *addr, ::std::size_t len)
{
system_call_throw_error(sys_munmap(addr, len));
system_call_throw_error(sys_munmap_nothrow(addr, len));
}
} // namespace details

Expand Down Expand Up @@ -195,7 +195,7 @@ class posix_memory_map_file
}
if (this->address_begin != reinterpret_cast<::std::byte *>(MAP_FAILED)) [[likely]]
{
details::sys_munmap(this->address_begin, static_cast<::std::size_t>(address_end - address_begin));
details::sys_munmap_nothrow(this->address_begin, static_cast<::std::size_t>(address_end - address_begin));
}
this->address_begin = other.address_begin;
this->address_end = other.address_end;
Expand Down Expand Up @@ -291,20 +291,20 @@ class posix_memory_map_file
{
return address_begin[pos];
}
inline void close()
inline constexpr void close()
{
if (this->address_begin != MAP_FAILED) [[likely]]
{
auto ret{details::sys_munmap(this->address_begin, static_cast<::std::size_t>(address_end - address_begin))};
auto ret{details::sys_munmap_nothrow(this->address_begin, static_cast<::std::size_t>(address_end - address_begin))};
this->address_end = this->address_begin = reinterpret_cast<::std::byte *>(MAP_FAILED);
system_call_throw_error(ret);
}
}
inline ~posix_memory_map_file()
inline constexpr ~posix_memory_map_file()
{
if (this->address_begin != MAP_FAILED) [[likely]]
{
details::sys_munmap(this->address_begin, static_cast<::std::size_t>(address_end - address_begin));
details::sys_munmap_nothrow(this->address_begin, static_cast<::std::size_t>(address_end - address_begin));
}
}
};
Expand Down
5 changes: 4 additions & 1 deletion include/fast_io_hosted/platforms/win32/apis.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,8 @@ FAST_IO_DLLIMPORT int FAST_IO_WINSTDCALL PrefetchVirtualMemory(void *, ::std::si
FAST_IO_DLLIMPORT int FAST_IO_WINSTDCALL SetConsoleTextAttribute(void *, ::std::int_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(SetConsoleTextAttribute, 8);
FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL GetCurrentThreadId() noexcept FAST_IO_WINSTDCALL_RENAME(GetCurrentThreadId, 0);
FAST_IO_DLLIMPORT void FAST_IO_WINSTDCALL Sleep(::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(Sleep, 4);

FAST_IO_DLLIMPORT char16_t *FAST_IO_WINSTDCALL GetEnvironmentStringsW() noexcept FAST_IO_WINSTDCALL_RENAME(GetEnvironmentStringsW, 0);
FAST_IO_DLLIMPORT char *FAST_IO_WINSTDCALL GetEnvironmentStringsA() noexcept FAST_IO_WINSTDCALL_RENAME(GetEnvironmentStringsA, 0);
FAST_IO_DLLIMPORT int FAST_IO_WINSTDCALL FreeEnvironmentStringsW(char16_t*) noexcept FAST_IO_WINSTDCALL_RENAME(FreeEnvironmentStringsW, 4);
FAST_IO_DLLIMPORT int FAST_IO_WINSTDCALL FreeEnvironmentStringsA(char*) noexcept FAST_IO_WINSTDCALL_RENAME(FreeEnvironmentStringsA, 4);
} // namespace fast_io::win32
2 changes: 1 addition & 1 deletion include/fast_io_hosted/threads/thread/c_malloc_guard.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once
#pragma once

namespace fast_io::details
{
Expand Down
2 changes: 1 addition & 1 deletion include/fast_io_hosted/threads/thread/impl.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once
#pragma once

#if (defined(_WIN32) && !defined(__WINE__)) && !defined(__CYGWIN__)
#ifdef _WIN32_WINDOWS
Expand Down
2 changes: 1 addition & 1 deletion include/fast_io_hosted/threads/thread/nt.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once
#pragma once

#include <chrono>
#include <ranges>
Expand Down
2 changes: 1 addition & 1 deletion include/fast_io_hosted/threads/thread/posix.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#pragma once
#pragma once
2 changes: 1 addition & 1 deletion include/fast_io_hosted/threads/thread/win32.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once
#pragma once

#include <chrono>
#include <ranges>
Expand Down
Loading