Codebase list distro-info / 002f2ed
Simplify milestone selection logic. Benjamin Drung 10 years ago
1 changed file(s) with 5 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
245245 int date_index, ssize_t *days) {
246246 const date_t *first;
247247 const date_t *second;
248 date_t *milestone = NULL;
249248 int direction;
250249
251 if(date_index == MILESTONE_CREATED) {
252 milestone = distro->milestones[MILESTONE_CREATED];
253 } else if(date_index == MILESTONE_RELEASE) {
254 milestone = distro->milestones[MILESTONE_RELEASE];
255 } else if(date_index == MILESTONE_EOL) {
256 milestone = distro->milestones[MILESTONE_EOL];
257 }
258 #ifdef UBUNTU
259 else if(date_index == MILESTONE_EOL_SERVER) {
260 milestone = distro->milestones[MILESTONE_EOL_SERVER];
261 if(!milestone) {
262 return false;
263 }
264 }
265 #endif
250 assert(date_index >= 0 && date_index < MILESTONE_COUNT);
266251
267252 /* distro may not have specified a particular milestone date
268253 * (yet).
269254 */
270 if(!milestone) {
255 if(!distro->milestones[date_index]) {
271256 return false;
272257 }
273258
274 if(date_ge(date, milestone)) {
259 if(date_ge(date, distro->milestones[date_index])) {
275260 first = date;
276 second = milestone;
261 second = distro->milestones[date_index];
277262 direction = -1;
278263 } else {
279 first = milestone;
264 first = distro->milestones[date_index];
280265 second = date;
281266 direction = 1;
282267 }