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

Side by Side Diff: src/flags.cc

Issue 48126: Fixing potentially problematic usage of OS::StrDup that caused some strings t... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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 | « src/d8-debug.cc ('k') | 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 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 241 }
242 } 242 }
243 } 243 }
244 if (args_flag != NULL) { 244 if (args_flag != NULL) {
245 HeapStringAllocator string_allocator; 245 HeapStringAllocator string_allocator;
246 StringStream buffer(&string_allocator); 246 StringStream buffer(&string_allocator);
247 buffer.Add("--%s", args_flag->name()); 247 buffer.Add("--%s", args_flag->name());
248 args->Add(buffer.ToCString().Detach()); 248 args->Add(buffer.ToCString().Detach());
249 JSArguments jsargs = *args_flag->args_variable(); 249 JSArguments jsargs = *args_flag->args_variable();
250 for (int j = 0; j < jsargs.argc(); j++) { 250 for (int j = 0; j < jsargs.argc(); j++) {
251 args->Add(OS::StrDup(jsargs[j])); 251 args->Add(StrDup(jsargs[j]));
252 } 252 }
253 } 253 }
254 return args; 254 return args;
255 } 255 }
256 256
257 257
258 // Helper function to parse flags: Takes an argument arg and splits it into 258 // Helper function to parse flags: Takes an argument arg and splits it into
259 // a flag name and flag value (or NULL if they are missing). is_bool is set 259 // a flag name and flag value (or NULL if they are missing). is_bool is set
260 // if the arg started with "-no" or "--no". The buffer may be used to NUL- 260 // if the arg started with "-no" or "--no". The buffer may be used to NUL-
261 // terminate the name, it must be large enough to hold any possible name. 261 // terminate the name, it must be large enough to hold any possible name.
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 const char** JSArguments::argv() { return argv_; } 540 const char** JSArguments::argv() { return argv_; }
541 const char*& JSArguments::operator[](int idx) { return argv_[idx]; } 541 const char*& JSArguments::operator[](int idx) { return argv_[idx]; }
542 JSArguments& JSArguments::operator=(JSArguments args) { 542 JSArguments& JSArguments::operator=(JSArguments args) {
543 argc_ = args.argc_; 543 argc_ = args.argc_;
544 argv_ = args.argv_; 544 argv_ = args.argv_;
545 return *this; 545 return *this;
546 } 546 }
547 547
548 548
549 } } // namespace v8::internal 549 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/d8-debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698