Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch wrong-branch Excluding Merge-Ins
This is equivalent to a diff from 459499b0ea to 0fa917da41
|
2025-03-10
| ||
| 14:43 | Merge the latest trunk enhancements into the comment-markdown-links branch. ... (check-in: 652362e97c user: drh tags: comment-markdown-links) | |
|
2025-03-08
| ||
| 12:13 | Improved implementation of the PQueue object, with the added option to carry an arbitrary pointer as content. ... (check-in: 4111717eae user: drh tags: min-from-to) | |
| 12:04 | Improved implementation of the PQueue object, with the added option to carry an arbitrary pointer as content. ... (Leaf check-in: 0fa917da41 user: drh tags: wrong-branch) | |
|
2025-03-07
| ||
| 23:19 | Merge the latest trunk enhancements into the comment-markdown-links branch. ... (check-in: 459499b0ea user: drh tags: comment-markdown-links) | |
| 20:26 | Add the /test-title webpage. Accessible to administrators only. ... (check-in: af57f63dee user: drh tags: trunk) | |
|
2025-03-05
| ||
| 21:43 | Further tweaks to the markdown style formatting in wiki. ... (check-in: 1029539757 user: drh tags: comment-markdown-links) | |
Changes to src/pqueue.c.
| ︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | - - + + + - - - - + + + + + + + + + + + - + + + | ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This file contains code used to implement a priority queue. ** A priority queue is a list of items order by a floating point |
| ︙ | |||
67 68 69 70 71 72 73 74 75 76 77 78 79 | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + - - - + + + + + - - - - - - - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
/*
** Change the size of the queue so that it contains N slots
*/
static void pqueuex_resize(PQueue *p, int N){
p->a = fossil_realloc(p->a, sizeof(p->a[0])*N);
p->sz = N;
}
/*
** Allocate a new queue entry and return a pointer to it.
*/
static struct QueueElement *pqueuex_new_entry(PQueue *p){
if( p->cnt+1>p->sz ){
pqueuex_resize(p, p->cnt+7);
}
return &p->a[p->cnt++];
}
/*
** Element p->a[p->cnt-1] has just been inserted. Shift entries
** around so as to preserve the heap property.
*/
static void pqueuex_rebalance(PQueue *p){
int i, j;
struct QueueElement *a = p->a;
i = p->cnt-1;
while( (j = (i-1)/2)>=0 && a[j].value>a[i].value ){
struct QueueElement t = a[j];
a[j] = a[i];
a[i] = t;
i = j;
}
}
/*
** Insert element e into the queue.
*/
void pqueuex_insert(PQueue *p, int e, double v){
struct QueueElement *pE = pqueuex_new_entry(p);
pE->value = v;
pE->u.id = e;
pqueuex_rebalance(p);
}
void pqueuex_insert_ptr(PQueue *p, void *pPtr, double v){
struct QueueElement *pE = pqueuex_new_entry(p);
pE->value = v;
pE->u.p = pPtr;
pqueuex_rebalance(p);
}
/*
** Remove and discard p->a[0] element from the queue. Rearrange
** nodes to preserve the heap property.
*/
static void pqueuex_pop(PQueue *p){
int i, j;
struct QueueElement *a = p->a;
struct QueueElement tmp;
i = 0;
|