Clean up DisplayModeRec handling in many places.
Use xf86DuplicateMode() instead of rolling our own, and change malloc+memset to calloc.
This commit is contained in:
parent
85617b56e5
commit
6828d8fc2b
|
@ -2088,8 +2088,7 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
|
||||||
*/
|
*/
|
||||||
cmodep = conf_monitor->mon_modeline_lst;
|
cmodep = conf_monitor->mon_modeline_lst;
|
||||||
while( cmodep ) {
|
while( cmodep ) {
|
||||||
mode = xnfalloc(sizeof(DisplayModeRec));
|
mode = xnfcalloc(1, sizeof(DisplayModeRec));
|
||||||
memset(mode,'\0',sizeof(DisplayModeRec));
|
|
||||||
mode->type = 0;
|
mode->type = 0;
|
||||||
mode->Clock = cmodep->ml_clock;
|
mode->Clock = cmodep->ml_clock;
|
||||||
mode->HDisplay = cmodep->ml_hdisplay;
|
mode->HDisplay = cmodep->ml_hdisplay;
|
||||||
|
@ -2426,10 +2425,7 @@ addDefaultModes(MonPtr monitorp)
|
||||||
if ( ! modeIsPresent(xf86DefaultModes[i].name,monitorp) )
|
if ( ! modeIsPresent(xf86DefaultModes[i].name,monitorp) )
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
mode = xnfalloc(sizeof(DisplayModeRec));
|
mode = xf86DuplicateMode(&xf86DefaultModes[i]);
|
||||||
memcpy(mode,&xf86DefaultModes[i],sizeof(DisplayModeRec));
|
|
||||||
if (xf86DefaultModes[i].name)
|
|
||||||
mode->name = xnfstrdup(xf86DefaultModes[i].name);
|
|
||||||
if( last ) {
|
if( last ) {
|
||||||
mode->prev = last;
|
mode->prev = last;
|
||||||
last->next = mode;
|
last->next = mode;
|
||||||
|
|
|
@ -56,7 +56,7 @@ _X_EXPORT DisplayModePtr
|
||||||
xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
|
xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
|
||||||
Bool Interlaced)
|
Bool Interlaced)
|
||||||
{
|
{
|
||||||
DisplayModeRec *Mode = xnfalloc(sizeof(DisplayModeRec));
|
DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec));
|
||||||
|
|
||||||
/* 1) top/bottom margin size (% of height) - default: 1.8 */
|
/* 1) top/bottom margin size (% of height) - default: 1.8 */
|
||||||
#define CVT_MARGIN_PERCENTAGE 1.8
|
#define CVT_MARGIN_PERCENTAGE 1.8
|
||||||
|
@ -79,8 +79,6 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
|
||||||
int VDisplayRnd, VMargin, VSync;
|
int VDisplayRnd, VMargin, VSync;
|
||||||
float Interlace; /* Please rename this */
|
float Interlace; /* Please rename this */
|
||||||
|
|
||||||
memset(Mode, 0, sizeof(DisplayModeRec));
|
|
||||||
|
|
||||||
/* CVT default is 60.0Hz */
|
/* CVT default is 60.0Hz */
|
||||||
if (!VRefresh)
|
if (!VRefresh)
|
||||||
VRefresh = 60.0;
|
VRefresh = 60.0;
|
||||||
|
|
|
@ -625,14 +625,11 @@ fbdevHWSetVideoModes(ScrnInfoPtr pScrn)
|
||||||
pScrn->virtualY = mode->VDisplay;
|
pScrn->virtualY = mode->VDisplay;
|
||||||
|
|
||||||
if (NULL == pScrn->modes) {
|
if (NULL == pScrn->modes) {
|
||||||
pScrn->modes = xnfalloc(sizeof(DisplayModeRec));
|
this = pScrn->modes = xf86DuplicateMode(mode);
|
||||||
this = pScrn->modes;
|
|
||||||
memcpy(this,mode,sizeof(DisplayModeRec));
|
|
||||||
this->next = this;
|
this->next = this;
|
||||||
this->prev = this;
|
this->prev = this;
|
||||||
} else {
|
} else {
|
||||||
this = xnfalloc(sizeof(DisplayModeRec));
|
this = xf86DuplicateMode(mode);
|
||||||
memcpy(this,mode,sizeof(DisplayModeRec));
|
|
||||||
this->next = pScrn->modes;
|
this->next = pScrn->modes;
|
||||||
this->prev = last;
|
this->prev = last;
|
||||||
last->next = this;
|
last->next = this;
|
||||||
|
|
|
@ -336,8 +336,7 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
|
||||||
" sync.\n", __func__, timing->h_active, timing->v_active);
|
" sync.\n", __func__, timing->h_active, timing->v_active);
|
||||||
}
|
}
|
||||||
|
|
||||||
Mode = xnfalloc(sizeof(DisplayModeRec));
|
Mode = xnfcalloc(1, sizeof(DisplayModeRec));
|
||||||
memset(Mode, 0, sizeof(DisplayModeRec));
|
|
||||||
|
|
||||||
Mode->type = M_T_DRIVER;
|
Mode->type = M_T_DRIVER;
|
||||||
if (preferred)
|
if (preferred)
|
||||||
|
|
|
@ -72,7 +72,7 @@ _X_EXPORT DisplayModePtr
|
||||||
xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
|
xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
|
||||||
Bool Interlaced)
|
Bool Interlaced)
|
||||||
{
|
{
|
||||||
DisplayModeRec *Mode = xnfalloc(sizeof(DisplayModeRec));
|
DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec));
|
||||||
|
|
||||||
/* 1) top/bottom margin size (% of height) - default: 1.8 */
|
/* 1) top/bottom margin size (% of height) - default: 1.8 */
|
||||||
#define CVT_MARGIN_PERCENTAGE 1.8
|
#define CVT_MARGIN_PERCENTAGE 1.8
|
||||||
|
@ -95,8 +95,6 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
|
||||||
int VDisplayRnd, VMargin, VSync;
|
int VDisplayRnd, VMargin, VSync;
|
||||||
float Interlace; /* Please rename this */
|
float Interlace; /* Please rename this */
|
||||||
|
|
||||||
memset(Mode, 0, sizeof(DisplayModeRec));
|
|
||||||
|
|
||||||
/* CVT default is 60.0Hz */
|
/* CVT default is 60.0Hz */
|
||||||
if (!VRefresh)
|
if (!VRefresh)
|
||||||
VRefresh = 60.0;
|
VRefresh = 60.0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user