Deleted Added
full compact
Errno.cpp (261991) Errno.cpp (280031)
1//===- Errno.cpp - errno support --------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 21 unchanged lines hidden (view full) ---

30
31#if HAVE_ERRNO_H
32std::string StrError() {
33 return StrError(errno);
34}
35#endif // HAVE_ERRNO_H
36
37std::string StrError(int errnum) {
1//===- Errno.cpp - errno support --------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 21 unchanged lines hidden (view full) ---

30
31#if HAVE_ERRNO_H
32std::string StrError() {
33 return StrError(errno);
34}
35#endif // HAVE_ERRNO_H
36
37std::string StrError(int errnum) {
38 const int MaxErrStrLen = 2000;
39 char buffer[MaxErrStrLen];
40 buffer[0] = '\0';
41 std::string str;
42 if (errnum == 0)
43 return str;
38 std::string str;
39 if (errnum == 0)
40 return str;
41#if defined(HAVE_STRERROR_R) || HAVE_DECL_STRERROR_S
42 const int MaxErrStrLen = 2000;
43 char buffer[MaxErrStrLen];
44 buffer[0] = '\0';
45#endif
44
45#ifdef HAVE_STRERROR_R
46 // strerror_r is thread-safe.
47#if defined(__GLIBC__) && defined(_GNU_SOURCE)
48 // glibc defines its own incompatible version of strerror_r
49 // which may not use the buffer supplied.
50 str = strerror_r(errnum, buffer, MaxErrStrLen - 1);
51#else

--- 23 unchanged lines hidden ---
46
47#ifdef HAVE_STRERROR_R
48 // strerror_r is thread-safe.
49#if defined(__GLIBC__) && defined(_GNU_SOURCE)
50 // glibc defines its own incompatible version of strerror_r
51 // which may not use the buffer supplied.
52 str = strerror_r(errnum, buffer, MaxErrStrLen - 1);
53#else

--- 23 unchanged lines hidden ---