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 * tracker.c | 6 * tracker.c |
7 * | 7 * |
8 * This file contains the code used by the pointer-tracking calls used | 8 * This file contains the code used by the pointer-tracking calls used |
9 * in the debug builds to catch bad pointers. The entire contents are | 9 * in the debug builds to catch bad pointers. The entire contents are |
10 * only available in debug builds (both internal and external builds). | 10 * only available in debug builds (both internal and external builds). |
(...skipping 11 matching lines...) Expand all Loading... |
22 * It merely returns the value of the object pointer as its hash. | 22 * It merely returns the value of the object pointer as its hash. |
23 * There are no possible errors. | 23 * There are no possible errors. |
24 */ | 24 */ |
25 | 25 |
26 static PLHashNumber PR_CALLBACK | 26 static PLHashNumber PR_CALLBACK |
27 identity_hash | 27 identity_hash |
28 ( | 28 ( |
29 const void *key | 29 const void *key |
30 ) | 30 ) |
31 { | 31 { |
32 return (PLHashNumber)key; | 32 return (PLHashNumber)((char *)key - (char *)NULL); |
33 } | 33 } |
34 | 34 |
35 /* | 35 /* |
36 * trackerOnceFunc | 36 * trackerOnceFunc |
37 * | 37 * |
38 * This function is called once, using the nssCallOnce function above. | 38 * This function is called once, using the nssCallOnce function above. |
39 * It creates a new pointer tracker object; initialising its hash | 39 * It creates a new pointer tracker object; initialising its hash |
40 * table and protective lock. | 40 * table and protective lock. |
41 */ | 41 */ |
42 | 42 |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 | 402 |
403 if( (void *)NULL == check ) { | 403 if( (void *)NULL == check ) { |
404 nss_SetError(NSS_ERROR_POINTER_NOT_REGISTERED); | 404 nss_SetError(NSS_ERROR_POINTER_NOT_REGISTERED); |
405 return PR_FAILURE; | 405 return PR_FAILURE; |
406 } | 406 } |
407 | 407 |
408 return PR_SUCCESS; | 408 return PR_SUCCESS; |
409 } | 409 } |
410 | 410 |
411 #endif /* DEBUG */ | 411 #endif /* DEBUG */ |
OLD | NEW |