* move some system-initialization to mu_util_init_system;

set G_SLICE env far to always-malloc on FreeBSD, as g_slice does not work
  correctly there.
This commit is contained in:
Dirk-Jan C. Binnema
2010-09-09 00:12:06 +03:00
parent 32a218d76e
commit 3a4bfe1362
3 changed files with 37 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/*
/*
** Copyright (C) 2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
**
** This program is free software; you can redistribute it and/or modify
@ -22,12 +22,14 @@
#include <stdlib.h>
#include <string.h>
#include <locale.h> /* for setlocale() */
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <glib-object.h>
#include <glib/gstdio.h>
#include <errno.h>
@ -66,6 +68,28 @@ mu_util_dir_expand (const char *path)
return dir;
}
gboolean
mu_util_init_system (void)
{
/* without setlocale, non-ascii cmdline params (like search
* terms) won't work */
setlocale (LC_ALL, "");
/* on FreeBSD, it seems g_slice_new and friends lead to
* segfaults. So we shut if off */
#ifdef __FreeBSD__
if (!g_setenv ("G_SLICE", "always-malloc", TRUE)) {
g_critical ("cannot set G_SLICE");
return FALSE;
}
MU_LOG_FILE("setting G_SLICE to always-malloc");
#endif /*__FreeBSD__*/
g_type_init ();
return TRUE;
}
gboolean
mu_util_check_dir (const gchar* path, gboolean readable, gboolean writeable)