Return value of setlocale() is allocated in static storage and is thus volatile.

This commit fixes the following Valgrind error :
==17204== Invalid read of size 1
==17204==    at 0x4C29F34: __GI_strchr (mc_replace_strmem.c:219)
==17204==    by 0xBF5E14C: _nl_load_locale_from_archive (loadarchive.c:170)
==17204==    by 0xBF5D60A: _nl_find_locale (findlocale.c:107)
==17204==    by 0xBF5CB8B: setlocale (setlocale.c:379)
==17204==    by 0x808B776: QgsCoordinateReferenceSystem::setProj4String(QString) (in /home/even/qgis-git/Quantum-GIS/build/install/lib/libqgis_core.so.1.9.0)
==17204==    by 0x808A401: QgsCoordinateReferenceSystem::createFromProj4(QString) (in /home/even/qgis-git/Quantum-GIS/build/install/lib/libqgis_core.so.1.9.0)
==17204==    by 0x7FC2F68: QgsDistanceArea::setEllipsoid(QString const&) (in /home/even/qgis-git/Quantum-GIS/build/install/lib/libqgis_core.so.1.9.0)
==17204==    by 0x6D23A3: QgsMeasureDialog::updateSettings() (in /home/even/qgis-git/Quantum-GIS/build/install/bin/qgis)
==17204==    by 0x6D200D: QgsMeasureDialog::QgsMeasureDialog(QgsMeasureTool*, QFlags<Qt::WindowType>) (in /home/even/qgis-git/Quantum-GIS/build/install/bin/qgis)
==17204==    by 0x6D5777: QgsMeasureTool::QgsMeasureTool(QgsMapCanvas*, bool) (in /home/even/qgis-git/Quantum-GIS/build/install/bin/qgis)
==17204==    by 0x553E4B: QgisApp::createCanvasTools() (in /home/even/qgis-git/Quantum-GIS/build/install/bin/qgis)
==17204==    by 0x544411: QgisApp::QgisApp(QSplashScreen*, bool, QWidget*, QFlags<Qt::WindowType>) (in /home/even/qgis-git/Quantum-GIS/build/install/bin/qgis)
==17204==  Address 0x2aec57b1 is 1 bytes inside a block of size 11 free'd
==17204==    at 0x4C287BE: free (vg_replace_malloc.c:446)
==17204==    by 0xBF5CC34: setlocale (setlocale.c:173)
==17204==    by 0x808B6A0: QgsCoordinateReferenceSystem::setProj4String(QString) (in /home/even/qgis-git/Quantum-GIS/build/install/lib/libqgis_core.so.1.9.0)
==17204==    by 0x808A401: QgsCoordinateReferenceSystem::createFromProj4(QString) (in /home/even/qgis-git/Quantum-GIS/build/install/lib/libqgis_core.so.1.9.0)
==17204==    by 0x7FC2F68: QgsDistanceArea::setEllipsoid(QString const&) (in /home/even/qgis-git/Quantum-GIS/build/install/lib/libqgis_core.so.1.9.0)
==17204==    by 0x6D23A3: QgsMeasureDialog::updateSettings() (in /home/even/qgis-git/Quantum-GIS/build/install/bin/qgis)
==17204==    by 0x6D200D: QgsMeasureDialog::QgsMeasureDialog(QgsMeasureTool*, QFlags<Qt::WindowType>) (in /home/even/qgis-git/Quantum-GIS/build/install/bin/qgis)
==17204==    by 0x6D5777: QgsMeasureTool::QgsMeasureTool(QgsMapCanvas*, bool) (in /home/even/qgis-git/Quantum-GIS/build/install/bin/qgis)
==17204==    by 0x553E4B: QgisApp::createCanvasTools() (in /home/even/qgis-git/Quantum-GIS/build/install/bin/qgis)
==17204==    by 0x544411: QgisApp::QgisApp(QSplashScreen*, bool, QWidget*, QFlags<Qt::WindowType>) (in /home/even/qgis-git/Quantum-GIS/build/install/bin/qgis)
==17204==    by 0x53DFF5: main (in /home/even/qgis-git/Quantum-GIS/build/install/bin/qgis)
==17204==
The return value of CPLGetConfigOption() is volatile, and can be
invalidated by a following call to CPLSetConfigOption(). Thus it needs
to be duplicated.
Merge pull request #255 from rouault/master

Fix errors in the usage of setlocale() and CPLGetConfigOption()