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

Side by Side Diff: base/sys_info_posix.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « base/strings/string_split_unittest.cc ('k') | base/test/trace_event_analyzer.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/sys_info.h" 5 #include "base/sys_info.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <string.h> 8 #include <string.h>
9 #include <sys/param.h> 9 #include <sys/param.h>
10 #include <sys/utsname.h> 10 #include <sys/utsname.h>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 return -1; 48 return -1;
49 return static_cast<int64>(stats.f_bavail) * stats.f_frsize; 49 return static_cast<int64>(stats.f_bavail) * stats.f_frsize;
50 } 50 }
51 51
52 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) 52 #if !defined(OS_MACOSX) && !defined(OS_ANDROID)
53 // static 53 // static
54 std::string SysInfo::OperatingSystemName() { 54 std::string SysInfo::OperatingSystemName() {
55 struct utsname info; 55 struct utsname info;
56 if (uname(&info) < 0) { 56 if (uname(&info) < 0) {
57 NOTREACHED(); 57 NOTREACHED();
58 return ""; 58 return std::string();
59 } 59 }
60 return std::string(info.sysname); 60 return std::string(info.sysname);
61 } 61 }
62 #endif 62 #endif
63 63
64 #if !defined(OS_MACOSX) 64 #if !defined(OS_MACOSX)
65 // static 65 // static
66 std::string SysInfo::OperatingSystemVersion() { 66 std::string SysInfo::OperatingSystemVersion() {
67 struct utsname info; 67 struct utsname info;
68 if (uname(&info) < 0) { 68 if (uname(&info) < 0) {
69 NOTREACHED(); 69 NOTREACHED();
70 return ""; 70 return std::string();
71 } 71 }
72 return std::string(info.release); 72 return std::string(info.release);
73 } 73 }
74 #endif 74 #endif
75 75
76 // static 76 // static
77 std::string SysInfo::OperatingSystemArchitecture() { 77 std::string SysInfo::OperatingSystemArchitecture() {
78 struct utsname info; 78 struct utsname info;
79 if (uname(&info) < 0) { 79 if (uname(&info) < 0) {
80 NOTREACHED(); 80 NOTREACHED();
81 return ""; 81 return std::string();
82 } 82 }
83 std::string arch(info.machine); 83 std::string arch(info.machine);
84 if (arch == "i386" || arch == "i486" || arch == "i586" || arch == "i686") { 84 if (arch == "i386" || arch == "i486" || arch == "i586" || arch == "i686") {
85 arch = "x86"; 85 arch = "x86";
86 } else if (arch == "amd64") { 86 } else if (arch == "amd64") {
87 arch = "x86_64"; 87 arch = "x86_64";
88 } 88 }
89 return arch; 89 return arch;
90 } 90 }
91 91
92 // static 92 // static
93 size_t SysInfo::VMAllocationGranularity() { 93 size_t SysInfo::VMAllocationGranularity() {
94 return getpagesize(); 94 return getpagesize();
95 } 95 }
96 96
97 } // namespace base 97 } // namespace base
OLDNEW
« no previous file with comments | « base/strings/string_split_unittest.cc ('k') | base/test/trace_event_analyzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698