Ejemplo n.º 1
0
};

static RSTypeRef __RSNodeGetValue(RSNodeRef node) {
    return node ? node->_value : nil;
}

static RSNodeRef __RSNodeCreateWithNext(RSTypeRef value, RSNodeRef n, BOOL nIsHead);

static RSSpinLock __RSNodePoolLock = RSSpinLockInit;
static RSMultidimensionalDictionaryRef __RSNodePool = nil;

static void __RSNodePoolInitialize() {
    RSSyncUpdateBlock(&__RSNodePoolLock, ^{
        if (!__RSNodePool) {
            __RSNodePool = RSMultidimensionalDictionaryCreate(RSAllocatorSystemDefault, 2); // create 2 dimensional dictionary [[value, next], node]
            __RSListPreferences = RSDictionaryCreateWithContentOfPath(RSAllocatorSystemDefault, RSFileManagerStandardizingPath(RSSTR("~/Library/Preferences/com.retval.RSCoreFoundation.list.node.plist")));
        }
    });
}

static void __RSNodePoolDeallocate() {
    RSSyncUpdateBlock(&__RSNodePoolLock, ^{
        if (__RSNodePool) {
//            RSShow(__RSNodePool);
            extern void __RSDictionaryCleanAllObjects(RSMutableDictionaryRef dictionary);
//            __RSCLog(RSLogLevelWarning, "RSNil -> %p\n", RSNil);
            RSDictionaryRef dimension = RSMultidimensionalDictionaryGetDimensionEntry(__RSNodePool);
            RSDictionaryApplyBlock(dimension, ^(const void *key1, const void *nd_dimension, BOOL *stop) {
//                RSLog(RSSTR("1 : %r<%p> - %r<%p>"), key1, key1, nd_dimension, nd_dimension);
                RSDictionaryApplyBlock(nd_dimension, ^(const void *key2, const void *value, BOOL *stop) {
//                    RSNodeRef n = value;
Ejemplo n.º 2
0
static BOOL ___RSCFPreferenceGetCFVersion(RSVersion* productVersion, RSVersion* buildVersion)
{
    if (likely(___RSCFPVersionListCache[___RSCFPVersionSelfBuild])) return ___RSCFPVersionListCache[___RSCFPVersionSelfBuild];
    RSDictionaryRef _contents = RSDictionaryCreateWithContentOfPath(RSAllocatorDefault, RSFileManagerStandardizingPath(___RSCoreFoundationLoadPath));
    RSVersion _version1 = 0, _version2 = 0;
    RSStringRef version = RSDictionaryGetValue(_contents, RSSTR("RSProductVersion"));
    if (version)
    {
        _version1 = RSStringFloatValue(version);
        ___RSCFPVersionListCache[___RSCFPVersionSelfBuild] = _version1;
        if (*productVersion) *productVersion = _version1;
    }
    
    version = RSDictionaryGetValue(_contents, RSSTR("RSBundleVersion"));
    if (version)
    {
        _version2 = RSStringFloatValue(version);
        if (*buildVersion) *buildVersion = _version2;
    }
    RSRelease(_contents);
    return (_version1 || _version2) ? YES : NO;
}