diff options
author | elfmz <fenix1905@tut.by> | 2022-02-20 02:02:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-20 02:02:21 +0300 |
commit | e0f3f14fb3d648ba640e75cf25e257ac8fde4865 (patch) | |
tree | a88b1d0d075cd8a951a757e45114cf64a8cd6fb3 /far2l/src/base | |
parent | dc2f6de4c2f438046b4d31cf4c2078b6ad65a5ce (diff) |
Language refactor (#1271)
optimized and refactored language files loader
got rid of MSG() macro and use Msg:: namespace instead
Diffstat (limited to 'far2l/src/base')
-rw-r--r-- | far2l/src/base/FARString.cpp | 9 | ||||
-rw-r--r-- | far2l/src/base/FARString.hpp | 7 | ||||
-rw-r--r-- | far2l/src/base/InterThreadCall.cpp | 4 | ||||
-rw-r--r-- | far2l/src/base/InterThreadCall.hpp | 2 |
4 files changed, 12 insertions, 10 deletions
diff --git a/far2l/src/base/FARString.cpp b/far2l/src/base/FARString.cpp index b1a55411..d087ccb0 100644 --- a/far2l/src/base/FARString.cpp +++ b/far2l/src/base/FARString.cpp @@ -37,6 +37,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <stdarg.h> #include <assert.h> #include <limits> +#include "lang.hpp" /// change to 1 to enable stats & leaks detection (slow!) #if 0 @@ -56,7 +57,7 @@ static DbgStr &DBGSTR() return s_out; } -void __attribute__((noinline)) dbgStrCreated(void *c, unsigned int Capacity) +void FN_NOINLINE dbgStrCreated(void *c, unsigned int Capacity) { std::lock_guard<std::mutex> lock(DBGSTR().Mtx); if (!DBGSTR().Instances.insert(c).second) abort(); @@ -64,7 +65,7 @@ void __attribute__((noinline)) dbgStrCreated(void *c, unsigned int Capacity) // (unsigned long)DBGSTR().Instances.size(), DBGSTR().Addrefs, Capacity); } -void __attribute__((noinline)) dbgStrDestroyed(void *c, unsigned int Capacity) +void FN_NOINLINE dbgStrDestroyed(void *c, unsigned int Capacity) { std::lock_guard<std::mutex> lock(DBGSTR().Mtx); if (!DBGSTR().Instances.erase(c)) abort(); @@ -72,7 +73,7 @@ void __attribute__((noinline)) dbgStrDestroyed(void *c, unsigned int Capacity) // (unsigned long)DBGSTR().Instances.size(), DBGSTR().Addrefs, Capacity); } -void __attribute__((noinline)) dbgStrAddref(const wchar_t *Data) +void FN_NOINLINE dbgStrAddref(const wchar_t *Data) { std::lock_guard<std::mutex> lock(DBGSTR().Mtx); ++DBGSTR().Addrefs; @@ -140,7 +141,7 @@ FARString::Content *FARString::Content::Create(size_t nCapacity, const wchar_t * return out; } -void __attribute__((noinline)) FARString::Content::Destroy(Content *c) +void FN_NOINLINE FARString::Content::Destroy(Content *c) { dbgStrDestroyed(c, c->m_nCapacity); diff --git a/far2l/src/base/FARString.hpp b/far2l/src/base/FARString.hpp index 9efc150f..89888dd3 100644 --- a/far2l/src/base/FARString.hpp +++ b/far2l/src/base/FARString.hpp @@ -36,9 +36,10 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <sys/types.h> #include <string.h> #include <string> -#include <luck.h> +#include <cctweaks.h> #include <WinCompat.h> #include "locale.hpp" +#include "lang.hpp" #define NullToEmpty(s) (s?s:L"") @@ -148,8 +149,8 @@ public: std::string GetMB() const; inline std::wstring GetWide() const { return std::wstring(CPtr(), GetLength()); } - FARString& Format(const wchar_t * format, ...); - FARString& AppendFormat(const wchar_t * format, ...); + FARString& Format(const wchar_t *format, ...); + FARString& AppendFormat(const wchar_t *format, ...); FARString& Replace(size_t Pos, size_t Len, const wchar_t* Data, size_t DataLen); FARString& Replace(size_t Pos, size_t Len, const FARString& Str) { return Replace(Pos, Len, Str.CPtr(), Str.GetLength()); } diff --git a/far2l/src/base/InterThreadCall.cpp b/far2l/src/base/InterThreadCall.cpp index 54d0b1f4..85b54799 100644 --- a/far2l/src/base/InterThreadCall.cpp +++ b/far2l/src/base/InterThreadCall.cpp @@ -1,5 +1,5 @@ #include <assert.h> -#include <luck.h> +#include <cctweaks.h> #include <vector> #include <mutex> #include <atomic> @@ -24,7 +24,7 @@ static std::atomic<unsigned int> g_thread_id_counter{0}; thread_local unsigned int g_thread_id; -static unsigned int __attribute__((noinline)) GenerateThreadID() +static unsigned int FN_NOINLINE GenerateThreadID() { unsigned int tid = ++g_thread_id_counter; while (UNLIKELY(tid == 0)) { diff --git a/far2l/src/base/InterThreadCall.hpp b/far2l/src/base/InterThreadCall.hpp index ab450718..dc3ed25e 100644 --- a/far2l/src/base/InterThreadCall.hpp +++ b/far2l/src/base/InterThreadCall.hpp @@ -2,7 +2,7 @@ #include <functional> #include <mutex> #include <condition_variable> -#include <luck.h> +#include <cctweaks.h> struct IInterThreadCallDelegate { |