Overview
Comment: | OFSecureData: Fix #ifdefs |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d5c4dedada1b610d1b3ecc6f1f170097 |
User & Date: | js on 2019-12-27 21:43:19 |
Other Links: | manifest | tags |
Context
2020-01-02
| ||
01:35 | Move objc_{con,de}structInstance to runtime check-in: 7f1acf9221 user: js tags: trunk | |
2019-12-27
| ||
21:43 | OFSecureData: Fix #ifdefs check-in: d5c4dedada user: js tags: trunk | |
00:41 | OFSecureData: Add allowsSwappableMemory property check-in: e629dc83a9 user: js tags: trunk | |
Changes
Modified src/OFSecureData.m from [800160da50] to [4f8dc33f67].
︙ | ︙ | |||
256 257 258 259 260 261 262 | of_bitset_clear(page->map, chunkIndex + i); } #endif @implementation OFSecureData @synthesize allowsSwappableMemory = _allowsSwappableMemory; | > | | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | of_bitset_clear(page->map, chunkIndex + i); } #endif @implementation OFSecureData @synthesize allowsSwappableMemory = _allowsSwappableMemory; #if defined(HAVE_MMAP) && defined(HAVE_MLOCK) && defined(MAP_ANON) && \ !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) + (void)initialize { if (self != [OFSecureData class]) return; if (!of_tlskey_new(&firstPageKey) || !of_tlskey_new(&lastPageKey) || !of_tlskey_new(&preallocatedPagesKey) || |
︙ | ︙ | |||
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | - (instancetype)initWithItemSize: (size_t)itemSize count: (size_t)count allowsSwappableMemory: (bool)allowsSwappableMemory { self = [super init]; @try { size_t pageSize = [OFSystemInfo pageSize]; if (count > SIZE_MAX / itemSize) @throw [OFOutOfRangeException exception]; if (allowsSwappableMemory) { _items = [self allocMemoryWithSize: itemSize count: count]; memset(_items, 0, count * itemSize); } else if (count * itemSize >= pageSize) _items = mapPages(OF_ROUND_UP_POW2(pageSize, count * itemSize) / pageSize); else { | > > > < | 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | - (instancetype)initWithItemSize: (size_t)itemSize count: (size_t)count allowsSwappableMemory: (bool)allowsSwappableMemory { self = [super init]; @try { #if defined(HAVE_MMAP) && defined(HAVE_MLOCK) && defined(MAP_ANON) size_t pageSize = [OFSystemInfo pageSize]; #endif if (count > SIZE_MAX / itemSize) @throw [OFOutOfRangeException exception]; if (allowsSwappableMemory) { _items = [self allocMemoryWithSize: itemSize count: count]; memset(_items, 0, count * itemSize); #if defined(HAVE_MMAP) && defined(HAVE_MLOCK) && defined(MAP_ANON) } else if (count * itemSize >= pageSize) _items = mapPages(OF_ROUND_UP_POW2(pageSize, count * itemSize) / pageSize); else { # if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) struct page *lastPage = of_tlskey_get(lastPageKey); # endif for (struct page *page = lastPage; page != NULL; page = page->previous) { _items = allocateMemory(page, count * itemSize); |
︙ | ︙ | |||
428 429 430 431 432 433 434 435 436 437 438 439 | count * itemSize); if (_items == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: count * itemSize]; } #else @throw [OFNotImplementedException exceptionWithSelector: _cmd object: nil]; #endif | > > < | 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | count * itemSize); if (_items == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: count * itemSize]; } } #else } else @throw [OFNotImplementedException exceptionWithSelector: _cmd object: nil]; #endif _itemSize = itemSize; _count = count; _allowsSwappableMemory = allowsSwappableMemory; } @catch (id e) { [self release]; @throw e; |
︙ | ︙ |