~ubuntu-branches/ubuntu/trusty/mira/trusty-proposed

« back to all changes in this revision

Viewing changes to src/progs/quirks.H

  • Committer: Package Import Robot
  • Author(s): Thorsten Alteholz, Thorsten Alteholz, Andreas Tille
  • Date: 2014-02-02 22:51:35 UTC
  • mfrom: (7.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20140202225135-nesemzj59jjgogh0
Tags: 4.0-1
[ Thorsten Alteholz ]
* New upstream version 
* debian/rules: add boost dir in auto_configure (Closes: #735798)

[ Andreas Tille ]
* cme fix dpkg-control
* debian/patches/{make.patch,spelling.patch}: applied upstream (thus removed)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#ifndef _quirks_h_
27
27
#define _quirks_h_
28
28
 
29
 
#include <stdlib.h>  // setenv();
30
 
#include <boost/filesystem.hpp>
31
 
 
32
 
// make the "tcmalloc: large alloc" messages from TCMallom disappear
33
 
// by setting the reporting environment variable to a very large value
34
 
// see: http://groups.google.com/group/google-perftools/browse_thread/thread/24a003fc35f3d470?pli=1
35
 
void quietenTCMALLOC()
36
 
{
37
 
  setenv("TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD",
38
 
         "1099511627776", // 1 TiB, should be enough to quieten almost everything
39
 
         0); // "0" means "do not overwrite if already existing"
40
 
}
41
 
 
42
 
/*
43
 
  On some systems, Boost::filesystem (at least up to 1.50) throws a standard
44
 
  exception when using some functions: locale::facet::_S_create_c_locale name not valid
45
 
  Only countermeasure possible: setenv
46
 
  Using setlocale or std::locale::global does *NOT* work as workaround (tried and tested)
47
 
 */
48
 
void fixLocaleQuirk()
49
 
{
50
 
  try{
51
 
    // this must work
52
 
    boost::filesystem::path fp = boost::filesystem::current_path();
53
 
  }
54
 
  catch(...){
55
 
    // if not, we're on a system with quirks
56
 
    setenv("LC_ALL",
57
 
           "C",
58
 
           1);
59
 
 
60
 
    std::cout << "Your system seems to be older or have some quirks with locale settings."
61
 
      "\nUsing the LC_ALL=C workaround."
62
 
      "\nIf you don't want that, fix your system ;-)\n";
63
 
  }
64
 
}
65
 
 
66
 
 
67
 
void fixQuirks()
68
 
{
69
 
  quietenTCMALLOC();
70
 
  fixLocaleQuirk();
71
 
}
 
29
void quietenTCMALLOC();
 
30
void fixLocaleQuirk();
 
31
void fixQuirks();
72
32
 
73
33
 
74
34
#endif