While digging through content.module I found an unnecessary looping, sort of like this:

foreach (module_list() as $module) {
  // Some code.
}
foreach (module_list() as $module) {
  // More code.
}

This patch simply makes it:

foreach (module_list() as $module) {
  // Some code.
  // More code.
}

I couldn't find any reason for the two separate loops, the variable names are never over written or anything.

CommentFileSizeAuthor
content_remove_foreach.patch617 bytesquicksketch

Comments

yched’s picture

Status: Needs review » Fixed

True, I've been having this as a TODO for at least 2 months...
Committed !

yched’s picture

Status: Fixed » Closed (works as designed)

Actually I reverted this, this broke the addition of formatters by external modules (e.g imagecache implementing formatters for imagefields - see http://drupal.org/node/157176#comment-807421). $info['field types'][$db_name]['formatters'] entries were overwritten by $info['field types'][$db_name]['formatters'] = array(); at the beginning of the next iteration.

yched’s picture

I just refactored that area a little bit, and added comments to help us resist the temptation later on.