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

Issue 6602049: Pure pedantry: Replace all ".size() == 0" with ".empty()". (Closed)

Created:
9 years, 9 months ago by Elliot Glaysher
Modified:
9 years, 7 months ago
CC:
chromium-reviews, jam, amit, ajwong+watch_chromium.org, kinuko+watch, ncarter (slow), idana, Erik does not do reviews, dmaclach+watch_chromium.org, darin-cc_chromium.org, brettw-cc_chromium.org, tim (not reviewing), wez+watch_chromium.org, Raghu Simha, cbentzel+watch_chromium.org, simonmorris+watch_chromium.org, pam+watch_chromium.org, sergeyu+watch_chromium.org, jamiewalch+watch_chromium.org, hclam+watch_chromium.org, garykac+watch_chromium.org, Aaron Boodman, lambroslambrou+watch_chromium.org, davemoore+watch_chromium.org, Paweł Hajdan Jr., jshin+watch_chromium.org
Visibility:
Public.

Description

Pure pedantry: Replace all ".size() == 0" with ".empty()". BUG=carnitas TEST=compiles; existing unit tests. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=76467

Patch Set 1 #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+76 lines, -76 lines) Patch
M base/command_line_unittest.cc View 1 chunk +1 line, -1 line 1 comment Download
M base/crypto/encryptor_nss.cc View 1 chunk +1 line, -1 line 0 comments Download
M base/file_path.cc View 1 chunk +1 line, -1 line 1 comment Download
M base/file_util_posix.cc View 1 chunk +1 line, -1 line 0 comments Download
M base/mime_util_xdg.cc View 1 chunk +1 line, -1 line 0 comments Download
M base/process_util_posix.cc View 1 chunk +1 line, -1 line 0 comments Download
M base/string_util.cc View 1 chunk +1 line, -1 line 2 comments Download
M chrome/browser/autocomplete/autocomplete_popup_view_mac.mm View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.mm View 1 chunk +1 line, -1 line 1 comment Download
M chrome/browser/browser_about_handler.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/chromeos/network_message_observer.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/debugger/debugger_remote_service.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/debugger/devtools_remote_listen_socket.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/extensions/extension_tabs_module.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/user_script_master.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/history/history_backend.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/history/text_database.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/password_manager/password_store_mac.cc View 2 chunks +2 lines, -2 lines 1 comment Download
M chrome/browser/process_info_snapshot_mac.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/renderer_host/browser_render_process_host.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/renderer_host/web_cache_manager.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/speech/speech_input_bubble_controller.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/glue/data_type_manager_impl.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/glue/data_type_manager_impl2.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/tab_contents/render_view_context_menu.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller_unittest.mm View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/extensions/extension_install_prompt2.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/update_manifest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/unix_domain_socket_posix.cc View 1 chunk +1 line, -1 line 1 comment Download
M chrome/installer/util/delete_after_reboot_helper.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/installer/util/shell_util.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/tools/convert_dict/dic_reader.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome_frame/policy_settings.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome_frame/urlmon_url_request.cc View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/render_sandbox_host_linux.cc View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/render_widget_host.cc View 1 chunk +1 line, -1 line 0 comments Download
M courgette/adjustment_method_2.cc View 2 chunks +6 lines, -6 lines 0 comments Download
M ipc/ipc_channel_posix.cc View 1 chunk +1 line, -1 line 0 comments Download
M ipc/ipc_message_utils.h View 2 chunks +2 lines, -2 lines 0 comments Download
M net/base/dnssec_chain_verifier.cc View 3 chunks +3 lines, -3 lines 0 comments Download
M net/base/x509_certificate.cc View 1 chunk +1 line, -1 line 0 comments Download
M net/base/x509_certificate_mac.cc View 1 chunk +1 line, -1 line 0 comments Download
M net/disk_cache/mem_entry_impl.cc View 1 chunk +1 line, -1 line 0 comments Download
M net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp View 1 chunk +1 line, -1 line 0 comments Download
M net/tools/flip_server/split.cc View 1 chunk +1 line, -1 line 0 comments Download
M net/tools/tld_cleanup/tld_cleanup.cc View 2 chunks +3 lines, -3 lines 0 comments Download
M o3d/core/cross/gl/effect_gl.cc View 1 chunk +1 line, -1 line 0 comments Download
M o3d/core/cross/gpu2d/interval_tree_test.cc View 1 chunk +2 lines, -2 lines 1 comment Download
M o3d/core/cross/gpu2d/path_processor.cc View 2 chunks +2 lines, -2 lines 1 comment Download
M o3d/plugin/cross/stream_manager.cc View 1 chunk +1 line, -1 line 0 comments Download
M o3d/plugin/idl/bounding_box.idl View 1 chunk +1 line, -1 line 0 comments Download
M o3d/utils/cross/text_reader.cc View 1 chunk +1 line, -1 line 1 comment Download
M remoting/base/tracer.cc View 1 chunk +1 line, -1 line 0 comments Download
M ui/gfx/codec/jpeg_codec_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M webkit/fileapi/file_system_path_manager.cc View 1 chunk +1 line, -1 line 0 comments Download
M webkit/plugins/npapi/plugin_group.cc View 1 chunk +1 line, -1 line 0 comments Download
M webkit/tools/test_shell/accessibility_ui_element.cc View 1 chunk +1 line, -1 line 0 comments Download
M webkit/tools/test_shell/test_shell_mac.mm View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 6 (0 generated)
Elliot Glaysher
This patch is one giant nit repeated a hundred times.
9 years, 9 months ago (2011-03-01 22:29:27 UTC) #1
Peter Kasting
Awesome! Can you also catch "size() > 0" and "size() != 0" and turn then ...
9 years, 9 months ago (2011-03-01 22:31:08 UTC) #2
dmaclach1
worth adding something to the presubmit scripts? or clang plugin? On Tue, Mar 1, 2011 ...
9 years, 9 months ago (2011-03-01 22:35:06 UTC) #3
Elliot Glaysher
On Tue, Mar 1, 2011 at 2:34 PM, David Maclachlan <dmaclach@google.com> wrote: > worth adding ...
9 years, 9 months ago (2011-03-01 22:40:54 UTC) #4
Ben Goodger (Google)
I am going to let Peter review this as I am very busy right now ...
9 years, 9 months ago (2011-03-01 22:50:52 UTC) #5
Peter Kasting
9 years, 9 months ago (2011-03-02 00:02:42 UTC) #6
LGTM but because it's me you get a bunch of tagalong nits for cleanup of
adjacent code.

