mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-16 19:00:47 +00:00
Shallow copy for cached attributes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10098 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
27d173d80a
commit
8160d39d8c
2 changed files with 10 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2001-06-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/GSAttributedString.m: When caching attribute dictionaries
|
||||||
|
we make an immutable copy of the dictionary with shallow copy.
|
||||||
|
|
||||||
2001-06-06 Nicola Pero <n.pero@mi.flashnet.it>
|
2001-06-06 Nicola Pero <n.pero@mi.flashnet.it>
|
||||||
|
|
||||||
Configuration part of constant string support with gcc-3.0
|
Configuration part of constant string support with gcc-3.0
|
||||||
|
|
|
@ -125,7 +125,11 @@ cacheAttributes(NSDictionary *attrs)
|
||||||
node = GSIMapNodeForKey(&attrMap, (GSIMapKey)attrs);
|
node = GSIMapNodeForKey(&attrMap, (GSIMapKey)attrs);
|
||||||
if (node == 0)
|
if (node == 0)
|
||||||
{
|
{
|
||||||
attrs = [attrs copy];
|
/*
|
||||||
|
* Shallow copy of dictionary, without copying objects ... results
|
||||||
|
* in an immutable dictionary that can safely be cached.
|
||||||
|
*/
|
||||||
|
attrs = [[NSDictionary alloc] initWithDictionary: attrs copyItems: NO];
|
||||||
GSIMapAddPair(&attrMap, (GSIMapKey)attrs, (GSIMapVal)(unsigned)1);
|
GSIMapAddPair(&attrMap, (GSIMapKey)attrs, (GSIMapVal)(unsigned)1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue