diff --git a/include/lol/format b/include/lol/format index ffe9be8b..e12308fe 100644 --- a/include/lol/format +++ b/include/lol/format @@ -12,11 +12,29 @@ #pragma once -#include -#if defined _LIBCPP_HAS_NO_INCOMPLETE_FORMAT +#define LOL_HAS_STD_FORMAT 1 + +#if !defined __SCE__ +# include // Provide _LIBCPP_HAS_NO_INCOMPLETE_FORMAT if relevant +# if defined _LIBCPP_HAS_NO_INCOMPLETE_FORMAT +# undef LOL_HAS_STD_FORMAT +# endif +#endif + +#if defined __SCE__ +# undef LOL_HAS_STD_FORMAT +# include +// These functions are used unconditionally in libfmt +static inline void flockfile(FILE* f) { } +static inline void funlockfile(FILE* f) { } +static inline int getc_unlocked(FILE*) { return 0; } +static inline int putc_unlocked(int, FILE*) { return 0; } +#endif + +#if defined LOL_HAS_STD_FORMAT +# include +#else # define FMT_HEADER_ONLY # include "3rdparty/fmt/include/fmt/format.h" namespace std { using fmt::format; } -#else -# include #endif diff --git a/include/lol/private/base/env.h b/include/lol/private/base/env.h index 64b4def6..e3048c8f 100644 --- a/include/lol/private/base/env.h +++ b/include/lol/private/base/env.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2020 Sam Hocevar +// Copyright © 2010–2024 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -12,13 +12,10 @@ #pragma once -#include // std::string -#include // _dupenv_s / std::getenv +#include // _dupenv_s / std::getenv +#include // std::string -namespace lol -{ - -namespace sys +namespace lol::sys { static inline std::string getenv(std::string const &var) @@ -32,13 +29,11 @@ static inline std::string getenv(std::string const &var) free(buf); return ret; } -#else +#elif !__SCE__ if (auto val = std::getenv(var.c_str())) return std::string(val); #endif return std::string(); } -} // namespace os - -} // namespace lol +} // namespace sys::lol