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

Side by Side Diff: util/posix/process_util_mac.cc

Issue 656703002: Convert NULL to nullptr (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Fix 80-column violations Created 6 years, 2 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 | « util/mach/task_memory.h ('k') | util/posix/symbolic_constants_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 25 matching lines...) Expand all
36 // 1 bytes, expecting to only receive args_size_estimate. If it gets the extra 36 // 1 bytes, expecting to only receive args_size_estimate. If it gets the extra
37 // byte, it indicates that the string area has grown, and the sysctl() pair 37 // byte, it indicates that the string area has grown, and the sysctl() pair
38 // will be retried a limited number of times. 38 // will be retried a limited number of times.
39 39
40 size_t args_size_estimate; 40 size_t args_size_estimate;
41 size_t args_size; 41 size_t args_size;
42 std::string args; 42 std::string args;
43 int tries = 3; 43 int tries = 3;
44 do { 44 do {
45 int mib[] = {CTL_KERN, KERN_PROCARGS2, pid}; 45 int mib[] = {CTL_KERN, KERN_PROCARGS2, pid};
46 int rv = sysctl(mib, arraysize(mib), NULL, &args_size_estimate, NULL, 0); 46 int rv =
47 sysctl(mib, arraysize(mib), nullptr, &args_size_estimate, nullptr, 0);
47 if (rv != 0) { 48 if (rv != 0) {
48 return false; 49 return false;
49 } 50 }
50 51
51 args_size = args_size_estimate + 1; 52 args_size = args_size_estimate + 1;
52 args.resize(args_size); 53 args.resize(args_size);
53 rv = sysctl(mib, arraysize(mib), &args[0], &args_size, NULL, 0); 54 rv = sysctl(mib, arraysize(mib), &args[0], &args_size, nullptr, 0);
54 if (rv != 0) { 55 if (rv != 0) {
55 return false; 56 return false;
56 } 57 }
57 } while (args_size == args_size_estimate + 1 && tries--); 58 } while (args_size == args_size_estimate + 1 && tries--);
58 59
59 if (args_size == args_size_estimate + 1) { 60 if (args_size == args_size_estimate + 1) {
60 return false; 61 return false;
61 } 62 }
62 63
63 // KERN_PROCARGS2 needs to at least contain argc. 64 // KERN_PROCARGS2 needs to at least contain argc.
(...skipping 29 matching lines...) Expand all
93 if (argc >= 0) { 94 if (argc >= 0) {
94 // Not every argument was recovered. 95 // Not every argument was recovered.
95 return false; 96 return false;
96 } 97 }
97 98
98 argv->swap(local_argv); 99 argv->swap(local_argv);
99 return true; 100 return true;
100 } 101 }
101 102
102 } // namespace crashpad 103 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/mach/task_memory.h ('k') | util/posix/symbolic_constants_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698