Mercurial > trustbridge > nss-cmake-static
comparison nss/lib/base/hashops.c @ 0:1e5118fa0cb1
This is NSS with a Cmake Buildsyste
To compile a static NSS library for Windows we've used the
Chromium-NSS fork and added a Cmake buildsystem to compile
it statically for Windows. See README.chromium for chromium
changes and README.trustbridge for our modifications.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 28 Jul 2014 10:47:06 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1e5118fa0cb1 |
---|---|
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 /* | |
6 * hashops.c | |
7 * | |
8 * This file includes a set of PLHashAllocOps that use NSSArenas. | |
9 */ | |
10 | |
11 #ifndef BASE_H | |
12 #include "base.h" | |
13 #endif /* BASE_H */ | |
14 | |
15 static void * PR_CALLBACK | |
16 nss_arena_hash_alloc_table | |
17 ( | |
18 void *pool, | |
19 PRSize size | |
20 ) | |
21 { | |
22 NSSArena *arena = (NSSArena *)NULL; | |
23 | |
24 #ifdef NSSDEBUG | |
25 if( (void *)NULL != arena ) { | |
26 if( PR_SUCCESS != nssArena_verifyPointer(arena) ) { | |
27 return (void *)NULL; | |
28 } | |
29 } | |
30 #endif /* NSSDEBUG */ | |
31 | |
32 return nss_ZAlloc(arena, size); | |
33 } | |
34 | |
35 static void PR_CALLBACK | |
36 nss_arena_hash_free_table | |
37 ( | |
38 void *pool, | |
39 void *item | |
40 ) | |
41 { | |
42 (void)nss_ZFreeIf(item); | |
43 } | |
44 | |
45 static PLHashEntry * PR_CALLBACK | |
46 nss_arena_hash_alloc_entry | |
47 ( | |
48 void *pool, | |
49 const void *key | |
50 ) | |
51 { | |
52 NSSArena *arena = NULL; | |
53 | |
54 #ifdef NSSDEBUG | |
55 if( (void *)NULL != arena ) { | |
56 if( PR_SUCCESS != nssArena_verifyPointer(arena) ) { | |
57 return (void *)NULL; | |
58 } | |
59 } | |
60 #endif /* NSSDEBUG */ | |
61 | |
62 return nss_ZNEW(arena, PLHashEntry); | |
63 } | |
64 | |
65 static void PR_CALLBACK | |
66 nss_arena_hash_free_entry | |
67 ( | |
68 void *pool, | |
69 PLHashEntry *he, | |
70 PRUintn flag | |
71 ) | |
72 { | |
73 if( HT_FREE_ENTRY == flag ) { | |
74 (void)nss_ZFreeIf(he); | |
75 } | |
76 } | |
77 | |
78 NSS_IMPLEMENT_DATA PLHashAllocOps | |
79 nssArenaHashAllocOps = { | |
80 nss_arena_hash_alloc_table, | |
81 nss_arena_hash_free_table, | |
82 nss_arena_hash_alloc_entry, | |
83 nss_arena_hash_free_entry | |
84 }; |