Example #1
0
int main(int argc, const char * argv[])
{
    ISAutoreleasePoolPush();

    /* create a mutable string */
    ISMutableStringRef mutableString = ISStringCreateMutable("hello world", ISASCIIStringEncoding);
    /* retain + 1 */
    ISRetain(mutableString);
    
    /* mutable string length */
    int length = ISStringLength(mutableString);
    printf("length %i\n", length);
    
    /* make a non mutable copy */
    ISStringRef otherString = ISCopy(mutableString);
    printf("%s\n", ISStringCString(otherString));
    ISRelease(otherString);
    

    /* replace chars, only works on mutable */
    ISStringReplaceChar(mutableString, 'l', 'x');

    printf("%s\n", ISStringCString(mutableString));
    
    /* release mutable string */
    ISRelease(mutableString);
    ISAutorelease(mutableString);

    ISAutoreleasePoolPop();

    return 0;
}
Example #2
0
void ISAutoreleasePoolPop()
{
    struct ISAutoreleasePool* pool = &_poolStatck[_poolDepth];
    
    int i;
    for (i = 0; i < pool->objectCount; i ++)
    {
        ISRelease(pool->objectBuffer[i]);
    }
    
    free(pool->objectBuffer);
    _poolDepth--;
    assert(_poolDepth >= 0);
}