Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1013
diff -u -p -r1.1013 common.inc
--- includes/common.inc	11 Oct 2009 06:05:53 -0000	1.1013
+++ includes/common.inc	13 Oct 2009 07:05:29 -0000
@@ -4465,6 +4465,16 @@ function drupal_render(&$elements) {
   if (isset($elements['#theme'])) {
     $elements['#children'] = theme($elements['#theme'], $elements);
   }
+  // Similar to letting an element just have a #markup property, let an element
+  // just have a #link property, and if it has no theme function, then call l().
+  // The #link property is designed to be consistent with what's used by
+  // theme_links(). Unlike with #markup, we don't want to set #theme, because
+  // there are a lot of links, and this technique lets us bypass the overhead of
+  // theme() entirely.
+  elseif (isset($elements['#link'])) {
+    $link = $elements['#link'];
+    $elements['#children'] = isset($link['title']) ? l($link['title'], $link['href'], $link) : '';
+  }
   // If #theme was not set and the element has children, render them now
   // using drupal_render_children().
   if ($elements['#children'] == '') {
Index: includes/locale.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/locale.inc,v
retrieving revision 1.231
diff -u -p -r1.231 locale.inc
--- includes/locale.inc	9 Oct 2009 16:33:13 -0000	1.231
+++ includes/locale.inc	13 Oct 2009 07:05:29 -0000
@@ -575,13 +575,13 @@ function _locale_languages_configure_for
 
       $table_form['description'][$id] = array('#markup' => filter_xss_admin($provider['description']));
 
-      $config_op = '';
+      $config_op = array();
       if (isset($provider['config'])) {
-        $config_op = l(t('Configure'), $provider['config']);
+        $config_op = array('title' => t('Configure'), 'href' => $provider['config']);
         // If there is at least one operation enabled show the operation column.
         $table_form['#show_operations'] = TRUE;
       }
-      $table_form['operation'][$id] = array('#markup' => $config_op);
+      $table_form['operation'][$id]['#link'] = $config_op;
     }
   }
 
Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.533
diff -u -p -r1.533 theme.inc
--- includes/theme.inc	9 Oct 2009 16:33:13 -0000	1.533
+++ includes/theme.inc	13 Oct 2009 07:05:30 -0000
@@ -2037,6 +2037,10 @@ function _theme_table_cell($cell, $heade
 
   if (is_array($cell)) {
     $data = isset($cell['data']) ? $cell['data'] : '';
+    // Cell's data property can be a string or a renderable array.
+    if (is_array($data)) {
+      $data = drupal_render($data);
+    }
     $header |= isset($cell['header']);
     unset($cell['data']);
     unset($cell['header']);
Index: modules/block/block.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.admin.inc,v
retrieving revision 1.58
diff -u -p -r1.58 block.admin.inc
--- modules/block/block.admin.inc	30 Sep 2009 13:09:29 -0000	1.58
+++ modules/block/block.admin.inc	13 Oct 2009 07:05:30 -0000
@@ -64,13 +64,17 @@ function block_admin_display_form($form,
       '#options' => $block_regions,
     );
     $form[$key]['configure'] = array(
-      '#markup' => l(t('configure'),
-      'admin/structure/block/configure/' . $block['module'] . '/' . $block['delta']),
+      '#link' => array(
+        'title' => t('configure'),
+        'href' => 'admin/structure/block/configure/' . $block['module'] . '/' . $block['delta'],
+      ),
     );
     if ($block['module'] == 'block') {
       $form[$key]['delete'] = array(
-        '#markup' => l(t('delete'),
-        'admin/structure/block/delete/' . $block['delta']),
+        '#link' => array(
+          'title' => t('delete'),
+          'href' => 'admin/structure/block/delete/' . $block['delta'],
+        ),
       );
     }
   }
Index: modules/comment/comment.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.admin.inc,v
retrieving revision 1.34
diff -u -p -r1.34 comment.admin.inc
--- modules/comment/comment.admin.inc	10 Oct 2009 13:37:07 -0000	1.34
+++ modules/comment/comment.admin.inc	13 Oct 2009 07:05:30 -0000
@@ -90,7 +90,7 @@ function comment_admin_overview($form, &
       'author' => theme('username', array('account' => $comment)),
       'posted_in' => l($comment->node_title, 'node/' . $comment->nid),
       'changed' => format_date($comment->changed, 'short'),
-      'operations' => l(t('edit'), 'comment/edit/' . $comment->cid, array('query' => $destination)),
+      'operations' => array('data' => array('#link' => array('title' => t('edit'), 'href' => 'comment/edit/' . $comment->cid, 'query' => $destination))),
     );
   }
 
