diff --git a/Documentation/gsdoc/NSCountedSet.gsdoc b/Documentation/gsdoc/NSCountedSet.gsdoc
index 871a0d530..1d02d6a5d 100644
--- a/Documentation/gsdoc/NSCountedSet.gsdoc
+++ b/Documentation/gsdoc/NSCountedSet.gsdoc
@@ -176,14 +176,14 @@
-
+
anObject
count
This function sets the count for the specified object. If the
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
- 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
alter the set even when uniquing is turned off.
diff --git a/Documentation/gsdoc/NSCountedSet.html b/Documentation/gsdoc/NSCountedSet.html
index 262511e5c..fe817136b 100644
--- a/Documentation/gsdoc/NSCountedSet.html
+++ b/Documentation/gsdoc/NSCountedSet.html
@@ -194,12 +194,12 @@ Standards: NotOpenStep NotMacOS-X
-Prototype: void GSUSet(id anObject, unsigned int count)
+Prototype: id GSUSet(id anObject, unsigned int count)
This function sets the count for the specified object. If the
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
- 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
alter the set even when uniquing is turned off.
diff --git a/Headers/gnustep/base/NSSet.h b/Headers/gnustep/base/NSSet.h
index 8a5c4c8a5..d8452e3f5 100644
--- a/Headers/gnustep/base/NSSet.h
+++ b/Headers/gnustep/base/NSSet.h
@@ -127,7 +127,7 @@ id GSUnique(id anObject);
* Setting the count to zero will remove the object from the global set.
*/
void GSUPurge(unsigned count);
-void GSUSet(id anObject, unsigned count);
+id GSUSet(id anObject, unsigned count);
#include
diff --git a/Source/NSCountedSet.m b/Source/NSCountedSet.m
index 3e850c71c..e1bafe223 100644
--- a/Source/NSCountedSet.m
+++ b/Source/NSCountedSet.m
@@ -236,7 +236,7 @@ GSUPurge(unsigned level)
}
}
-void
+id
GSUSet(id obj, unsigned level)
{
id found;
@@ -249,6 +249,7 @@ GSUSet(id obj, unsigned level)
found = [uniqueSet member: obj];
if (found == nil)
{
+ found = obj;
for (i = 0; i < level; i++)
{
[uniqueSet addObject: obj];
@@ -256,12 +257,12 @@ GSUSet(id obj, unsigned level)
}
else
{
- i = [uniqueSet countForObject: obj];
+ i = [uniqueSet countForObject: found];
if (i < level)
{
while (i < level)
{
- [uniqueSet addObject: obj];
+ [uniqueSet addObject: found];
i++;
}
}
@@ -269,7 +270,7 @@ GSUSet(id obj, unsigned level)
{
while (i > level)
{
- [uniqueSet removeObject: obj];
+ [uniqueSet removeObject: found];
i--;
}
}
@@ -278,6 +279,7 @@ GSUSet(id obj, unsigned level)
{
(*unlockImp)(uniqueLock, @selector(unlock));
}
+ return found;
}
id