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 #ifndef BASET_H | 5 #ifndef BASET_H |
6 #define BASET_H | 6 #define BASET_H |
7 | 7 |
8 /* | 8 /* |
9 * baset.h | 9 * baset.h |
10 * | 10 * |
(...skipping 14 matching lines...) Expand all Loading... |
25 * | 25 * |
26 * This type is used to mark the current state of an NSSArena. | 26 * This type is used to mark the current state of an NSSArena. |
27 */ | 27 */ |
28 | 28 |
29 struct nssArenaMarkStr; | 29 struct nssArenaMarkStr; |
30 typedef struct nssArenaMarkStr nssArenaMark; | 30 typedef struct nssArenaMarkStr nssArenaMark; |
31 | 31 |
32 #ifdef DEBUG | 32 #ifdef DEBUG |
33 /* | 33 /* |
34 * ARENA_THREADMARK | 34 * ARENA_THREADMARK |
35 * | 35 * |
36 * Optionally, this arena implementation can be compiled with some | 36 * Optionally, this arena implementation can be compiled with some |
37 * runtime checking enabled, which will catch the situation where | 37 * runtime checking enabled, which will catch the situation where |
38 * one thread "marks" the arena, another thread allocates memory, | 38 * one thread "marks" the arena, another thread allocates memory, |
39 * and then the mark is released. Usually this is a surprise to | 39 * and then the mark is released. Usually this is a surprise to |
40 * the second thread, and this leads to weird runtime errors. | 40 * the second thread, and this leads to weird runtime errors. |
41 * Define ARENA_THREADMARK to catch these cases; we define it for all | 41 * Define ARENA_THREADMARK to catch these cases; we define it for all |
42 * (internal and external) debug builds. | 42 * (internal and external) debug builds. |
43 */ | 43 */ |
44 #define ARENA_THREADMARK | 44 #define ARENA_THREADMARK |
45 | 45 |
(...skipping 15 matching lines...) Expand all Loading... |
61 * This facility requires ARENA_THREADMARK to be defined. | 61 * This facility requires ARENA_THREADMARK to be defined. |
62 */ | 62 */ |
63 #ifdef ARENA_THREADMARK | 63 #ifdef ARENA_THREADMARK |
64 #define ARENA_DESTRUCTOR_LIST | 64 #define ARENA_DESTRUCTOR_LIST |
65 #endif /* ARENA_THREADMARK */ | 65 #endif /* ARENA_THREADMARK */ |
66 | 66 |
67 #endif /* DEBUG */ | 67 #endif /* DEBUG */ |
68 | 68 |
69 typedef struct nssListStr nssList; | 69 typedef struct nssListStr nssList; |
70 typedef struct nssListIteratorStr nssListIterator; | 70 typedef struct nssListIteratorStr nssListIterator; |
71 typedef PRBool (* nssListCompareFunc)(void *a, void *b); | 71 typedef PRBool (*nssListCompareFunc)(void *a, void *b); |
72 typedef PRIntn (* nssListSortFunc)(void *a, void *b); | 72 typedef PRIntn (*nssListSortFunc)(void *a, void *b); |
73 typedef void (* nssListElementDestructorFunc)(void *el); | 73 typedef void (*nssListElementDestructorFunc)(void *el); |
74 | 74 |
75 typedef struct nssHashStr nssHash; | 75 typedef struct nssHashStr nssHash; |
76 typedef void (PR_CALLBACK *nssHashIterator)(const void *key, | 76 typedef void(PR_CALLBACK *nssHashIterator)(const void *key, void *value, |
77 void *value, | 77 void *arg); |
78 void *arg); | |
79 | 78 |
80 /* | 79 /* |
81 * nssPointerTracker | 80 * nssPointerTracker |
82 * | 81 * |
83 * This type is used in debug builds (both external and internal) to | 82 * This type is used in debug builds (both external and internal) to |
84 * track our object pointers. Objects of this type must be statically | 83 * track our object pointers. Objects of this type must be statically |
85 * allocated, which means the structure size must be available to the | 84 * allocated, which means the structure size must be available to the |
86 * compiler. Therefore we must expose the contents of this structure. | 85 * compiler. Therefore we must expose the contents of this structure. |
87 * But please don't access elements directly; use the accessors. | 86 * But please don't access elements directly; use the accessors. |
88 */ | 87 */ |
89 | 88 |
90 #ifdef DEBUG | 89 #ifdef DEBUG |
91 struct nssPointerTrackerStr { | 90 struct nssPointerTrackerStr { |
92 PRCallOnceType once; | 91 PRCallOnceType once; |
93 PZLock *lock; | 92 PZLock *lock; |
94 PLHashTable *table; | 93 PLHashTable *table; |
95 }; | 94 }; |
96 typedef struct nssPointerTrackerStr nssPointerTracker; | 95 typedef struct nssPointerTrackerStr nssPointerTracker; |
97 #endif /* DEBUG */ | 96 #endif /* DEBUG */ |
98 | 97 |
99 /* | 98 /* |
100 * nssStringType | 99 * nssStringType |
101 * | 100 * |
102 * There are several types of strings in the real world. We try to | 101 * There are several types of strings in the real world. We try to |
103 * use only UTF8 and avoid the rest, but that's not always possible. | 102 * use only UTF8 and avoid the rest, but that's not always possible. |
104 * So we have a couple converter routines to go to and from the other | 103 * So we have a couple converter routines to go to and from the other |
105 * string types. We have to be able to specify those string types, | 104 * string types. We have to be able to specify those string types, |
106 * so we have this enumeration. | 105 * so we have this enumeration. |
107 */ | 106 */ |
108 | 107 |
109 enum nssStringTypeEnum { | 108 enum nssStringTypeEnum { |
110 nssStringType_DirectoryString, | 109 nssStringType_DirectoryString, |
111 nssStringType_TeletexString, /* Not "teletext" with trailing 't' */ | 110 nssStringType_TeletexString, /* Not "teletext" with trailing 't' */ |
112 nssStringType_PrintableString, | 111 nssStringType_PrintableString, |
113 nssStringType_UniversalString, | 112 nssStringType_UniversalString, |
114 nssStringType_BMPString, | 113 nssStringType_BMPString, |
115 nssStringType_UTF8String, | 114 nssStringType_UTF8String, |
116 nssStringType_PHGString, | 115 nssStringType_PHGString, |
117 nssStringType_GeneralString, | 116 nssStringType_GeneralString, |
118 | 117 |
119 nssStringType_Unknown = -1 | 118 nssStringType_Unknown = -1 |
120 }; | 119 }; |
121 typedef enum nssStringTypeEnum nssStringType; | 120 typedef enum nssStringTypeEnum nssStringType; |
122 | 121 |
123 PR_END_EXTERN_C | 122 PR_END_EXTERN_C |
124 | 123 |
125 #endif /* BASET_H */ | 124 #endif /* BASET_H */ |
OLD | NEW |