Index: modules/field_ui/field_ui.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/field_ui/field_ui.admin.inc,v
retrieving revision 1.22
diff -u -p -r1.22 field_ui.admin.inc
--- modules/field_ui/field_ui.admin.inc	9 Oct 2009 00:59:57 -0000	1.22
+++ modules/field_ui/field_ui.admin.inc	13 Oct 2009 07:05:30 -0000
@@ -107,17 +107,17 @@ function field_ui_field_overview_form($f
         '#markup' => $instance['field_name'],
       ),
       'type' => array(
-        '#markup' => l(t($field_types[$field['type']]['label']), $admin_field_path . '/field-settings', array('attributes' => array('title' => t('Edit field settings.')))),
+        '#link' => array('title' => t($field_types[$field['type']]['label']), 'href' => $admin_field_path . '/field-settings', 'attributes' => array('title' => t('Edit field settings.'))),
       ),
       'widget_type' => array(
-        '#markup' => l(t($widget_types[$instance['widget']['type']]['label']), $admin_field_path . '/widget-type', array('attributes' => array('title' => t('Change widget type.')))),
+        '#link' => array('title' => t($widget_types[$instance['widget']['type']]['label']), 'href' => $admin_field_path . '/widget-type', 'attributes' => array('title' => t('Change widget type.'))),
       ),
       'edit' => array(
-        '#markup' => l(t('edit'), $admin_field_path, array('attributes' => array('title' => t('Edit instance settings.')))),
+        '#link' => array('title' => t('edit'), 'href' => $admin_field_path, 'attributes' => array('title' => t('Edit instance settings.'))),
       ),
       'delete' => array(
-        '#markup' => l(t('delete'), $admin_field_path . '/delete', array('attributes' => array('title' => t('Delete instance.')))),
-       ),
+        '#link' => array('title' => t('delete'), 'href' => $admin_field_path . '/delete', 'attributes' => array('title' => t('Delete instance.'))),
+      ),
       'weight' => array(
         '#type' => 'textfield',
         '#default_value' => $weight,
Index: modules/filter/filter.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.admin.inc,v
retrieving revision 1.48
diff -u -p -r1.48 filter.admin.inc
--- modules/filter/filter.admin.inc	9 Oct 2009 00:59:58 -0000	1.48
+++ modules/filter/filter.admin.inc	13 Oct 2009 07:05:30 -0000
@@ -32,8 +32,8 @@ function filter_admin_overview($form) {
       $roles_markup = $roles ? implode(', ', $roles) : t('No roles may use this format');
     }
     $form['formats'][$id]['roles'] = array('#markup' => $roles_markup);
-    $form['formats'][$id]['configure'] = array('#markup' => l(t('configure'), 'admin/config/content/formats/' . $id));
-    $form['formats'][$id]['delete'] = array('#markup' => $form['formats'][$id]['#is_fallback'] ? '' : l(t('delete'), 'admin/config/content/formats/' . $id . '/delete'));
+    $form['formats'][$id]['configure']['#link'] = array('title' => t('configure'), 'href' => 'admin/config/content/formats/' . $id);
+    $form['formats'][$id]['delete']['#link'] = $form['formats'][$id]['#is_fallback'] ? array() : array('title' => t('delete'), 'href' => 'admin/config/content/formats/' . $id . '/delete');
     $form['formats'][$id]['weight'] = array('#type' => 'weight', '#default_value' => $format->weight);
   }
   $form['submit'] = array('#type' => 'submit', '#value' => t('Save changes'));
Index: modules/image/image.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/image/image.admin.inc,v
retrieving revision 1.12
diff -u -p -r1.12 image.admin.inc
--- modules/image/image.admin.inc	9 Oct 2009 01:00:00 -0000	1.12
+++ modules/image/image.admin.inc	13 Oct 2009 07:05:30 -0000
@@ -70,11 +70,13 @@ function image_style_form($form, &$form_
       '#type' => 'weight',
       '#default_value' => $effect['weight'],
     );
