diff options
Diffstat (limited to 'hw/xfree86/parser/read.c')
-rw-r--r-- | hw/xfree86/parser/read.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/hw/xfree86/parser/read.c b/hw/xfree86/parser/read.c index ec038aeb1..d7e731217 100644 --- a/hw/xfree86/parser/read.c +++ b/hw/xfree86/parser/read.c @@ -56,6 +56,7 @@ #include <xorg-config.h> #endif +#include "xf86Config.h" #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" @@ -91,7 +92,7 @@ xf86readConfigFile(void) int token; XF86ConfigPtr ptr = NULL; - if ((ptr = calloc(1, sizeof(XF86ConfigRec))) == NULL) { + if ((ptr = xf86allocateConfig()) == NULL) { return NULL; } @@ -270,6 +271,19 @@ xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2) return (!(last_1 == last_2)); } +/* + * Conditionally allocate config struct, but only allocate it + * if it's not already there. In either event, return the pointer + * to the global config struct. + */ +XF86ConfigPtr xf86allocateConfig(void) +{ + if (!xf86configptr) { + xf86configptr = calloc(1, sizeof(XF86ConfigRec)); + } + return xf86configptr; +} + void xf86freeConfig(XF86ConfigPtr p) { |