| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 WTF_ATTRIBUTE_PRINTF(1, 0) | 64 WTF_ATTRIBUTE_PRINTF(1, 0) |
| 65 static void vprintf_stderr_common(const char* format, va_list args) | 65 static void vprintf_stderr_common(const char* format, va_list args) |
| 66 { | 66 { |
| 67 #if OS(ANDROID) | 67 #if OS(ANDROID) |
| 68 __android_log_vprint(ANDROID_LOG_WARN, "WebKit", format, args); | 68 __android_log_vprint(ANDROID_LOG_WARN, "WebKit", format, args); |
| 69 #endif | 69 #endif |
| 70 vfprintf(stderr, format, args); | 70 vfprintf(stderr, format, args); |
| 71 } | 71 } |
| 72 | 72 |
| 73 #if COMPILER(CLANG) || (COMPILER(GCC) && GCC_VERSION_AT_LEAST(4, 6, 0)) | 73 #if COMPILER(CLANG) || COMPILER(GCC) |
| 74 #pragma GCC diagnostic push | 74 #pragma GCC diagnostic push |
| 75 #pragma GCC diagnostic ignored "-Wformat-nonliteral" | 75 #pragma GCC diagnostic ignored "-Wformat-nonliteral" |
| 76 #endif | 76 #endif |
| 77 | 77 |
| 78 static void vprintf_stderr_with_prefix(const char* prefix, const char* format, v
a_list args) | 78 static void vprintf_stderr_with_prefix(const char* prefix, const char* format, v
a_list args) |
| 79 { | 79 { |
| 80 size_t prefixLength = strlen(prefix); | 80 size_t prefixLength = strlen(prefix); |
| 81 size_t formatLength = strlen(format); | 81 size_t formatLength = strlen(format); |
| 82 OwnPtr<char[]> formatWithPrefix = adoptArrayPtr(new char[prefixLength + form
atLength + 1]); | 82 OwnPtr<char[]> formatWithPrefix = adoptArrayPtr(new char[prefixLength + form
atLength + 1]); |
| 83 memcpy(formatWithPrefix.get(), prefix, prefixLength); | 83 memcpy(formatWithPrefix.get(), prefix, prefixLength); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 96 } | 96 } |
| 97 | 97 |
| 98 OwnPtr<char[]> formatWithNewline = adoptArrayPtr(new char[formatLength + 2])
; | 98 OwnPtr<char[]> formatWithNewline = adoptArrayPtr(new char[formatLength + 2])
; |
| 99 memcpy(formatWithNewline.get(), format, formatLength); | 99 memcpy(formatWithNewline.get(), format, formatLength); |
| 100 formatWithNewline[formatLength] = '\n'; | 100 formatWithNewline[formatLength] = '\n'; |
| 101 formatWithNewline[formatLength + 1] = 0; | 101 formatWithNewline[formatLength + 1] = 0; |
| 102 | 102 |
| 103 vprintf_stderr_common(formatWithNewline.get(), args); | 103 vprintf_stderr_common(formatWithNewline.get(), args); |
| 104 } | 104 } |
| 105 | 105 |
| 106 #if COMPILER(CLANG) || (COMPILER(GCC) && GCC_VERSION_AT_LEAST(4, 6, 0)) | 106 #if COMPILER(CLANG) || COMPILER(GCC) |
| 107 #pragma GCC diagnostic pop | 107 #pragma GCC diagnostic pop |
| 108 #endif | 108 #endif |
| 109 | 109 |
| 110 WTF_ATTRIBUTE_PRINTF(1, 2) | 110 WTF_ATTRIBUTE_PRINTF(1, 2) |
| 111 static void printf_stderr_common(const char* format, ...) | 111 static void printf_stderr_common(const char* format, ...) |
| 112 { | 112 { |
| 113 va_list args; | 113 va_list args; |
| 114 va_start(args, format); | 114 va_start(args, format); |
| 115 vprintf_stderr_common(format, args); | 115 vprintf_stderr_common(format, args); |
| 116 va_end(args); | 116 va_end(args); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 200 |
| 201 void WTFLogAlways(const char* format, ...) | 201 void WTFLogAlways(const char* format, ...) |
| 202 { | 202 { |
| 203 va_list args; | 203 va_list args; |
| 204 va_start(args, format); | 204 va_start(args, format); |
| 205 vprintf_stderr_with_trailing_newline(format, args); | 205 vprintf_stderr_with_trailing_newline(format, args); |
| 206 va_end(args); | 206 va_end(args); |
| 207 } | 207 } |
| 208 | 208 |
| 209 } // extern "C" | 209 } // extern "C" |
| OLD | NEW |