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

#include "pbd/localeguard.h"

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

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