Don't zero out mode structure after setting name field.

Instead of using memset to zero the structure (at the wrong time, no less),
use xcalloc to gather pre-initialized memory.
This commit is contained in:
Krzysztof Halasa 2007-01-27 12:29:31 -08:00 committed by Keith Packard
parent 7a5f17087b
commit 00decd3b6c
1 changed files with 1 additions and 3 deletions

View File

@ -564,7 +564,7 @@ xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
for (; conf_mode; conf_mode = (XF86ConfModeLinePtr) conf_mode->list.next)
{
mode = xalloc(sizeof(DisplayModeRec));
mode = xcalloc(1, sizeof(DisplayModeRec));
if (!mode)
continue;
mode->name = xstrdup(conf_mode->ml_identifier);
@ -573,8 +573,6 @@ xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
xfree (mode);
continue;
}
memset(mode,'\0',sizeof(DisplayModeRec));
mode->type = 0;
mode->Clock = conf_mode->ml_clock;
mode->HDisplay = conf_mode->ml_hdisplay;