OLD | NEW |
---|---|
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | 4 |
5 /* | 5 /* |
6 * Support routines for SECItemArray data structure. | 6 * Support routines for SECItemArray data structure. |
7 */ | 7 */ |
8 | 8 |
9 #include "nss.h" | |
wtc
2013/06/13 18:20:31
Please include "nssutil.h" and use the NSSUTIL_xxx
Paweł Hajdan Jr.
2013/06/13 18:58:32
I'm mirroring the solution from net/cert/cert_veri
wtc
2013/06/13 21:07:33
The NSS libraries can be grouped into three packag
Paweł Hajdan Jr.
2013/06/13 21:29:56
Ah, I see now. Correctness and understanding were
| |
9 #include "seccomon.h" | 10 #include "seccomon.h" |
10 #include "secitem.h" | 11 #include "secitem.h" |
11 #include "secerr.h" | 12 #include "secerr.h" |
12 #include "secport.h" | 13 #include "secport.h" |
13 | 14 |
14 typedef struct SECItemArrayStr SECItemArray; | 15 typedef struct SECItemArrayStr SECItemArray; |
15 | 16 |
17 #define NSS_VERSION_NUM (NSS_VMAJOR * 10000 + NSS_VMINOR * 100 + NSS_VPATCH) | |
18 #if NSS_VERSION_NUM < 31500 | |
wtc
2013/06/13 18:20:31
Optional: You can just test NSSUTIL_VMINOR < 15.
Paweł Hajdan Jr.
2013/06/13 18:58:32
I think the current version is more robust, e.g. a
wtc
2013/06/13 21:07:33
Because NSS 3.x is widely used, it is unlikely tha
Paweł Hajdan Jr.
2013/06/13 21:29:56
Preserved current code then.
| |
19 // Added in NSS 3.15. | |
16 struct SECItemArrayStr { | 20 struct SECItemArrayStr { |
17 SECItem *items; | 21 SECItem *items; |
18 unsigned int len; | 22 unsigned int len; |
19 }; | 23 }; |
24 #endif | |
20 | 25 |
21 SECItemArray * | 26 SECItemArray * |
22 SECITEM_AllocArray(PLArenaPool *arena, SECItemArray *array, unsigned int len) | 27 SECITEM_AllocArray(PLArenaPool *arena, SECItemArray *array, unsigned int len) |
23 { | 28 { |
24 SECItemArray *result = NULL; | 29 SECItemArray *result = NULL; |
25 void *mark = NULL; | 30 void *mark = NULL; |
26 | 31 |
27 if (arena != NULL) { | 32 if (arena != NULL) { |
28 mark = PORT_ArenaMark(arena); | 33 mark = PORT_ArenaMark(arena); |
29 } | 34 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 SECStatus rv = SECITEM_CopyItem(arena, | 141 SECStatus rv = SECITEM_CopyItem(arena, |
137 &result->items[i], &from->items[i]); | 142 &result->items[i], &from->items[i]); |
138 if (rv != SECSuccess) { | 143 if (rv != SECSuccess) { |
139 SECITEM_ZfreeArray(result, PR_TRUE); | 144 SECITEM_ZfreeArray(result, PR_TRUE); |
140 return NULL; | 145 return NULL; |
141 } | 146 } |
142 } | 147 } |
143 | 148 |
144 return result; | 149 return result; |
145 } | 150 } |
OLD | NEW |