summaryrefslogtreecommitdiff
path: root/src/common
AgeCommit message (Collapse)Author
2018-07-22string_util: Get rid of separate resize() in CPToUTF16(), UTF16ToUTF8(), ↵Lioncash
CodeToUTF8() and UTF8ToUTF16() There's no need to perform the resize separately here, since the constructor allows presizing the buffer. Also move the empty string check before the construction of the string to make the early out more straightforward.
2018-07-22string_util: Use emplace_back() in SplitString() instead of push_back()Lioncash
This is equivalent to doing: push_back(std::string("")); which is likely not to cause issues, assuming a decent std::string implementation with small-string optimizations implemented in its design, however it's still a little unnecessary to copy that buffer regardless. Instead, we can use emplace_back() to directly construct the empty string within the std::vector instance, eliminating any possible overhead from the copy.
2018-07-22string_util: Remove unnecessary std::string instance in TabsToSpaces()Lioncash
We can just use the variant of std::string's replace() function that can replace an occurrence with N copies of the same character, eliminating the need to allocate a std::string containing a buffer of spaces.
2018-07-22Merge pull request #768 from lioncash/string-viewbunnei
file_util, vfs: Use std::string_view where applicable
2018-07-22file_util, vfs: Use std::string_view where applicableLioncash
Avoids unnecessary construction of std::string instances where applicable.
2018-07-22Merge pull request #765 from lioncash/filebunnei
file_util: Remove goto usages from Copy()
2018-07-21file_util: Remove goto usages from Copy()Lioncash
We can just leverage std::unique_ptr to automatically close these for us in error cases instead of jumping to the end of the function to call fclose on them.
2018-07-21file_util: Use a u64 to represent number of entriesLioncash
This avoids a truncating cast on size. I doubt we'd ever traverse a directory this large, however we also shouldn't truncate sizes away.
2018-07-21file_util: std::move FST entries in ScanDirectoryTree()Lioncash
Avoids unnecessary copies when building up the FST entries.
2018-07-21Merge pull request #759 from lioncash/redundantbunnei
file_util: Remove redundant duplicate return in GetPathWithoutTop()
2018-07-21Merge pull request #758 from lioncash/syncbunnei
common: Remove synchronized_wrapper.h
2018-07-21file_util: Use an enum class for GetUserPath()Lioncash
Instead of using an unsigned int as a parameter and expecting a user to always pass in the correct values, we can just convert the enum into an enum class and use that type as the parameter type instead, which makes the interface more type safe. We also get rid of the bookkeeping "NUM_" element in the enum by just using an unordered map. This function is generally low-frequency in terms of calls (and I'd hope so, considering otherwise would mean we're slamming the disk with IO all the time) so I'd consider this acceptable in this case.
2018-07-21file_util: Remove explicit type from std::min() in GetPathWithoutTop()Lioncash
Given both operands are the same type, there won't be an issue with overload selection that requires making this explicit.
2018-07-21file_util: Remove redundant duplicate return in GetPathWithoutTop()Lioncash
2018-07-21common: Remove synchronized_wrapper.hLioncash
This is entirely unused in the codebase.
2018-07-20Merge pull request #743 from lioncash/viewbunnei
logging: Use std::string_view where applicable
2018-07-20param_package: Take std::string by value in string-based Set() functionLioncash
Allows avoiding string copies by letting the strings be moved into the function calls.
2018-07-20param_package: Use std::unordered_map's insert_or_assign instead of map indexingLioncash
This avoids a redundant std::string construction if a key doesn't exist in the map already. e.g. data[key] requires constructing a new default instance of the value in the map (but this is wasteful, since we're already setting something into the map over top of it).
2018-07-20param_package: Get rid of file-static std::string constructionLioncash
Avoids potential dynamic allocation occuring during program launch
2018-07-20logging/filter: Use std::string_view in ParseFilterString()Lioncash
Allows avoiding constructing std::string instances, since this only reads an arbitrary sequence of characters. We can also make ParseFilterRule() internal, since it doesn't depend on any private instance state of Filter
2018-07-20logging/backend: Add missing standard includesLioncash
A few inclusions were being satisfied indirectly. To prevent breakages in the future, include these directly.
2018-07-20logging/backend: Use std::string_view in RemoveBackend() and GetBackend()Lioncash
These can just use a view to a string since its only comparing against two names in both cases for matches. This avoids constructing std::string instances where they aren't necessary.
2018-07-19Merge pull request #711 from lioncash/swapbunnei
common/swap: Minor changes
2018-07-19Merge pull request #710 from lioncash/unusedbunnei
common/common_funcs: Remove unused rotation functions
2018-07-19Merge pull request #709 from lioncash/thread-localbunnei
common/misc: Deduplicate code in GetLastErrorMsg()
2018-07-19Merge pull request #705 from lioncash/string-refbunnei
file_util: return string by const reference for GetExeDirectory()
2018-07-19common/swap: Remove unnecessary const on return value of swap()Lioncash
2018-07-19common/swap: Use static_cast where applicableLioncash
2018-07-19common/swap: Use using aliases where applicableLioncash
2018-07-19common/common_funcs: Remove unused rotation functionsLioncash
These are unused and essentially don't provide much benefit either. If we ever need rotation functions, these can be introduced in a way that they don't sit in a common_* header and require a bunch of ifdefing to simply be available
2018-07-19common/misc: Deduplicate code in GetLastErrorMsg()Lioncash
Android and macOS have supported thread_local for quite a while, but most importantly is that we don't even really need it. Instead of using a thread-local buffer, we can just return a non-static buffer as a std::string, avoiding the need for that quality entirely.
2018-07-19file_util: return string by const reference for GetExeDirectory()Lioncash
This disallows modifying the internal string buffer (which shouldn't be modified anyhow).
2018-07-18string_util: Remove AsciiToHex()Lioncash
Easy TODO
2018-07-18Merge pull request #686 from lioncash/fmtbunnei
externals: update fmt to version 5.1.0
2018-07-18Virtual Filesystem 2: Electric Boogaloo (#676)Zach Hilman
* Virtual Filesystem * Fix delete bug and documentate * Review fixes + other stuff * Fix puyo regression
2018-07-18externals: update fmt to version 5.1.0Lioncash
Previously, we were on 4.1.0, which was a major version behind.
2018-07-18telemetry: Remove unnecessary Field constructorLioncash
We can just take the value parameter by value which allows both moving into it, and copies at the same time, depending on the calling code.
2018-07-18telemetry: Make operator== and operator!= const member functions of FieldLioncash
These operators don't modify internal class state, so they can be made const member functions. While we're at it, drop the unnecessary inline keywords. Member functions that are defined in the class declaration are already inline by default.
2018-07-18telemetry: Default copy/move constructors and assignment operatorsLioncash
This provides the equivalent behavior, but without as much boilerplate. While we're at it, explicitly default the move constructor, since we have a move-assignment operator defined.
2018-07-15Merge pull request #664 from jroweboy/logging-stuffbunnei
Minor logging improvements
2018-07-15Logging: Dump all logs in the queue on close in debug modeJames Rowe
2018-07-14Logging: Don't lock the queue for the duration of the writeJames Rowe
2018-07-12More improvements to GDBStub (#653)Hedges
* More improvements to GDBStub - Debugging of threads should work correctly with source and assembly level stepping and modifying registers and memory, meaning threads and callstacks are fully clickable in VS. - List of modules is available to the client, with assumption that .nro and .nso are backed up by an .elf with symbols, while deconstructed ROMs keep N names. - Initial support for floating point registers. * Tidy up as requested in PR feedback * Tidy up as requested in PR feedback
2018-07-10Merge pull request #633 from FearlessTobi/port-definesbunnei
Port #3579 from Citra: Clean up architecture-specific defines
2018-07-09Merge pull request #635 from FearlessTobi/port-crashfixbunnei
Port #3474 from Citra: Do not crash on unimplemented code in debug build
2018-07-07Revert "Virtual Filesystem (#597)"bunnei
This reverts commit 77c684c1140f6bf3fb7d4560d06d2efb1a2ee5e2.
2018-07-07Port #3474 from CitrafearlessTobi
2018-07-07Port #3579 from CitrafearlessTobi
2018-07-06Merge pull request #630 from FearlessTobi/remove-citra-referencesbunnei
Remove some references to Citra
2018-07-06Virtual Filesystem (#597)Zach Hilman
* Add VfsFile and VfsDirectory classes * Finish abstract Vfs classes * Implement RealVfsFile (computer fs backend) * Finish RealVfsFile and RealVfsDirectory * Finished OffsetVfsFile * More changes * Fix import paths * Major refactor * Remove double const * Use experimental/filesystem or filesystem depending on compiler * Port partition_filesystem * More changes * More Overhaul * FSP_SRV fixes * Fixes and testing * Try to get filesystem to compile * Filesystem on linux * Remove std::filesystem and document/test * Compile fixes * Missing include * Bug fixes * Fixes * Rename v_file and v_dir * clang-format fix * Rename NGLOG_* to LOG_* * Most review changes * Fix TODO * Guess 'main' to be Directory by filename