pEpObjCAdapter/PEPAutoPointer.m
author Dirk Zimmermann <dz@pep.security>
Thu, 21 Mar 2019 12:37:32 +0100
branchrefactor
changeset 903 e9428f52fd88
parent 564 9eba9cef4911
permissions -rw-r--r--
IOS-1480 Merge IOS-1480 into refactor.
dirk@562
     1
//
dirk@564
     2
//  PEPAutoPointer.m
dirk@562
     3
//  pEpObjCAdapter
dirk@562
     4
//
dirk@562
     5
//  Created by Dirk Zimmermann on 11.04.18.
dirk@562
     6
//  Copyright © 2018 p≡p. All rights reserved.
dirk@562
     7
//
dirk@562
     8
dirk@564
     9
#import "PEPAutoPointer.h"
dirk@562
    10
dirk@564
    11
@interface PEPAutoPointer ()
dirk@562
    12
dirk@562
    13
@property (nonatomic) void *thePointer;
dirk@562
    14
dirk@562
    15
@end
dirk@562
    16
dirk@564
    17
@implementation PEPAutoPointer
dirk@562
    18
dirk@563
    19
- (void **)voidPointerPointer
dirk@562
    20
{
dirk@562
    21
    return &_thePointer;
dirk@562
    22
}
dirk@562
    23
dirk@563
    24
- (char **)charPointerPointer
dirk@563
    25
{
dirk@563
    26
    return (char **) self.voidPointerPointer;
dirk@563
    27
}
dirk@563
    28
dirk@563
    29
- (void *)voidPointer
dirk@563
    30
{
dirk@563
    31
    return self.thePointer;
dirk@563
    32
}
dirk@563
    33
dirk@563
    34
- (char *)charPointer
dirk@563
    35
{
dirk@563
    36
    return (char *) self.voidPointer;
dirk@563
    37
}
dirk@563
    38
dirk@562
    39
- (void)dealloc
dirk@562
    40
{
dirk@562
    41
    free(_thePointer);
dirk@562
    42
}
dirk@562
    43
dirk@562
    44
@end