In includes/theme.inc, theme_links() is declared that way:

function theme_links($variables) {

  // [...]

  $output = '';

  if (count($links) > 0) {
    $output = '';

    // [...]

    $num_links = count($links);

    // [...]

  }
}

Wouldn't it be (a bit) more efficient to:
- remove the second $output=''; ?
- move $num_links = count($links); before the if statement and use it there ?

Result:

function theme_links($variables) {

  // [...]

  $output = '';

  $num_links = count($links);

  if ($num_links > 0) {

    // [...]

  }
}
CommentFileSizeAuthor
#1 core-theme-theme_links-923116.patch618 bytesLaurentAjdnik

Comments

LaurentAjdnik’s picture

StatusFileSize
new618 bytes

Patch attached.

LaurentAjdnik’s picture

Status: Active » Needs review
mustanggb’s picture

Status: Needs review » Reviewed & tested by the community

Seems reasonable to me

sun’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

Thanks for taking the time to report this issue.

However, marking as duplicate of #98696: Various bugs in theme_links(). You can follow up on that issue to track its status instead. If any information from this issue is missing in the other issue, please make sure you provide it over there.