|
32 | 32 | NSMutableDictionary * progressTable;
|
33 | 33 | NSMutableDictionary * uploadProgressTable;
|
34 | 34 |
|
| 35 | +__attribute__((constructor)) |
| 36 | +static void initialize_tables() { |
| 37 | + if(expirationTable == nil) |
| 38 | + { |
| 39 | + expirationTable = [[NSMapTable alloc] init]; |
| 40 | + } |
| 41 | + if(taskTable == nil) |
| 42 | + { |
| 43 | + taskTable = [[NSMapTable alloc] init]; |
| 44 | + } |
| 45 | + if(progressTable == nil) |
| 46 | + { |
| 47 | + progressTable = [[NSMutableDictionary alloc] init]; |
| 48 | + } |
| 49 | + if(uploadProgressTable == nil) |
| 50 | + { |
| 51 | + uploadProgressTable = [[NSMutableDictionary alloc] init]; |
| 52 | + } |
| 53 | + if(cookiesTable == nil) |
| 54 | + { |
| 55 | + cookiesTable = [[NSMapTable alloc] init]; |
| 56 | + } |
| 57 | +} |
| 58 | + |
| 59 | + |
35 | 60 | typedef NS_ENUM(NSUInteger, ResponseFormat) {
|
36 | 61 | UTF8,
|
37 | 62 | BASE64,
|
@@ -78,26 +103,6 @@ - (id)init {
|
78 | 103 | taskQueue = [[NSOperationQueue alloc] init];
|
79 | 104 | taskQueue.maxConcurrentOperationCount = 10;
|
80 | 105 | }
|
81 |
| - if(expirationTable == nil) |
82 |
| - { |
83 |
| - expirationTable = [[NSMapTable alloc] init]; |
84 |
| - } |
85 |
| - if(taskTable == nil) |
86 |
| - { |
87 |
| - taskTable = [[NSMapTable alloc] init]; |
88 |
| - } |
89 |
| - if(progressTable == nil) |
90 |
| - { |
91 |
| - progressTable = [[NSMutableDictionary alloc] init]; |
92 |
| - } |
93 |
| - if(uploadProgressTable == nil) |
94 |
| - { |
95 |
| - uploadProgressTable = [[NSMutableDictionary alloc] init]; |
96 |
| - } |
97 |
| - if(cookiesTable == nil) |
98 |
| - { |
99 |
| - cookiesTable = [[NSMapTable alloc] init]; |
100 |
| - } |
101 | 106 | return self;
|
102 | 107 | }
|
103 | 108 |
|
|
0 commit comments