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

Side by Side Diff: tools/SkFlags.cpp

Issue 12881014: When SkFlags encounters an invalid flag, quit. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 "SkFlags.h" 8 #include "SkFlags.h"
9 9
10 SkFlagInfo* SkFlags::gHead; 10 SkFlagInfo* SkFlags::gHead;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 flag->setDouble(atof(argv[i])); 150 flag->setDouble(atof(argv[i]));
151 break; 151 break;
152 default: 152 default:
153 SkASSERT(!"Invalid flag type"); 153 SkASSERT(!"Invalid flag type");
154 } 154 }
155 break; 155 break;
156 } 156 }
157 flag = flag->next(); 157 flag = flag->next();
158 } 158 }
159 if (!flagMatched) { 159 if (!flagMatched) {
160 SkDebugf("skipping unknown flag %s\n", argv[i]); 160 SkDebugf("Got unknown flag \"%s\". Exiting.\n", argv[i]);
161 exit(-1);
161 } 162 }
162 } 163 }
163 } 164 }
164 // Since all of the flags have been set, release the memory used by each 165 // Since all of the flags have been set, release the memory used by each
165 // flag. FLAGS_x can still be used after this. 166 // flag. FLAGS_x can still be used after this.
166 SkFlagInfo* flag = gHead; 167 SkFlagInfo* flag = gHead;
167 gHead = NULL; 168 gHead = NULL;
168 while (flag != NULL) { 169 while (flag != NULL) {
169 SkFlagInfo* next = flag->next(); 170 SkFlagInfo* next = flag->next();
170 SkDELETE(flag); 171 SkDELETE(flag);
171 flag = next; 172 flag = next;
172 } 173 }
173 if (helpPrinted) { 174 if (helpPrinted) {
174 exit(0); 175 exit(0);
175 } 176 }
176 } 177 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698