simplify
This commit is contained in:
@@ -1,30 +1,19 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "GetSysInfo.h"
|
#include "GetSysInfo.h"
|
||||||
#include "RageUtil.h"
|
|
||||||
|
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
|
|
||||||
void GetKernel( RString &sys, int &vers )
|
void GetKernel( RString &sys, int &iVersion )
|
||||||
{
|
{
|
||||||
utsname uts;
|
struct utsname uts;
|
||||||
uname( &uts );
|
uname( &uts );
|
||||||
|
|
||||||
sys = uts.sysname;
|
sys = uts.sysname;
|
||||||
vers = 0;
|
iVersion = 0;
|
||||||
|
|
||||||
if( sys == "Linux" )
|
int iMajor = 0, iMinor = 0, iRevision = 0;
|
||||||
{
|
if( sscanf( uts.release, "%d.%d.%d", &iMajor, &iMinor, &iRevision ) >= 2 )
|
||||||
static Regex ver( "([0-9]+)\\.([0-9]+)\\.([0-9]+)" );
|
iVersion = (iMajor * 10000) + (iMinor * 100) + (iRevision);
|
||||||
vector<RString> matches;
|
|
||||||
if( ver.Compare(uts.release, matches) )
|
|
||||||
{
|
|
||||||
ASSERT( matches.size() >= 2 );
|
|
||||||
int major = atoi(matches[0]);
|
|
||||||
int minor = atoi(matches[1]);
|
|
||||||
int revision = atoi(matches[2]);
|
|
||||||
vers = (major * 10000) + (minor * 100) + (revision);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user