-    $form['effects'][$ieid]['configure'] = array(
-      '#markup' => isset($effect['form callback']) ? l(t('edit'), 'admin/config/media/image-styles/edit/' . $style['name'] . '/effects/' . $effect['ieid'] ) : '',
-    );
-    $form['effects'][$ieid]['remove'] = array(
-      '#markup' => l(t('delete'), 'admin/config/media/image-styles/edit/' . $style['name'] . '/effects/' . $effect['ieid'] . '/delete'),
+    $form['effects'][$ieid]['configure']['#link'] = isset($effect['form callback']) ? array(
+      'title' => t('edit'),
+      'href' => 'admin/config/media/image-styles/edit/' . $style['name'] . '/effects/' . $effect['ieid'],
+    ) : array();
+    $form['effects'][$ieid]['remove']['#link'] = array(
+      'title' => t('delete'),
+      'href' => 'admin/config/media/image-styles/edit/' . $style['name'] . '/effects/' . $effect['ieid'] . '/delete',
     );
   }
 
Index: modules/menu/menu.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/menu/menu.admin.inc,v
retrieving revision 1.64
diff -u -p -r1.64 menu.admin.inc
--- modules/menu/menu.admin.inc	9 Oct 2009 17:16:46 -0000	1.64
+++ modules/menu/menu.admin.inc	13 Oct 2009 07:05:30 -0000
@@ -109,19 +109,18 @@ function _menu_overview_tree_form($tree)
       );
       // Build a list of operations.
       $operations = array();
-      $operations['edit'] = l(t('edit'), 'admin/structure/menu/item/' . $item['mlid'] . '/edit');
+      $operations['edit'] = array('title' => t('edit'), 'href' => 'admin/structure/menu/item/' . $item['mlid'] . '/edit');
       // Only items created by the menu module can be deleted.
       if ($item['module'] == 'menu' || $item['updated'] == 1) {
-        $operations['delete'] = l(t('delete'), 'admin/structure/menu/item/' . $item['mlid'] . '/delete');
+        $operations['delete'] = array('title' => t('delete'), 'href' => 'admin/structure/menu/item/' . $item['mlid'] . '/delete');
       }
       // Set the reset column.
       elseif ($item['module'] == 'system' && $item['customized']) {
-        $operations['reset'] = l(t('reset'), 'admin/structure/menu/item/' . $item['mlid'] . '/reset');
+        $operations['reset'] = array('title' => t('reset'), 'href' => 'admin/structure/menu/item/' . $item['mlid'] . '/reset');
       }
 
-      $form[$mlid]['operations'] = array();
-      foreach ($operations as $op => $value) {
-        $form[$mlid]['operations'][$op] = array('#markup' => $value);
+      foreach ($operations as $op => $link) {
+        $form[$mlid]['operations'][$op]['#link'] = $link;
       }
     }
 
Index: modules/profile/profile.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.admin.inc,v
retrieving revision 1.33
diff -u -p -r1.33 profile.admin.inc
--- modules/profile/profile.admin.inc	9 Oct 2009 01:00:02 -0000	1.33
+++ modules/profile/profile.admin.inc	13 Oct 2009 07:05:30 -0000
@@ -26,8 +26,8 @@ function profile_admin_overview($form) {
     $form[$field->fid]['type'] = array('#markup' => $field->type);
     $form[$field->fid]['category'] = array('#type' => 'select', '#default_value' => $field->category, '#options' => array());
     $form[$field->fid]['weight'] = array('#type' => 'weight', '#default_value' => $field->weight);
-    $form[$field->fid]['edit'] = array('#markup' => l(t('edit'), "admin/config/people/profile/edit/$field->fid"));
-    $form[$field->fid]['delete'] = array('#markup' => l(t('delete'), "admin/config/people/profile/delete/$field->fid"));
+    $form[$field->fid]['edit']['#link'] = array('title' => t('edit'), 'href' => "admin/config/people/profile/edit/$field->fid");
+    $form[$field->fid]['delete']['#link'] = array('title' => t('delete'), 'href' => "admin/config/people/profile/delete/$field->fid");
   }
 
   // Add the category combo boxes
@@ -51,6 +51,7 @@ function profile_admin_overview($form) {
   }
   $form['#tree'] = TRUE;
 
