Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: nss/lib/util/secitem.h

Issue 2078763002: Delete bundled copy of NSS and replace with README. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss@master
Patch Set: Delete bundled copy of NSS and replace with README. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « nss/lib/util/secerr.h ('k') | nss/lib/util/secitem.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 #ifndef _SECITEM_H_
6 #define _SECITEM_H_
7
8 #include "utilrename.h"
9
10 /*
11 * secitem.h - public data structures and prototypes for handling
12 * SECItems
13 */
14
15 #include "plarena.h"
16 #include "plhash.h"
17 #include "seccomon.h"
18
19 SEC_BEGIN_PROTOS
20
21 /*
22 ** Allocate an item. If "arena" is not NULL, then allocate from there,
23 ** otherwise allocate from the heap. If "item" is not NULL, allocate
24 ** only the data buffer for the item, not the item itself. If "len" is
25 ** 0, do not allocate the data buffer for the item; simply set the data
26 ** field to NULL and the len field to 0. The item structure is allocated
27 ** zero-filled; the data buffer is not zeroed. The caller is responsible
28 ** for initializing the type field of the item.
29 **
30 ** The resulting item is returned; NULL if any error occurs.
31 **
32 ** XXX This probably should take a SECItemType, but since that is mostly
33 ** unused and our improved APIs (aka Stan) are looming, I left it out.
34 */
35 extern SECItem *SECITEM_AllocItem(PLArenaPool *arena, SECItem *item,
36 unsigned int len);
37
38 /*
39 ** This is a legacy function containing bugs. It doesn't update item->len,
40 ** and it has other issues as described in bug 298649 and bug 298938.
41 ** However, the function is kept unchanged for consumers that might depend
42 ** on the broken behaviour. New code should call SECITEM_ReallocItemV2.
43 **
44 ** Reallocate the data for the specified "item". If "arena" is not NULL,
45 ** then reallocate from there, otherwise reallocate from the heap.
46 ** In the case where oldlen is 0, the data is allocated (not reallocated).
47 ** In any case, "item" is expected to be a valid SECItem pointer;
48 ** SECFailure is returned if it is not. If the allocation succeeds,
49 ** SECSuccess is returned.
50 */
51 extern SECStatus SECITEM_ReallocItem( /* deprecated function */
52 PLArenaPool *arena, SECItem *item,
53 unsigned int oldlen, unsigned int newlen);
54
55 /*
56 ** Reallocate the data for the specified "item". If "arena" is not NULL,
57 ** then reallocate from there, otherwise reallocate from the heap.
58 ** If item->data is NULL, the data is allocated (not reallocated).
59 ** In any case, "item" is expected to be a valid SECItem pointer;
60 ** SECFailure is returned if it is not, and the item will remain unchanged.
61 ** If the allocation succeeds, the item is updated and SECSuccess is returned.
62 */
63 extern SECStatus SECITEM_ReallocItemV2(PLArenaPool *arena, SECItem *item,
64 unsigned int newlen);
65
66 /*
67 ** Compare two items returning the difference between them.
68 */
69 extern SECComparison SECITEM_CompareItem(const SECItem *a, const SECItem *b);
70
71 /*
72 ** Compare two items -- if they are the same, return true; otherwise false.
73 */
74 extern PRBool SECITEM_ItemsAreEqual(const SECItem *a, const SECItem *b);
75
76 /*
77 ** Copy "from" to "to"
78 */
79 extern SECStatus SECITEM_CopyItem(PLArenaPool *arena, SECItem *to,
80 const SECItem *from);
81
82 /*
83 ** Allocate an item and copy "from" into it.
84 */
85 extern SECItem *SECITEM_DupItem(const SECItem *from);
86
87 /*
88 ** Allocate an item and copy "from" into it. The item itself and the
89 ** data it points to are both allocated from the arena. If arena is
90 ** NULL, this function is equivalent to SECITEM_DupItem.
91 */
92 extern SECItem *SECITEM_ArenaDupItem(PLArenaPool *arena, const SECItem *from);
93
94 /*
95 ** Free "zap". If freeit is PR_TRUE then "zap" itself is freed.
96 */
97 extern void SECITEM_FreeItem(SECItem *zap, PRBool freeit);
98
99 /*
100 ** Zero and then free "zap". If freeit is PR_TRUE then "zap" itself is freed.
101 */
102 extern void SECITEM_ZfreeItem(SECItem *zap, PRBool freeit);
103
104 PLHashNumber PR_CALLBACK SECITEM_Hash ( const void *key);
105
106 PRIntn PR_CALLBACK SECITEM_HashCompare ( const void *k1, const void *k2);
107
108 extern SECItemArray *SECITEM_AllocArray(PLArenaPool *arena,
109 SECItemArray *array,
110 unsigned int len);
111 extern SECItemArray *SECITEM_DupArray(PLArenaPool *arena,
112 const SECItemArray *from);
113 extern void SECITEM_FreeArray(SECItemArray *array, PRBool freeit);
114 extern void SECITEM_ZfreeArray(SECItemArray *array, PRBool freeit);
115
116 SEC_END_PROTOS
117
118 #endif /* _SECITEM_H_ */
OLDNEW
« no previous file with comments | « nss/lib/util/secerr.h ('k') | nss/lib/util/secitem.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698