summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mazon <jmazon+haskell@gmail.com>2020-03-01 18:40:42 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-03-09 16:33:37 -0400
commit8eb2c2639494bed3326163df52fa13de941cd047 (patch)
tree28554c7923fcbb6431c8af187789828a2aea8d73
parent9668781a36941e7552fcec38f6d4e1d5ec3ef6d1 (diff)
downloadhaskell-8eb2c2639494bed3326163df52fa13de941cd047.tar.gz
Fix Windows breakage by not touching locales on Windows
-rw-r--r--rts/ProfHeap.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c
index efb312e899..38d6b7d433 100644
--- a/rts/ProfHeap.c
+++ b/rts/ProfHeap.c
@@ -26,15 +26,20 @@
#include <fs_rts.h>
#include <string.h>
+#if !defined(mingw32_HOST_OS)
#if defined(darwin_HOST_OS)
#include <xlocale.h>
#else
#include <locale.h>
#endif
+#endif
FILE *hp_file;
static char *hp_filename; /* heap profile (hp2ps style) log file */
+
+#if !defined(mingw32_HOST_OS)
static locale_t prof_locale = 0, saved_locale = 0;
+#endif
/* -----------------------------------------------------------------------------
* era stores the current time period. It is the same as the
@@ -351,10 +356,12 @@ printSample(bool beginSample, StgDouble sampleValue)
void freeHeapProfiling (void)
{
+#if !defined(mingw32_HOST_OS)
if (prof_locale) {
freelocale(prof_locale);
prof_locale = 0;
}
+#endif
}
/* --------------------------------------------------------------------------
@@ -367,6 +374,7 @@ initHeapProfiling(void)
return;
}
+#if !defined(mingw32_HOST_OS)
if (! prof_locale) {
prof_locale = newlocale(LC_NUMERIC_MASK, "POSIX", 0);
if (! prof_locale) {
@@ -375,6 +383,7 @@ initHeapProfiling(void)
}
}
saved_locale = uselocale(prof_locale);
+#endif
char *prog;
@@ -473,7 +482,9 @@ initHeapProfiling(void)
}
#endif
+#if !defined(mingw32_HOST_OS)
uselocale(saved_locale);
+#endif
traceHeapProfBegin(0);
}
@@ -487,7 +498,9 @@ endHeapProfiling(void)
return;
}
+#if !defined(mingw32_HOST_OS)
saved_locale = uselocale(prof_locale);
+#endif
#if defined(PROFILING)
if (doingRetainerProfiling()) {
@@ -530,7 +543,9 @@ endHeapProfiling(void)
printSample(false, seconds);
fclose(hp_file);
+#if !defined(mingw32_HOST_OS)
uselocale(saved_locale);
+#endif
}
@@ -785,7 +800,9 @@ dumpCensus( Census *census )
counter *ctr;
ssize_t count;
+#if !defined(mingw32_HOST_OS)
saved_locale = uselocale(prof_locale);
+#endif
printSample(true, census->time);
@@ -916,7 +933,9 @@ dumpCensus( Census *census )
traceHeapProfSampleEnd(era);
printSample(false, census->time);
+#if !defined(mingw32_HOST_OS)
uselocale(saved_locale);
+#endif
}