| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 3 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
| 4 * Copyright (C) 2011 University of Szeged. All rights reserved. | 4 * Copyright (C) 2011 University of Szeged. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 // The vprintf_stderr_common function triggers this error in the Mac build. | 28 // The vprintf_stderr_common function triggers this error in the Mac build. |
| 29 // Feel free to remove this pragma if this file builds on Mac. | 29 // Feel free to remove this pragma if this file builds on Mac. |
| 30 // According to http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/Diagnostic-Pragmas.h
tml#Diagnostic-Pragmas | 30 // According to http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/Diagnostic-Pragmas.h
tml#Diagnostic-Pragmas |
| 31 // we need to place this directive before any data or functions are defined. | 31 // we need to place this directive before any data or functions are defined. |
| 32 #pragma GCC diagnostic ignored "-Wmissing-format-attribute" | 32 #pragma GCC diagnostic ignored "-Wmissing-format-attribute" |
| 33 | 33 |
| 34 #include "wtf/Assertions.h" | 34 #include "wtf/Assertions.h" |
| 35 | 35 |
| 36 #include "wtf/Compiler.h" | 36 #include "wtf/Compiler.h" |
| 37 #include "wtf/PtrUtil.h" | 37 #include "wtf/OwnPtr.h" |
| 38 #include "wtf/PassOwnPtr.h" |
| 38 #include "wtf/ThreadSpecific.h" | 39 #include "wtf/ThreadSpecific.h" |
| 39 #include "wtf/Threading.h" | 40 #include "wtf/Threading.h" |
| 40 #include <memory> | |
| 41 #include <stdarg.h> | 41 #include <stdarg.h> |
| 42 #include <stdio.h> | 42 #include <stdio.h> |
| 43 #include <stdlib.h> | 43 #include <stdlib.h> |
| 44 #include <string.h> | 44 #include <string.h> |
| 45 | 45 |
| 46 #if OS(MACOSX) | 46 #if OS(MACOSX) |
| 47 #include <AvailabilityMacros.h> | 47 #include <AvailabilityMacros.h> |
| 48 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 | 48 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 |
| 49 #define WTF_USE_APPLE_SYSTEM_LOG 1 | 49 #define WTF_USE_APPLE_SYSTEM_LOG 1 |
| 50 #include <asl.h> | 50 #include <asl.h> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 #endif | 108 #endif |
| 109 | 109 |
| 110 static void vprintf_stderr_with_trailing_newline(const char* format, va_list arg
s) | 110 static void vprintf_stderr_with_trailing_newline(const char* format, va_list arg
s) |
| 111 { | 111 { |
| 112 size_t formatLength = strlen(format); | 112 size_t formatLength = strlen(format); |
| 113 if (formatLength && format[formatLength - 1] == '\n') { | 113 if (formatLength && format[formatLength - 1] == '\n') { |
| 114 vprintf_stderr_common(format, args); | 114 vprintf_stderr_common(format, args); |
| 115 return; | 115 return; |
| 116 } | 116 } |
| 117 | 117 |
| 118 std::unique_ptr<char[]> formatWithNewline = wrapArrayUnique(new char[formatL
ength + 2]); | 118 OwnPtr<char[]> formatWithNewline = adoptArrayPtr(new char[formatLength + 2])
; |
| 119 memcpy(formatWithNewline.get(), format, formatLength); | 119 memcpy(formatWithNewline.get(), format, formatLength); |
| 120 formatWithNewline[formatLength] = '\n'; | 120 formatWithNewline[formatLength] = '\n'; |
| 121 formatWithNewline[formatLength + 1] = 0; | 121 formatWithNewline[formatLength + 1] = 0; |
| 122 | 122 |
| 123 vprintf_stderr_common(formatWithNewline.get(), args); | 123 vprintf_stderr_common(formatWithNewline.get(), args); |
| 124 } | 124 } |
| 125 | 125 |
| 126 #if COMPILER(CLANG) || (COMPILER(GCC) && GCC_VERSION_AT_LEAST(4, 6, 0)) | 126 #if COMPILER(CLANG) || (COMPILER(GCC) && GCC_VERSION_AT_LEAST(4, 6, 0)) |
| 127 #pragma GCC diagnostic pop | 127 #pragma GCC diagnostic pop |
| 128 #endif | 128 #endif |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 va_end(args); | 349 va_end(args); |
| 350 } | 350 } |
| 351 | 351 |
| 352 void WTFLogAlways(const char* format, ...) | 352 void WTFLogAlways(const char* format, ...) |
| 353 { | 353 { |
| 354 va_list args; | 354 va_list args; |
| 355 va_start(args, format); | 355 va_start(args, format); |
| 356 vprintf_stderr_with_trailing_newline(format, args); | 356 vprintf_stderr_with_trailing_newline(format, args); |
| 357 va_end(args); | 357 va_end(args); |
| 358 } | 358 } |
| OLD | NEW |