OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2006 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 } | 250 } |
251 *argc = j; | 251 *argc = j; |
252 } | 252 } |
253 | 253 |
254 // parsed all flags successfully | 254 // parsed all flags successfully |
255 return 0; | 255 return 0; |
256 } | 256 } |
257 | 257 |
258 void FlagList::Register(Flag* flag) { | 258 void FlagList::Register(Flag* flag) { |
259 assert(flag != NULL && strlen(flag->name()) > 0); | 259 assert(flag != NULL && strlen(flag->name()) > 0); |
260 RTC_CHECK(!Lookup(flag->name())) << "flag " << flag->name() | 260 // NOTE: Don't call Lookup() within Register because it accesses the name_ |
261 << " declared twice"; | 261 // of other flags in list_, and if the flags are coming from two different |
| 262 // compilation units, the initialization order between them is undefined, and |
| 263 // this will trigger an asan initialization-order-fiasco error. |
262 flag->next_ = list_; | 264 flag->next_ = list_; |
263 list_ = flag; | 265 list_ = flag; |
264 } | 266 } |
265 | 267 |
266 #if defined(WEBRTC_WIN) | 268 #if defined(WEBRTC_WIN) |
267 WindowsCommandLineArguments::WindowsCommandLineArguments() { | 269 WindowsCommandLineArguments::WindowsCommandLineArguments() { |
268 // start by getting the command line. | 270 // start by getting the command line. |
269 LPTSTR command_line = ::GetCommandLine(); | 271 LPTSTR command_line = ::GetCommandLine(); |
270 // now, convert it to a list of wide char strings. | 272 // now, convert it to a list of wide char strings. |
271 LPWSTR *wide_argv = ::CommandLineToArgvW(command_line, &argc_); | 273 LPWSTR *wide_argv = ::CommandLineToArgvW(command_line, &argc_); |
(...skipping 16 matching lines...) Expand all Loading... |
288 // need to free each string in the array, and then the array. | 290 // need to free each string in the array, and then the array. |
289 for(int i = 0; i < argc_; i++) { | 291 for(int i = 0; i < argc_; i++) { |
290 delete[] argv_[i]; | 292 delete[] argv_[i]; |
291 } | 293 } |
292 | 294 |
293 delete[] argv_; | 295 delete[] argv_; |
294 } | 296 } |
295 #endif // WEBRTC_WIN | 297 #endif // WEBRTC_WIN |
296 | 298 |
297 } // namespace rtc | 299 } // namespace rtc |
OLD | NEW |