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

Side by Side Diff: base/safe_strerror_posix.cc

Issue 6410105: run iwyu on base! Base URL: svn://svn.chromium.org/chrome/trunk/src/base
Patch Set: Created 9 years, 10 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/ref_counted_memory.cc ('k') | base/scoped_native_library.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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "build/build_config.h" 5 #include <stddef.h>
6 #include "base/safe_strerror_posix.h"
7
8 #include <errno.h>
9 #include <stdio.h> 6 #include <stdio.h>
10 #include <string.h> 7 #include <string.h>
8 #include <sys/errno.h>
9 #include <string>
11 10
12 #define USE_HISTORICAL_STRERRO_R (defined(__GLIBC__) || defined(OS_NACL)) 11 #define USE_HISTORICAL_STRERRO_R (defined(__GLIBC__) || defined(OS_NACL))
13 12
14 #if USE_HISTORICAL_STRERRO_R && defined(__GNUC__) 13 #if USE_HISTORICAL_STRERRO_R && defined(__GNUC__)
15 // GCC will complain about the unused second wrap function unless we tell it 14 // GCC will complain about the unused second wrap function unless we tell it
16 // that we meant for them to be potentially unused, which is exactly what this 15 // that we meant for them to be potentially unused, which is exactly what this
17 // attribute is for. 16 // attribute is for.
18 #define POSSIBLY_UNUSED __attribute__((unused)) 17 #define POSSIBLY_UNUSED __attribute__((unused))
19 #else 18 #else
20 #define POSSIBLY_UNUSED 19 #define POSSIBLY_UNUSED
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // static. 101 // static.
103 wrap_posix_strerror_r(&strerror_r, err, buf, len); 102 wrap_posix_strerror_r(&strerror_r, err, buf, len);
104 } 103 }
105 104
106 std::string safe_strerror(int err) { 105 std::string safe_strerror(int err) {
107 const int buffer_size = 256; 106 const int buffer_size = 256;
108 char buf[buffer_size]; 107 char buf[buffer_size];
109 safe_strerror_r(err, buf, sizeof(buf)); 108 safe_strerror_r(err, buf, sizeof(buf));
110 return std::string(buf); 109 return std::string(buf);
111 } 110 }
OLDNEW
« no previous file with comments | « base/ref_counted_memory.cc ('k') | base/scoped_native_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698