+  // @todo: Any reason this isn't done using an element with #theme = 'links'?
   $addnewfields = '<h2>' . t('Add new field') . '</h2>';
   $addnewfields .= '<ul>';
   foreach (_profile_field_types() as $key => $value) {
Index: modules/system/system.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v
retrieving revision 1.209
diff -u -p -r1.209 system.admin.inc
--- modules/system/system.admin.inc	9 Oct 2009 01:00:05 -0000	1.209
+++ modules/system/system.admin.inc	13 Oct 2009 07:05:31 -0000
@@ -241,13 +241,8 @@ function system_themes_form() {
     );
     $options[$theme->name] = $theme->info['name'];
 
-    if (drupal_theme_access($theme)) {
-      $form[$theme->name]['operations'] = array('#markup' => l(t('configure'), 'admin/appearance/settings/' . $theme->name) );
-    }
-    else {
-      // Dummy element for drupal_render. Cleaner than adding a check in the theme function.
-      $form[$theme->name]['operations'] = array();
-    }
+    $form[$theme->name]['operations']['#link'] = drupal_theme_access($theme) ? array('title' => t('configure'), 'href' => 'admin/appearance/settings/' . $theme->name) : array();
+
     if (!empty($theme->status)) {
       $status[] = $theme->name;
     }
Index: modules/taxonomy/taxonomy.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v
retrieving revision 1.72
diff -u -p -r1.72 taxonomy.admin.inc
--- modules/taxonomy/taxonomy.admin.inc	9 Oct 2009 01:00:05 -0000	1.72
+++ modules/taxonomy/taxonomy.admin.inc	13 Oct 2009 07:05:31 -0000
@@ -20,9 +20,9 @@ function taxonomy_overview_vocabularies(
     $form[$vocabulary->vid]['#vocabulary'] = $vocabulary;
     $form[$vocabulary->vid]['name'] = array('#markup' => check_plain($vocabulary->name));
     $form[$vocabulary->vid]['weight'] = array('#type' => 'weight', '#delta' => 10, '#default_value' => $vocabulary->weight);
-    $form[$vocabulary->vid]['edit'] = array('#markup' => l(t('edit vocabulary'), "admin/structure/taxonomy/$vocabulary->vid"));
-    $form[$vocabulary->vid]['list'] = array('#markup' => l(t('list terms'), "admin/structure/taxonomy/$vocabulary->vid/list"));
-    $form[$vocabulary->vid]['add'] = array('#markup' => l(t('add terms'), "admin/structure/taxonomy/$vocabulary->vid/list/add"));
+    $form[$vocabulary->vid]['edit']['#link'] = array('title' => t('edit vocabulary'), 'href' => "admin/structure/taxonomy/$vocabulary->vid");
+    $form[$vocabulary->vid]['list']['#link'] = array('title' => t('list terms'), 'href' => "admin/structure/taxonomy/$vocabulary->vid/list");
+    $form[$vocabulary->vid]['add']['#link'] = array('title' => t('add terms'), 'href' => "admin/structure/taxonomy/$vocabulary->vid/list/add");
   }
 
   // Only make this form include a submit button and weight if more than one
@@ -354,7 +354,7 @@ function taxonomy_overview_terms($form, 
       unset($form[$key]['#term']['parents'], $term->parents);
     }
 
-    $form[$key]['view'] = array('#markup' => l($term->name, "taxonomy/term/$term->tid"));
+    $form[$key]['view']['#link'] = array('title' => $term->name, 'href' => "taxonomy/term/$term->tid");
     if ($vocabulary->hierarchy < 2 && count($tree) > 1) {
       $form['#parent_fields'] = TRUE;
       $form[$key]['tid'] = array(
@@ -372,7 +372,7 @@ function taxonomy_overview_terms($form, 
         '#default_value' => $term->depth,
       );
     }
-    $form[$key]['edit'] = array('#markup' => l(t('edit'), 'taxonomy/term/' . $term->tid . '/edit', array('query' => drupal_get_destination())));
+    $form[$key]['edit']['#link'] = array('title' => t('edit'), 'href' => 'taxonomy/term/' . $term->tid . '/edit', 'query' => drupal_get_destination());
   }
 
   $form['#total_entries'] = $total_entries;
Index: modules/user/user.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.admin.inc,v
retrieving revision 1.84
diff -u -p -r1.84 user.admin.inc
--- modules/user/user.admin.inc	10 Oct 2009 16:48:39 -0000	1.84
+++ modules/user/user.admin.inc	13 Oct 2009 07:05:31 -0000
@@ -192,7 +192,7 @@ function user_admin_account() {
       'roles' => theme('item_list', array('items' => $users_roles)),
       'member_for' => format_interval(REQUEST_TIME - $account->created),
       'access' =>  $account->access ? t('@time ago', array('@time' => format_interval(REQUEST_TIME - $account->access))) : t('never'),
-      'operations' => l(t('edit'), "user/$account->uid/edit", array('query' => $destination)),
+      'operations' => array('data' => array('#link' => array('title' => t('edit'), 'href' => "user/$account->uid/edit", 'query' => $destination))),
     );
   }
   
