| OLD | NEW |
| 1 // Copyright 2002 The RE2 Authors. All Rights Reserved. | 1 // Copyright 2002 The RE2 Authors. All Rights Reserved. |
| 2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
| 3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "util/util.h" | 5 #include "util/util.h" |
| 6 | 6 |
| 7 #ifndef va_copy | |
| 8 #define va_copy(d,s) ((d) = (s)) //KLUGE: for MS compilers | |
| 9 #endif | |
| 10 | |
| 11 namespace re2 { | 7 namespace re2 { |
| 12 | 8 |
| 13 static void StringAppendV(string* dst, const char* format, va_list ap) { | 9 static void StringAppendV(string* dst, const char* format, va_list ap) { |
| 14 // First try with a small fixed size buffer | 10 // First try with a small fixed size buffer |
| 15 char space[1024]; | 11 char space[1024]; |
| 16 | 12 |
| 17 // It's possible for methods that use a va_list to invalidate | 13 // It's possible for methods that use a va_list to invalidate |
| 18 // the data in it upon use. The fix is to make a copy | 14 // the data in it upon use. The fix is to make a copy |
| 19 // of the structure before using it and use that copy instead. | 15 // of the structure before using it and use that copy instead. |
| 20 va_list backup_ap; | 16 va_list backup_ap; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 69 } |
| 74 | 70 |
| 75 void StringAppendF(string* dst, const char* format, ...) { | 71 void StringAppendF(string* dst, const char* format, ...) { |
| 76 va_list ap; | 72 va_list ap; |
| 77 va_start(ap, format); | 73 va_start(ap, format); |
| 78 StringAppendV(dst, format, ap); | 74 StringAppendV(dst, format, ap); |
| 79 va_end(ap); | 75 va_end(ap); |
| 80 } | 76 } |
| 81 | 77 |
| 82 } // namespace re2 | 78 } // namespace re2 |
| OLD | NEW |