summaryrefslogtreecommitdiff
path: root/src/radeon_modes.c
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2007-04-04 09:52:37 +0200
committerMichel Dänzer <michel@tungstengraphics.com>2007-04-04 09:52:37 +0200
commit3c892f163ec1fa9be6e733aab091c9b718f41efc (patch)
treeb561f1a40225aa7373d4ebad0e552ab626c31c00 /src/radeon_modes.c
parent3a8190ccc79969925257e7b980b78d79053d208d (diff)
radeon: Always sort modes when adding to list.
This makes sure mode lists will always be sorted from larger to smaller.
Diffstat (limited to 'src/radeon_modes.c')
-rw-r--r--src/radeon_modes.c34
1 files changed, 4 insertions, 30 deletions
diff --git a/src/radeon_modes.c b/src/radeon_modes.c
index 535d0470..372b2edd 100644
--- a/src/radeon_modes.c
+++ b/src/radeon_modes.c
@@ -373,15 +373,7 @@ int RADEONValidateDDCModes(ScrnInfoPtr pScrn1, char **ppModeName,
if (p == ddcModes) ddcModes = p->next;
/* Add to used modes */
- if (last) {
- last->next = p;
- p->prev = last;
- } else {
- first = p;
- p->prev = NULL;
- }
- p->next = NULL;
- last = p;
+ RADEONSortModes(&p, &first, &last);
break;
}
@@ -402,15 +394,7 @@ int RADEONValidateDDCModes(ScrnInfoPtr pScrn1, char **ppModeName,
if (p == ddcModes) ddcModes = p->next;
/* Add to used modes */
- if (last) {
- last->next = p;
- p->prev = last;
- } else {
- first = p;
- p->prev = NULL;
- }
- p->next = NULL;
- last = p;
+ RADEONSortModes(&p, &first, &last);
}
}
@@ -558,12 +542,7 @@ int RADEONValidateFPModes(ScrnInfoPtr pScrn, char **ppModeName)
new->type |= M_T_USERDEF;
- new->next = NULL;
- new->prev = last;
-
- if (last) last->next = new;
- last = new;
- if (!first) first = new;
+ RADEONSortModes(&new, &first, &last);
pScrn->display->virtualX =
pScrn->virtualX = MAX(pScrn->virtualX, width);
@@ -609,12 +588,7 @@ int RADEONValidateFPModes(ScrnInfoPtr pScrn, char **ppModeName)
new->type |= M_T_DEFAULT;
- new->next = NULL;
- new->prev = last;
-
- if (last) last->next = new;
- last = new;
- if (!first) first = new;
+ RADEONSortModes(&new, &first, &last);
}
}
}