From: Marek Olšák <marek.ol...@amd.com> A user can be using Mesa 11.0, but /etc/drirc can be from Mesa 10.5. We don't want the old drirc to affect Mesa 11.0.
There are 2 options: - use a different file name (e.g. /etc/drirc_global) for people wanting a global drirc file, but they must supply it by themselves - just don't load it, users should use ~/.drirc This patch implements the latter. --- src/mesa/drivers/dri/common/xmlconfig.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/common/xmlconfig.c b/src/mesa/drivers/dri/common/xmlconfig.c index 47a9aef..a8f00ef 100644 --- a/src/mesa/drivers/dri/common/xmlconfig.c +++ b/src/mesa/drivers/dri/common/xmlconfig.c @@ -955,7 +955,7 @@ static void parseOneConfigFile (XML_Parser p) { void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info, int screenNum, const char *driverName) { - char *filenames[2] = {"/etc/drirc", NULL}; + char *filename = NULL; char *home; uint32_t i; struct OptConfData userData; @@ -969,25 +969,25 @@ void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info, if ((home = getenv ("HOME"))) { uint32_t len = strlen (home); - filenames[1] = malloc(len + 7+1); - if (filenames[1] == NULL) + filename = malloc(len + 7+1); + if (filename == NULL) __driUtilMessage ("Can't allocate memory for %s/.drirc.", home); else { - memcpy (filenames[1], home, len); - memcpy (filenames[1] + len, "/.drirc", 7+1); + memcpy (filename, home, len); + memcpy (filename + len, "/.drirc", 7+1); } } - for (i = 0; i < 3; ++i) { + for (i = 0; i < 2; ++i) { XML_Parser p; - if (i && filenames[i-1] == NULL) + if (i && filename == NULL) continue; p = XML_ParserCreate (NULL); /* use encoding specified by file */ XML_SetElementHandler (p, optConfStartElem, optConfEndElem); XML_SetUserData (p, &userData); userData.parser = p; - userData.name = i ? filenames[i-1] : NULL; + userData.name = i ? filename : NULL; userData.ignoringDevice = 0; userData.ignoringApp = 0; userData.inDriConf = 0; @@ -1003,7 +1003,7 @@ void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info, XML_ParserFree (p); } - free(filenames[1]); + free(filename); } void driDestroyOptionInfo (driOptionCache *info) { -- 2.1.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev