| 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 "nssutil.h" |
| 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 NSSUTIL_VERSION_NUM \ |
| 18 (NSSUTIL_VMAJOR * 10000 + NSSUTIL_VMINOR * 100 + NSSUTIL_VPATCH) |
| 19 #if NSSUTIL_VERSION_NUM < 31500 |
| 20 // Added in NSS 3.15. |
| 16 struct SECItemArrayStr { | 21 struct SECItemArrayStr { |
| 17 SECItem *items; | 22 SECItem *items; |
| 18 unsigned int len; | 23 unsigned int len; |
| 19 }; | 24 }; |
| 25 #endif |
| 20 | 26 |
| 21 SECItemArray * | 27 SECItemArray * |
| 22 SECITEM_AllocArray(PLArenaPool *arena, SECItemArray *array, unsigned int len) | 28 SECITEM_AllocArray(PLArenaPool *arena, SECItemArray *array, unsigned int len) |
| 23 { | 29 { |
| 24 SECItemArray *result = NULL; | 30 SECItemArray *result = NULL; |
| 25 void *mark = NULL; | 31 void *mark = NULL; |
| 26 | 32 |
| 27 if (arena != NULL) { | 33 if (arena != NULL) { |
| 28 mark = PORT_ArenaMark(arena); | 34 mark = PORT_ArenaMark(arena); |
| 29 } | 35 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 SECStatus rv = SECITEM_CopyItem(arena, | 142 SECStatus rv = SECITEM_CopyItem(arena, |
| 137 &result->items[i], &from->items[i]); | 143 &result->items[i], &from->items[i]); |
| 138 if (rv != SECSuccess) { | 144 if (rv != SECSuccess) { |
| 139 SECITEM_ZfreeArray(result, PR_TRUE); | 145 SECITEM_ZfreeArray(result, PR_TRUE); |
| 140 return NULL; | 146 return NULL; |
| 141 } | 147 } |
| 142 } | 148 } |
| 143 | 149 |
| 144 return result; | 150 return result; |
| 145 } | 151 } |
| OLD | NEW |