http://codereview.chromium.org/6602049/diff/1/base/command_line_unittest.cc
File base/command_line_unittest.cc (right):

http://codereview.chromium.org/6602049/diff/1/base/command_line_unittest.cc#n...
base/command_line_unittest.cc:112: EXPECT_EQ(0U, cl.argv().size());
Nit: EXPECT_TRUE(cl.argv().empty()); (2 places)

http://codereview.chromium.org/6602049/diff/1/base/file_path.cc
File base/file_path.cc (right):

http://codereview.chromium.org/6602049/diff/1/base/file_path.cc#newcode252
base/file_path.cc:252: if (parent_components.size() >= child_components.size())
Nit: Seems like these could be combined

http://codereview.chromium.org/6602049/diff/1/base/string_util.cc
File base/string_util.cc (right):

http://codereview.chromium.org/6602049/diff/1/base/string_util.cc#newcode807
base/string_util.cc:807: if (parts.empty()) return STR();
Nit: Style: return goes on separate line

http://codereview.chromium.org/6602049/diff/1/base/string_util.cc#newcode810
base/string_util.cc:810: typename std::vector<STR>::const_iterator iter =
parts.begin();
Nit: While here:

  STR result(parts[0]);
  for (std::vector<STR>::const_iterator i(parts.begin() + 1); i != parts.end();
       ++i)
    result += sep + *iter;
  return result;

http://codereview.chromium.org/6602049/diff/1/chrome/browser/bookmarks/bookma...
File chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.mm (right):

http://codereview.chromium.org/6602049/diff/1/chrome/browser/bookmarks/bookma...
chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.mm:227: if
(elements.empty()) {
Nit: No {} (file style)

http://codereview.chromium.org/6602049/diff/1/chrome/browser/password_manager...
File chrome/browser/password_manager/password_store_mac.cc (right):

http://codereview.chromium.org/6602049/diff/1/chrome/browser/password_manager...
chrome/browser/password_manager/password_store_mac.cc:519: return matches.size()
!= 0;
Nit: !empty()

http://codereview.chromium.org/6602049/diff/1/chrome/common/unix_domain_socke...
File chrome/common/unix_domain_socket_posix.cc (right):

http://codereview.chromium.org/6602049/diff/1/chrome/common/unix_domain_socke...
chrome/common/unix_domain_socket_posix.cc:142: if (fd_vector.empty()) {
Nit:

    *result_fd = fd_vector.empty() ? -1 : fd_vector[0];

http://codereview.chromium.org/6602049/diff/1/o3d/core/cross/gpu2d/interval_t...
File o3d/core/cross/gpu2d/interval_tree_test.cc (right):

http://codereview.chromium.org/6602049/diff/1/o3d/core/cross/gpu2d/interval_t...
o3d/core/cross/gpu2d/interval_tree_test.cc:179: bool add = false;
Nit: Eliminate |add| and condense to:

    if (added_elements.empty() ||
        (!removed_elements.empty() && (NextRandom(2) == 1))) {
      ...
    } else {
      ...

http://codereview.chromium.org/6602049/diff/1/o3d/core/cross/gpu2d/path_proce...
File o3d/core/cross/gpu2d/path_processor.cc (right):

http://codereview.chromium.org/6602049/diff/1/o3d/core/cross/gpu2d/path_proce...
o3d/core/cross/gpu2d/path_processor.cc:1108: if (cur_segments.empty()) {
Nit: "break;  // Done" would allow eliminating {} (2 places)

http://codereview.chromium.org/6602049/diff/1/o3d/utils/cross/text_reader.cc
File o3d/utils/cross/text_reader.cc (right):

http://codereview.chromium.org/6602049/diff/1/o3d/utils/cross/text_reader.cc#...
o3d/utils/cross/text_reader.cc:51: if (eol.empty()) {
Nit: Eliminate anonymous namespace of consts and collapse to:

  if (!eol.empty()) {
    if (eol[0] == '\n')
      return 1;
    if (eol[0] == '\r')
      return ((eol.size() > 1) && (eol[1] == '\n')) ? 2 : 1;
  }
  return 0;

Powered by Google App Engine
This is Rietveld 408576698