Make WordPress Core

Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#22828 closed enhancement (fixed)

Remove Duplicate Array Check

Reported by: miqrogroove Owned by: wonderboymusic
Priority: normal Milestone: 3.7
Component: Performance Version: 3.4.2
Severity: normal Keywords: has-patch 3.6-early
Cc: Focuses:

Description

I just stumbled across this silly bit of code in function get_core_updates()

if ( !isset( $from_api->updates ) || !is_array( $from_api->updates ) ) return false;
$updates = $from_api->updates;
if ( !is_array( $updates ) ) return false;

Attachments (4)

miqro-22828.diff​ (542 bytes ) - added by miqrogroove 14 years ago.
miqro-22828.2.diff​ (734 bytes ) - added by miqrogroove 14 years ago.
22828-3.patch​ (2.5 KB ) - added by azaozz 14 years ago.
22828.diff​ (3.0 KB ) - added by wonderboymusic 13 years ago.

Download all attachments as: .zip

Change History (11)

#1 @miqrogroove
14 years ago

  • Keywords has-patch added

Explanation of miqro-22828.2.diff :

An additional operation is saved because if isset( $from_api->updates ) then the function should proceed normally and this implies !empty($from_api). On the other hand, if !isset( $from_api->updates ) then the function should return to the caller and there is no reason to check if ( empty($from_api) ).

#2 @azaozz
14 years ago

Yeah, there are some redundant checks in that function.

22828-3.patch​ is same as 22828.2.diff and adds some readability/coding standards cleanup.

#3 @azaozz
14 years ago

  • Milestone Awaiting Review → Future Release
  • Type defect (bug) → enhancement

#4 @SergeyBiryukov
14 years ago

  • Keywords 3.6-early added

#5 @wonderboymusic
13 years ago

  • Milestone Future Release → 3.7

22828.diff​ has better whitespaces

#6 @wonderboymusic
13 years ago

  • Owner set to wonderboymusic
  • Resolution → fixed
  • Status new → closed

In 25256:

Remove redundant checks in some update functions. Adds some readability/coding standards cleanup.

Props miqrogroove, azaozz.
Fixes #22828.

#7 @miqrogroove
13 years ago

Good work everyone. Thank you for the commit, wonderboymusic.

Note: See TracTickets for help on using tickets.