Skip to content

Commit 74cd0cf

Browse files
committed
[CF] Remove __CFStorageEstimateTotalAllocatedSize.
This function is tagged with __attribute__((unused)) and certainly appears to be unused. It may be a function intended for use in a debugger context. As it is a static function, the reference to this function and malloc_size will not necessarily be present when built, _but_ this does cause a compiler warning when building on systems where malloc_size or alternatives are not available. malloc introspection, as afforded by malloc_size, malloc_usable_size, or msize, is nonportable (and thus not guaranteed to be present on all platforms), not guaranteed to be accurate (though certainly an upper bound), and is generally recommended for debugging. For those reasons, remove this function.
1 parent 1af7c8d commit 74cd0cf

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

CoreFoundation/Collections.subproj/CFStorage.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,21 +1366,6 @@ static void __CFStorageApplyNodeBlock(CFStorageRef storage, void (^block)(CFStor
13661366
__CFStorageApplyNodeBlockInterior(storage, &storage->rootNode, block);
13671367
}
13681368

1369-
static CFIndex __CFStorageEstimateTotalAllocatedSize(CFStorageRef storage) __attribute__((unused));
1370-
static CFIndex __CFStorageEstimateTotalAllocatedSize(CFStorageRef storage) {
1371-
__block CFIndex nodeResult = 0;
1372-
__block CFIndex contentsResult = 0;
1373-
__CFStorageApplyNodeBlock(storage, ^(CFStorageRef storage, CFStorageNode *node) {
1374-
if (node != &storage->rootNode) {
1375-
nodeResult += malloc_size(node);
1376-
if (node->isLeaf && node->info.leaf.memory != NULL) {
1377-
contentsResult += malloc_size(node->info.leaf.memory);
1378-
}
1379-
}
1380-
});
1381-
return nodeResult + contentsResult;
1382-
}
1383-
13841369
void __CFStorageSetAlwaysFrozen(CFStorageRef storage, bool alwaysFrozen) {
13851370
storage->alwaysFrozen = alwaysFrozen;
13861371
}

0 commit comments

Comments
 (0)