]>
git.saurik.com Git - apple/security.git/blob - OSX/utilities/src/SecBuffer.c
5 // Created by Mitch Adler on 3/6/15.
6 // Copyright © 2015 Apple Inc. All rights reserved.
9 #include <utilities/SecBuffer.h>
13 #define stackBufferSizeLimit 2048
15 void PerformWithBuffer(size_t size
, void (^operation
)(size_t size
, uint8_t *buffer
)) {
18 } else if (size
<= stackBufferSizeLimit
) {
20 operation(size
, buffer
);
22 uint8_t *buffer
= malloc(size
);
24 operation(size
, buffer
);
31 void PerformWithBufferAndClear(size_t size
, void (^operation
)(size_t size
, uint8_t *buffer
)) {
32 PerformWithBuffer(size
, ^(size_t size
, uint8_t *buffer
) {
33 operation(size
, buffer
);