summaryrefslogtreecommitdiff
path: root/libs/pbd/locale_guard.cc
blob: 7d6c0708b8a4cea030b09eacd2eeb75194b7c9d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdlib.h>
#include <string.h>
#include <locale.h>

#include "pbd/locale_guard.h"

using namespace PBD;

LocaleGuard::LocaleGuard (const char* str)
{
	old = strdup (setlocale (LC_NUMERIC, NULL));
	if (strcmp (old, str)) {
		setlocale (LC_NUMERIC, str);
	}
}

LocaleGuard::~LocaleGuard ()
{
	setlocale (LC_NUMERIC, old);
	free ((char*)old);
}