Index: includes/module.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/module.inc,v
retrieving revision 1.197
diff -u -p -r1.197 module.inc
--- includes/module.inc	28 Jul 2010 01:46:59 -0000	1.197
+++ includes/module.inc	19 Aug 2010 15:28:33 -0000
@@ -72,7 +72,8 @@ function module_list($refresh = FALSE, $
         $list = system_list('bootstrap');
       }
       else {
-        $list = system_list('module_enabled');
+        $list = array_keys(system_list('module_enabled'));
+        $list = (!empty($list) ? array_combine($list, $list) : array());
       }
     }
   }
@@ -97,8 +98,8 @@ function module_list($refresh = FALSE, $
  *
  * @return
  *   An associative array of modules or themes, keyed by name, and having the
- *   respective database row as value. For $type 'module_enabled' and
- *   'bootstrap', the array values equal the keys.
+ *   respective database row as value. For $type 'bootstrap', the array values
+ *   equal the keys.
  *
  * @see module_list()
  * @see list_themes()
@@ -145,9 +146,9 @@ function system_list($type) {
       // consistent with the one used in module_implements().
       $result = db_query("SELECT * FROM {system} ORDER BY weight ASC, name ASC");
       foreach ($result as $record) {
+        // Build a list of all enabled modules.
         if ($record->type == 'module' && $record->status) {
-          // Build a list of all enabled modules.
-          $lists['module_enabled'][$record->name] = $record->name;
+          $lists['module_enabled'][$record->name] = $record;
         }
         // Build a list of themes.
         if ($record->type == 'theme') {
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.954
diff -u -p -r1.954 system.module
--- modules/system/system.module	18 Aug 2010 18:41:30 -0000	1.954
+++ modules/system/system.module	19 Aug 2010 15:27:32 -0000
@@ -2223,20 +2223,32 @@ function system_update_files_database(&$
  *
  * @param $type
  *   Either 'module' or 'theme'.
+ * @param $name
+ *   (optional) The name of a $type to return. If omitted, all records are
+ *   returned.
  *
  * @return
- *   An associative array of module or theme information keyed by name.
+ *   An associative array of module or theme information keyed by name, or only
+ *   information for $name, if given.
  *
  * @see system_rebuild_module_data()
  * @see system_rebuild_theme_data()
  */
-function system_get_info($type) {
-  $info = array();
-  $result = db_query('SELECT name, info FROM {system} WHERE type = :type AND status = 1', array(':type' => $type));
-  foreach ($result as $item) {
-    $info[$item->name] = unserialize($item->info);
+function system_get_info($type, $name = NULL) {
+  // Statically cached separately due to the unserialize operation below.
+  $info = &drupal_static(__FUNCTION__);
+
+  if (!isset($info[$type])) {
+    $info[$type] = array();
+    $list = system_list($type == 'module' ? 'module_enabled' : 'theme');
+    foreach ($list as $shortname => $item) {
+      $info[$type][$shortname] = unserialize($item->info);
+    }
+  }
+  if (isset($name)) {
+    return isset($info[$type][$name]) ? $info[$type][$name] : FALSE;
   }
-  return $info;
+  return $info[$type];
 }
 
 /**
