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

Side by Side Diff: base/process_util_posix.cc

Issue 6609008: Change other usages of .size() to .empty() when applicable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Peter nits Created 9 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 | « base/file_path.cc ('k') | base/string_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <dirent.h> 5 #include <dirent.h>
6 #include <errno.h> 6 #include <errno.h>
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <signal.h> 8 #include <signal.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <sys/resource.h> 10 #include <sys/resource.h>
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 393
394 // if found, we'll either be deleting or replacing this element. 394 // if found, we'll either be deleting or replacing this element.
395 if (found) { 395 if (found) {
396 count--; 396 count--;
397 size -= strlen(pair) + 1; 397 size -= strlen(pair) + 1;
398 if (j->second.size()) 398 if (j->second.size())
399 found = false; 399 found = false;
400 } 400 }
401 401
402 // if !found, then we have a new element to add. 402 // if !found, then we have a new element to add.
403 if (!found && j->second.size() > 0) { 403 if (!found && !j->second.empty()) {
404 count++; 404 count++;
405 size += j->first.size() + 1 /* '=' */ + j->second.size() + 1 /* NUL */; 405 size += j->first.size() + 1 /* '=' */ + j->second.size() + 1 /* NUL */;
406 } 406 }
407 } 407 }
408 408
409 count++; // for the final NULL 409 count++; // for the final NULL
410 uint8_t *buffer = new uint8_t[sizeof(char*) * count + size]; 410 uint8_t *buffer = new uint8_t[sizeof(char*) * count + size];
411 char **const ret = reinterpret_cast<char**>(buffer); 411 char **const ret = reinterpret_cast<char**>(buffer);
412 unsigned k = 0; 412 unsigned k = 0;
413 char *scratch = reinterpret_cast<char*>(buffer + sizeof(char*) * count); 413 char *scratch = reinterpret_cast<char*>(buffer + sizeof(char*) * count);
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 const ProcessFilter* filter) { 981 const ProcessFilter* filter) {
982 bool exited_cleanly = 982 bool exited_cleanly =
983 WaitForProcessesToExit(executable_name, wait_milliseconds, 983 WaitForProcessesToExit(executable_name, wait_milliseconds,
984 filter); 984 filter);
985 if (!exited_cleanly) 985 if (!exited_cleanly)
986 KillProcesses(executable_name, exit_code, filter); 986 KillProcesses(executable_name, exit_code, filter);
987 return exited_cleanly; 987 return exited_cleanly;
988 } 988 }
989 989
990 } // namespace base 990 } // namespace base
OLDNEW
« no previous file with comments | « base/file_path.cc ('k') | base/string_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698