subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1467382 - in /subversion/branches/fsfs-format7/subversion: include/svn_sorts.h libsvn_subr/sorts.c
Date Fri, 12 Apr 2013 17:58:13 GMT
Author: stefan2
Date: Fri Apr 12 17:58:13 2013
New Revision: 1467382

URL: http://svn.apache.org/r1467382
Log:
On the fsfs-fromat7 branch:  Allow for modifying and re-evaluating
the top element of a priority queue.  This function not only saves
copy operations but it can also be more efficient to update the
queue position for the previous head than doing a full insertion.

* subversion/include/svn_sorts.h
  (svn__priority_queue_update): declare new function

* subversion/libsvn_subr/sorts.c
  (svn__priority_queue_update): implement it

Modified:
    subversion/branches/fsfs-format7/subversion/include/svn_sorts.h
    subversion/branches/fsfs-format7/subversion/libsvn_subr/sorts.c

Modified: subversion/branches/fsfs-format7/subversion/include/svn_sorts.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/include/svn_sorts.h?rev=1467382&r1=1467381&r2=1467382&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/include/svn_sorts.h (original)
+++ subversion/branches/fsfs-format7/subversion/include/svn_sorts.h Fri Apr 12 17:58:13 2013
@@ -264,6 +264,13 @@ void *
 svn__priority_queue_peek(svn__priority_queue_t *queue);
 
 /**
+ * Notify the @a queue after modifying the first item as returned by
+ * #svn__priority_queue_peek.
+ */
+void
+svn__priority_queue_update(svn__priority_queue_t *queue);
+
+/**
  * Remove the first element from the @a queue.  This is a no-op for empty
  * queues.
  */

Modified: subversion/branches/fsfs-format7/subversion/libsvn_subr/sorts.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_subr/sorts.c?rev=1467382&r1=1467381&r2=1467382&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_subr/sorts.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_subr/sorts.c Fri Apr 12 17:58:13 2013
@@ -423,6 +423,12 @@ svn__priority_queue_peek(svn__priority_q
 }
 
 void
+svn__priority_queue_update(svn__priority_queue_t *queue)
+{
+  heap_bubble_up(queue, 0);
+}
+
+void
 svn__priority_queue_pop(svn__priority_queue_t *queue)
 {
   if (queue->elements->nelts)



Mime
View raw message