### Eclipse Workspace Patch 1.0
#P votingapi
Index: votingapi.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/votingapi/votingapi.module,v
retrieving revision 1.46.2.15
diff -u -r1.46.2.15 votingapi.module
--- votingapi.module	9 Oct 2008 21:12:35 -0000	1.46.2.15
+++ votingapi.module	29 Jan 2009 12:27:38 -0000
@@ -301,15 +301,17 @@
  *   $criteria['vote_source']
  *   $criteria['timestamp']   (If this is set, records with timestamps
  *      GREATER THAN the set value will be selected.)
+ * @param $limit
+ *   integer specifying the maximum number of votes to return
  * @return
  *   An array of votes matching the criteria.
  */
-function votingapi_select_votes($criteria = array()) {
+function votingapi_select_votes($criteria = array(), $limit = 0) {
   if (!empty($criteria['vote_source'])) {
     $criteria['timestamp'] = time() - variable_get('votingapi_anonymous_window', 3600);
   }
   $votes = array();
-  $result = _votingapi_select('vote', $criteria);
+  $result = $limit ? _votingapi_select('vote', $criteria, $limit) : _votingapi_select('vote', $criteria);
   while ($vote = db_fetch_array($result)) {
     $votes[] = $vote;
   }
@@ -331,12 +333,14 @@
  *   $criteria['vote_source']
  *   $criteria['timestamp']   (If this is set, records with timestamps
  *      GREATER THAN the set value will be selected.)
+ * @param $limit
+ *   integer specifying the maximum number of votes to return
  * @return
  *   An array of vote results matching the criteria.
  */
-function votingapi_select_results($criteria = array()) {
+function votingapi_select_results($criteria = array(), $limit = 0) {
   $cached = array();
-  $result = _votingapi_select('cache', $criteria);
+  $result = $limit ? _votingapi_select('cache', $criteria, $limit) : _votingapi_select('cache', $criteria);
   while ($cache = db_fetch_array($result)) {
     $cached[] = $cache;
   }
