Beispiel #1
0
void
CFSetAddValue (CFMutableSetRef set, const void *value)
{
  CF_OBJC_FUNCDISPATCHV (_kCFSetTypeID, void, set, "addObject:", value);

  GSHashTableAddValue ((GSHashTableRef) set, value, value);
}
Beispiel #2
0
CFMutableSetRef
CFSetCreateMutableCopy (CFAllocatorRef allocator, CFIndex capacity,
                        CFSetRef set)
{
  if (CF_IS_OBJC (_kCFSetTypeID, set))
    {
      CFMutableSetRef result;
      const CFIndex count = CFSetGetCount (set);
      void **values =
        (void **) CFAllocatorAllocate (allocator, sizeof (void *) * count, 0);
      CFIndex i;

      CFSetGetValues (set, (const void **) values);
      result = CFSetCreateMutable (allocator, count, &kCFTypeSetCallBacks);

      for (i = 0; i < count; i++)
        GSHashTableAddValue ((GSHashTableRef) result, values[i], values[i]);

      CFAllocatorDeallocate (allocator, (void *) values);
      return result;
    }

  return (CFMutableSetRef) GSHashTableCreateMutableCopy (allocator,
                                                         (GSHashTableRef) set,
                                                         capacity);
}
void
CFBagAddValue (CFMutableBagRef bag, const void *value)
{
  GSHashTableAddValue ((GSHashTableRef)bag, value, value);
}