G++ complains about the difference between the return type of tcmalloc's
IsHeapProfilerRunning (int) and the return type of the function that
g_conf.profiler_running is supposed to point to (bool). We could
probably get away with a type-cast, but as a compiler developer and
former C++ language lawyer, I'd rather not take the risk of destroying
the universe by invoking undefined behavior ;-)
Signed-off-by: Alexandre Oliva <oliva@lsd.ic.unicamp.br>
Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
generic_server_usage();
}
+#ifdef HAVE_LIBTCMALLOC
+/* Adjust the return type */
+static bool isHeapProfilerRunning(void) {
+ return IsHeapProfilerRunning();
+}
+#endif //HAVE_LIBTCMALLOC
+
int main(int argc, const char **argv)
{
DEFINE_CONF_VARS(usage);
#ifdef HAVE_LIBTCMALLOC
g_conf.profiler_start = HeapProfilerStart;
- g_conf.profiler_running = IsHeapProfilerRunning;
+ g_conf.profiler_running = isHeapProfilerRunning;
g_conf.profiler_stop = HeapProfilerStop;
g_conf.profiler_dump = HeapProfilerDump;
g_conf.tcmalloc_have = true;
generic_server_usage();
}
+#ifdef HAVE_LIBTCMALLOC
+/* Adjust the return type */
+static bool isHeapProfilerRunning(void) {
+ return IsHeapProfilerRunning();
+}
+#endif //HAVE_LIBTCMALLOC
int main(int argc, const char **argv)
{
#ifdef HAVE_LIBTCMALLOC
g_conf.profiler_start = HeapProfilerStart;
- g_conf.profiler_running = IsHeapProfilerRunning;
+ g_conf.profiler_running = isHeapProfilerRunning;
g_conf.profiler_stop = HeapProfilerStop;
g_conf.profiler_dump = HeapProfilerDump;
g_conf.tcmalloc_have = true;