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

Side by Side Diff: nspr/pr/src/memory/prseg.c

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 | « nspr/pr/src/md/windows/win32_errors.c ('k') | nspr/pr/src/memory/prshm.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 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #include "primpl.h"
7
8 #if defined(_PR_PTHREADS)
9
10 /*
11 ** The pthreads version doesn't use these functions.
12 */
13 void _PR_InitSegs(void)
14 {
15 }
16
17 #else /* _PR_PTHREADS */
18
19 void _PR_InitSegs(void)
20 {
21 _PR_MD_INIT_SEGS();
22 }
23
24 /*
25 ** Allocate a memory segment. The size value is rounded up to the native
26 ** system page size and a page aligned portion of memory is returned.
27 ** This memory is not part of the malloc heap. If "vaddr" is not NULL
28 ** then PR tries to allocate the segment at the desired virtual address.
29 */
30 PRSegment* _PR_NewSegment(PRUint32 size, void *vaddr)
31 {
32 PRSegment *seg;
33
34 /* calloc the data structure for the segment */
35 seg = PR_NEWZAP(PRSegment);
36
37 if (seg) {
38 size = ((size + _pr_pageSize - 1) >> _pr_pageShift) << _pr_pageShift ;
39 /*
40 ** Now, allocate the actual segment memory (or map under so me OS)
41 ** The OS specific code decides from where or how to alloca te memory.
42 */
43 if (_PR_MD_ALLOC_SEGMENT(seg, size, vaddr) != PR_SUCCESS) {
44 PR_DELETE(seg);
45 return NULL;
46 }
47 }
48
49 return seg;
50 }
51
52 /*
53 ** Free a memory segment.
54 */
55 void _PR_DestroySegment(PRSegment *seg)
56 {
57 _PR_MD_FREE_SEGMENT(seg);
58 PR_DELETE(seg);
59 }
60
61 #endif /* _PR_PTHREADS */
OLDNEW
« no previous file with comments | « nspr/pr/src/md/windows/win32_errors.c ('k') | nspr/pr/src/memory/prshm.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698