OLD | NEW |
1 /* ***** BEGIN LICENSE BLOCK ***** | 1 /* ***** BEGIN LICENSE BLOCK ***** |
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
3 * | 3 * |
4 * The contents of this file are subject to the Mozilla Public License Version | 4 * The contents of this file are subject to the Mozilla Public License Version |
5 * 1.1 (the "License"); you may not use this file except in compliance with | 5 * 1.1 (the "License"); you may not use this file except in compliance with |
6 * the License. You may obtain a copy of the License at | 6 * the License. You may obtain a copy of the License at |
7 * http://www.mozilla.org/MPL/ | 7 * http://www.mozilla.org/MPL/ |
8 * | 8 * |
9 * Software distributed under the License is distributed on an "AS IS" basis, | 9 * Software distributed under the License is distributed on an "AS IS" basis, |
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
(...skipping 23 matching lines...) Expand all Loading... |
34 * | 34 * |
35 * ***** END LICENSE BLOCK ***** */ | 35 * ***** END LICENSE BLOCK ***** */ |
36 | 36 |
37 /* | 37 /* |
38 * secport.c - portability interfaces for security libraries | 38 * secport.c - portability interfaces for security libraries |
39 * | 39 * |
40 * This file abstracts out libc functionality that libsec depends on | 40 * This file abstracts out libc functionality that libsec depends on |
41 * | 41 * |
42 * NOTE - These are not public interfaces | 42 * NOTE - These are not public interfaces |
43 * | 43 * |
44 * $Id: secport.c,v 1.26 2009/12/24 03:37:46 nelson%bolyard.com Exp $ | 44 * $Id: secport.c,v 1.28 2010/01/22 02:34:30 wtc%google.com Exp $ |
45 */ | 45 */ |
46 | 46 |
47 #include "seccomon.h" | 47 #include "seccomon.h" |
48 #include "prmem.h" | 48 #include "prmem.h" |
49 #include "prerror.h" | 49 #include "prerror.h" |
50 #include "plarena.h" | 50 #include "plarena.h" |
51 #include "secerr.h" | 51 #include "secerr.h" |
52 #include "prmon.h" | 52 #include "prmon.h" |
53 #include "nssilock.h" | 53 #include "nssilock.h" |
54 #include "secport.h" | 54 #include "secport.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 333 |
334 if (!pool) | 334 if (!pool) |
335 return; | 335 return; |
336 if (ARENAPOOL_MAGIC == pool->magic ) { | 336 if (ARENAPOOL_MAGIC == pool->magic ) { |
337 len = sizeof *pool; | 337 len = sizeof *pool; |
338 lock = pool->lock; | 338 lock = pool->lock; |
339 PZ_Lock(lock); | 339 PZ_Lock(lock); |
340 } | 340 } |
341 if (!checkedEnv) { | 341 if (!checkedEnv) { |
342 /* no need for thread protection here */ | 342 /* no need for thread protection here */ |
343 » const char *ev = PR_GetEnv("NSS_DISABLE_ARENA_FREE_LIST"); | 343 » doFreeArenaPool = (PR_GetEnv("NSS_DISABLE_ARENA_FREE_LIST") == NULL); |
344 » if (!ev) doFreeArenaPool = PR_TRUE; | |
345 checkedEnv = PR_TRUE; | 344 checkedEnv = PR_TRUE; |
346 } | 345 } |
347 if (zero) { | 346 if (zero) { |
348 PLArena *a; | 347 PLArena *a; |
349 for (a = arena->first.next; a; a = a->next) { | 348 for (a = arena->first.next; a; a = a->next) { |
350 PR_ASSERT(a->base <= a->avail && a->avail <= a->limit); | 349 PR_ASSERT(a->base <= a->avail && a->avail <= a->limit); |
351 memset((void *)a->base, 0, a->avail - a->base); | 350 memset((void *)a->base, 0, a->avail - a->base); |
352 } | 351 } |
353 } | 352 } |
354 if (doFreeArenaPool) { | 353 if (doFreeArenaPool) { |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 const unsigned char *b = (const unsigned char*) ib; | 711 const unsigned char *b = (const unsigned char*) ib; |
713 size_t i; | 712 size_t i; |
714 unsigned char r = 0; | 713 unsigned char r = 0; |
715 | 714 |
716 for (i = 0; i < n; ++i) { | 715 for (i = 0; i < n; ++i) { |
717 r |= *a++ ^ *b++; | 716 r |= *a++ ^ *b++; |
718 } | 717 } |
719 | 718 |
720 return r; | 719 return r; |
721 } | 720 } |
OLD | NEW |