Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: tools/flags/SkCommandLineFlags.cpp

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/flags/SkCommandLineFlags.h ('k') | tools/render_pdfs_main.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkCommandLineFlags.h" 8 #include "SkCommandLineFlags.h"
9 #include "SkTDArray.h" 9 #include "SkTDArray.h"
10 #include "SkTSort.h" 10 #include "SkTSort.h"
11 11
12 #include <stdlib.h> 12 #include <stdlib.h>
13 13
14 DEFINE_bool(undefok, false, "Silently ignore unknown flags instead of crashing." ); 14 DEFINE_bool(undefok, false, "Silently ignore unknown flags instead of crashing." );
15 15
16 template <typename T> static void ignore_result(const T&) {} 16 template <typename T> static void ignore_result(const T&) {}
17 17
18 bool SkFlagInfo::CreateStringFlag(const char* name, const char* shortName, 18 bool SkFlagInfo::CreateStringFlag(const char* name, const char* shortName,
19 SkCommandLineFlags::StringArray* pStrings, 19 SkCommandLineFlags::StringArray* pStrings,
20 const char* defaultValue, const char* helpStri ng) { 20 const char* defaultValue, const char* helpStri ng) {
21 SkFlagInfo* info = SkNEW_ARGS(SkFlagInfo, (name, shortName, kString_FlagType , helpString)); 21 SkFlagInfo* info = new SkFlagInfo(name, shortName, kString_FlagType, helpStr ing);
22 info->fDefaultString.set(defaultValue); 22 info->fDefaultString.set(defaultValue);
23 23
24 info->fStrings = pStrings; 24 info->fStrings = pStrings;
25 SetDefaultStrings(pStrings, defaultValue); 25 SetDefaultStrings(pStrings, defaultValue);
26 return true; 26 return true;
27 } 27 }
28 28
29 void SkFlagInfo::SetDefaultStrings(SkCommandLineFlags::StringArray* pStrings, 29 void SkFlagInfo::SetDefaultStrings(SkCommandLineFlags::StringArray* pStrings,
30 const char* defaultValue) { 30 const char* defaultValue) {
31 pStrings->reset(); 31 pStrings->reset();
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 } 327 }
328 } 328 }
329 } 329 }
330 } 330 }
331 // Since all of the flags have been set, release the memory used by each 331 // Since all of the flags have been set, release the memory used by each
332 // flag. FLAGS_x can still be used after this. 332 // flag. FLAGS_x can still be used after this.
333 SkFlagInfo* flag = gHead; 333 SkFlagInfo* flag = gHead;
334 gHead = NULL; 334 gHead = NULL;
335 while (flag != NULL) { 335 while (flag != NULL) {
336 SkFlagInfo* next = flag->next(); 336 SkFlagInfo* next = flag->next();
337 SkDELETE(flag); 337 delete flag;
338 flag = next; 338 flag = next;
339 } 339 }
340 if (helpPrinted) { 340 if (helpPrinted) {
341 exit(0); 341 exit(0);
342 } 342 }
343 } 343 }
344 344
345 namespace { 345 namespace {
346 346
347 template <typename Strings> 347 template <typename Strings>
(...skipping 29 matching lines...) Expand all
377 } 377 }
378 378
379 } // namespace 379 } // namespace
380 380
381 bool SkCommandLineFlags::ShouldSkip(const SkTDArray<const char*>& strings, const char* name) { 381 bool SkCommandLineFlags::ShouldSkip(const SkTDArray<const char*>& strings, const char* name) {
382 return ShouldSkipImpl(strings, name); 382 return ShouldSkipImpl(strings, name);
383 } 383 }
384 bool SkCommandLineFlags::ShouldSkip(const StringArray& strings, const char* name ) { 384 bool SkCommandLineFlags::ShouldSkip(const StringArray& strings, const char* name ) {
385 return ShouldSkipImpl(strings, name); 385 return ShouldSkipImpl(strings, name);
386 } 386 }
OLDNEW
« no previous file with comments | « tools/flags/SkCommandLineFlags.h ('k') | tools/render_pdfs_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698