mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-18 08:10:32 +01:00
Speedup: Avoid string copy in CXMLReaderImpl::getAttributeByName
string has operator== for char_type which can save a lot of string allocations when loading xml's. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6206 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
b709d2a772
commit
bfaffe1171
@ -1,5 +1,6 @@
|
|||||||
--------------------------
|
--------------------------
|
||||||
Changes in 1.9 (not yet released)
|
Changes in 1.9 (not yet released)
|
||||||
|
- Speedup: Avoid string copy in CXMLReaderImpl::getAttributeByName
|
||||||
- Fix bug in rect::clipAgainst that had caused rects completely outside to the left-top of the rect to be clipped against ending up with both corners outside.
|
- Fix bug in rect::clipAgainst that had caused rects completely outside to the left-top of the rect to be clipped against ending up with both corners outside.
|
||||||
It still worked for UI in most cases as the resulting rectangle still had an area of 0.
|
It still worked for UI in most cases as the resulting rectangle still had an area of 0.
|
||||||
- Add getAlign functions to IGUIElement
|
- Add getAlign functions to IGUIElement
|
||||||
|
@ -494,14 +494,12 @@ private:
|
|||||||
// finds a current attribute by name, returns 0 if not found
|
// finds a current attribute by name, returns 0 if not found
|
||||||
const SAttribute* getAttributeByName(const char_type* name) const
|
const SAttribute* getAttributeByName(const char_type* name) const
|
||||||
{
|
{
|
||||||
if (!name)
|
if (name)
|
||||||
return 0;
|
{
|
||||||
|
for (irr::u32 i=0; i<Attributes.size(); ++i)
|
||||||
core::string<char_type> n = name;
|
if (Attributes[i].Name == name)
|
||||||
|
|
||||||
for (int i=0; i<(int)Attributes.size(); ++i)
|
|
||||||
if (Attributes[i].Name == n)
|
|
||||||
return &Attributes[i];
|
return &Attributes[i];
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -644,7 +642,7 @@ private:
|
|||||||
//! converts the text file into the desired format.
|
//! converts the text file into the desired format.
|
||||||
/** \param source: begin of the text (without byte order mark)
|
/** \param source: begin of the text (without byte order mark)
|
||||||
\param pointerToStore: pointer to text data block which can be
|
\param pointerToStore: pointer to text data block which can be
|
||||||
stored or deleted based on the nesessary conversion.
|
stored or deleted based on the necessary conversion.
|
||||||
\param sizeWithoutHeader: Text size in characters without header
|
\param sizeWithoutHeader: Text size in characters without header
|
||||||
*/
|
*/
|
||||||
template<class src_char_type>
|
template<class src_char_type>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Tests finished. 72 tests of 72 passed.
|
Tests finished. 72 tests of 72 passed.
|
||||||
Compiled as DEBUG
|
Compiled as DEBUG
|
||||||
Test suite pass at GMT Thu Feb 11 14:00:00 2021
|
Test suite pass at GMT Sat Feb 13 16:24:31 2021
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user