mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
Tidied
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@6480 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b22519a201
commit
1d72e5e27d
4 changed files with 11 additions and 9 deletions
|
@ -176,14 +176,14 @@
|
||||||
</desc>
|
</desc>
|
||||||
<standards><GNUstep/><NotOpenStep/><NotMacOS-X/></standards>
|
<standards><GNUstep/><NotOpenStep/><NotMacOS-X/></standards>
|
||||||
</function>
|
</function>
|
||||||
<function name="GSUSet" type="void">
|
<function name="GSUSet" type="id">
|
||||||
<arg type="id">anObject</arg>
|
<arg type="id">anObject</arg>
|
||||||
<arg type="unsigned int">count</arg>
|
<arg type="unsigned int">count</arg>
|
||||||
<desc>
|
<desc>
|
||||||
This function sets the count for the specified object. If the
|
This function sets the count for the specified object. If the
|
||||||
count for the object is set to zero then the object is removed
|
count for the object is set to zero then the object is removed
|
||||||
from the global uniquing set. The object is added to the set
|
from the global uniquing set. The object is added to the set
|
||||||
if necessary.
|
if necessary. The object returned is the one stored in the set.
|
||||||
The function handles locking as necessary. It can be used to
|
The function handles locking as necessary. It can be used to
|
||||||
alter the set even when uniquing is turned off.
|
alter the set even when uniquing is turned off.
|
||||||
</desc>
|
</desc>
|
||||||
|
|
|
@ -194,12 +194,12 @@ Standards: NotOpenStep NotMacOS-X<br>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
<h2><a name="function-14">GSUSet</a></h2>
|
<h2><a name="function-14">GSUSet</a></h2>
|
||||||
<b>Prototype:</b> void GSUSet(id anObject, unsigned int count)<br>
|
<b>Prototype:</b> id GSUSet(id anObject, unsigned int count)<br>
|
||||||
|
|
||||||
This function sets the count for the specified object. If the
|
This function sets the count for the specified object. If the
|
||||||
count for the object is set to zero then the object is removed
|
count for the object is set to zero then the object is removed
|
||||||
from the global uniquing set. The object is added to the set
|
from the global uniquing set. The object is added to the set
|
||||||
if necessary.
|
if necessary. The object returned is the one stored in the set.
|
||||||
The function handles locking as necessary. It can be used to
|
The function handles locking as necessary. It can be used to
|
||||||
alter the set even when uniquing is turned off.
|
alter the set even when uniquing is turned off.
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ id GSUnique(id anObject);
|
||||||
* Setting the count to zero will remove the object from the global set.
|
* Setting the count to zero will remove the object from the global set.
|
||||||
*/
|
*/
|
||||||
void GSUPurge(unsigned count);
|
void GSUPurge(unsigned count);
|
||||||
void GSUSet(id anObject, unsigned count);
|
id GSUSet(id anObject, unsigned count);
|
||||||
|
|
||||||
#include <base/KeyedCollecting.h>
|
#include <base/KeyedCollecting.h>
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ GSUPurge(unsigned level)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
id
|
||||||
GSUSet(id obj, unsigned level)
|
GSUSet(id obj, unsigned level)
|
||||||
{
|
{
|
||||||
id found;
|
id found;
|
||||||
|
@ -249,6 +249,7 @@ GSUSet(id obj, unsigned level)
|
||||||
found = [uniqueSet member: obj];
|
found = [uniqueSet member: obj];
|
||||||
if (found == nil)
|
if (found == nil)
|
||||||
{
|
{
|
||||||
|
found = obj;
|
||||||
for (i = 0; i < level; i++)
|
for (i = 0; i < level; i++)
|
||||||
{
|
{
|
||||||
[uniqueSet addObject: obj];
|
[uniqueSet addObject: obj];
|
||||||
|
@ -256,12 +257,12 @@ GSUSet(id obj, unsigned level)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
i = [uniqueSet countForObject: obj];
|
i = [uniqueSet countForObject: found];
|
||||||
if (i < level)
|
if (i < level)
|
||||||
{
|
{
|
||||||
while (i < level)
|
while (i < level)
|
||||||
{
|
{
|
||||||
[uniqueSet addObject: obj];
|
[uniqueSet addObject: found];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -269,7 +270,7 @@ GSUSet(id obj, unsigned level)
|
||||||
{
|
{
|
||||||
while (i > level)
|
while (i > level)
|
||||||
{
|
{
|
||||||
[uniqueSet removeObject: obj];
|
[uniqueSet removeObject: found];
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,6 +279,7 @@ GSUSet(id obj, unsigned level)
|
||||||
{
|
{
|
||||||
(*unlockImp)(uniqueLock, @selector(unlock));
|
(*unlockImp)(uniqueLock, @selector(unlock));
|
||||||
}
|
}
|
||||||
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
id
|
id
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue