From fd41f46ac62033a724bd1f4612f19448a21c1224 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 11 Jan 2008 22:38:21 -0500 Subject: [PATCH] Allow xf86DuplicateMode() to work correctly on read-only modes. Before this it was meaningless to try to mark DisplayModeRec tables const, since the mode name would be emitted as a pointer to an anonymous string constant, and therefore would have to be fixed up by ld.so and so couldn't live in .rodata. With this change the standard mode lists can live in .rodata, and modes duplicated from them will have their names filled in on the fly. --- hw/xfree86/modes/xf86Modes.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c index 3d222cc73..d6aa61aaf 100644 --- a/hw/xfree86/modes/xf86Modes.c +++ b/hw/xfree86/modes/xf86Modes.c @@ -214,10 +214,8 @@ xf86DuplicateMode(DisplayModePtr pMode) *pNew = *pMode; pNew->next = NULL; pNew->prev = NULL; - if (pNew->name == NULL) { - xf86SetModeDefaultName(pMode); - } - pNew->name = xnfstrdup(pMode->name); + if (pNew->name == NULL) + xf86SetModeDefaultName(pNew); return pNew; }