Index: modules/taxonomy/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v
retrieving revision 1.516
diff -u -p -r1.516 taxonomy.module
--- modules/taxonomy/taxonomy.module	10 Oct 2009 18:42:52 -0000	1.516
+++ modules/taxonomy/taxonomy.module	14 Oct 2009 00:37:41 -0000
@@ -73,29 +73,38 @@ function taxonomy_entity_info() {
  *   The term object.
  * @param $pager
  *   Boolean to indicate whether a pager should be used.
+ * @param $limit
+ *   Integer to limit the query results. Defaults to the value
+ *   of 'feed_default_items' variable. Set to -1 for no limit.
  * @order
  *   An array of fields and directions.
  *
  * @return
  *   An array of nids matching the query.
  */
-function taxonomy_select_nodes($term, $pager = TRUE, $order = array('t.sticky' => 'DESC', 't.created' => 'DESC')) {
+function taxonomy_select_nodes($term, $pager = TRUE, $order = array('t.sticky' => 'DESC', 't.created' => 'DESC'), $limit = NULL) {
   if (!variable_get('taxonomy_maintain_index_table', TRUE)) {
     return array();
   }
+  if (is_null($limit)) {
+    $limit = variable_get('feed_default_items', 10);
+  }
   $query = db_select('taxonomy_index', 't');
   $query->addTag('node_access');
   if ($pager) {
     $count_query = clone $query;
     $count_query->addExpression('COUNT(t.nid)');
 
-    $query = $query
-      ->extend('PagerDefault')
-      ->limit(variable_get('default_nodes_main', 10));
+    $query = $query->extend('PagerDefault');
+    if ($limit >= 0) {
+      $query = $query->limit($limit);
+    }
     $query->setCountQuery($count_query);
   }
   else {
-    $query->range(0, variable_get('feed_default_items', 10));
+    if ($limit >= 0) {
+      $query->range(0, $limit);
+    }
   }
   $query->condition('tid', $term->tid );
   $query->addField('t', 'nid');
