diff options
author | Haru <haru@dotalux.com> | 2018-06-24 00:13:59 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2018-07-01 21:09:24 +0200 |
commit | 8dd7aec896efc0220d6234bcfb190767c30dbb29 (patch) | |
tree | 0fd1b8d2b795c01b4a6fddc3827784d26d09cc61 /src/common/sysinfo.c | |
parent | ec1bc50b01aa4f34f151b3b3800011abdce31919 (diff) | |
download | hercules-8dd7aec896efc0220d6234bcfb190767c30dbb29.tar.gz hercules-8dd7aec896efc0220d6234bcfb190767c30dbb29.tar.bz2 hercules-8dd7aec896efc0220d6234bcfb190767c30dbb29.tar.xz hercules-8dd7aec896efc0220d6234bcfb190767c30dbb29.zip |
Change functions to static where possible (Part 1 - common)
This fixes issues with plugins defining symbols with the same names
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common/sysinfo.c')
-rw-r--r-- | src/common/sysinfo.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c index 0056aee1e..b8cb2a90a 100644 --- a/src/common/sysinfo.c +++ b/src/common/sysinfo.c @@ -59,8 +59,8 @@ struct sysinfo_private { }; /// sysinfo.c interface source -struct sysinfo_interface sysinfo_s; -struct sysinfo_private sysinfo_p; +static struct sysinfo_interface sysinfo_s; +static struct sysinfo_private sysinfo_p; struct sysinfo_interface *sysinfo; @@ -238,7 +238,7 @@ enum windows_ver_suite { * @retval true if a revision was correctly detected. * @retval false if no revision was detected. out is set to NULL in this case. */ -bool sysinfo_svn_get_revision(char **out) +static bool sysinfo_svn_get_revision(char **out) { // Only include SVN support if detected it, or we're on MSVC #if !defined(SYSINFO_VCSTYPE) || SYSINFO_VCSTYPE == VCSTYPE_SVN || SYSINFO_VCSTYPE == VCSTYPE_UNKNOWN @@ -310,7 +310,7 @@ bool sysinfo_svn_get_revision(char **out) * @retval true if a revision was correctly detected. * @retval false if no revision was detected. out is set to NULL in this case. */ -bool sysinfo_git_get_revision(char **out) +static bool sysinfo_git_get_revision(char **out) { // Only include Git support if we detected it, or we're on MSVC #if !defined(SYSINFO_VCSTYPE) || SYSINFO_VCSTYPE == VCSTYPE_GIT || SYSINFO_VCSTYPE == VCSTYPE_UNKNOWN @@ -359,7 +359,7 @@ typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); * * Once retrieved, the version string is stored into sysinfo->p->osversion. */ -void sysinfo_osversion_retrieve(void) +static void sysinfo_osversion_retrieve(void) { OSVERSIONINFOEX osvi; StringBuf buf; @@ -611,7 +611,7 @@ typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); * System info is not stored anywhere after retrieval * @see http://msdn.microsoft.com/en-us/library/windows/desktop/ms724958(v=vs.85).aspx **/ -void sysinfo_systeminfo_retrieve(LPSYSTEM_INFO info) +static void sysinfo_systeminfo_retrieve(LPSYSTEM_INFO info) { PGNSI pGNSI; @@ -629,7 +629,7 @@ void sysinfo_systeminfo_retrieve(LPSYSTEM_INFO info) * Returns number of bytes in a memory page * Only needed when compiling with MSVC **/ -long sysinfo_getpagesize(void) +static long sysinfo_getpagesize(void) { SYSTEM_INFO si; ZeroMemory(&si, sizeof(SYSTEM_INFO)); @@ -644,7 +644,7 @@ long sysinfo_getpagesize(void) * Once retrieved, the name is stored into sysinfo->p->cpu and the * number of cores in sysinfo->p->cpucores. */ -void sysinfo_cpu_retrieve(void) +static void sysinfo_cpu_retrieve(void) { StringBuf buf; SYSTEM_INFO si; @@ -681,7 +681,7 @@ void sysinfo_cpu_retrieve(void) * * Once retrieved, the name is stored into sysinfo->p->arch. */ -void sysinfo_arch_retrieve(void) +static void sysinfo_arch_retrieve(void) { SYSTEM_INFO si; ZeroMemory(&si, sizeof(SYSTEM_INFO)); @@ -710,7 +710,7 @@ void sysinfo_arch_retrieve(void) * * Once retrieved, the value is stored in sysinfo->p->vcsrevision_src. */ -void sysinfo_vcsrevision_src_retrieve(void) +static void sysinfo_vcsrevision_src_retrieve(void) { if (sysinfo->p->vcsrevision_src != NULL) { aFree(sysinfo->p->vcsrevision_src); @@ -735,7 +735,7 @@ void sysinfo_vcsrevision_src_retrieve(void) * * Once retrieved, the value is stored in sysinfo->p->vcstype_name. */ -void sysinfo_vcstype_name_retrieve(void) +static void sysinfo_vcstype_name_retrieve(void) { if (sysinfo->p->vcstype_name != NULL) { aFree(sysinfo->p->vcstype_name); @@ -765,7 +765,7 @@ void sysinfo_vcstype_name_retrieve(void) * * Output example: "Linux", "Darwin", "Windows", etc. */ -const char *sysinfo_platform(void) +static const char *sysinfo_platform(void) { return sysinfo->p->platform; } @@ -784,7 +784,7 @@ const char *sysinfo_platform(void) * Output example: "Windows 2008 Small Business Server", "OS X 10.8 Mountain Lion", * "Gentoo Base System Release 2.2", "Debian GNU/Linux 6.0.6 (squeeze)", etc. */ -const char *sysinfo_osversion(void) +static const char *sysinfo_osversion(void) { return sysinfo->p->osversion; } @@ -804,7 +804,7 @@ const char *sysinfo_osversion(void) * "Intel(R) Xeon(R) CPU E5-1650 0 @ 3.20GHz", "Intel Core i7", * "x86 CPU, Family 6, Model 54, Stepping 1", etc. */ -const char *sysinfo_cpu(void) +static const char *sysinfo_cpu(void) { return sysinfo->p->cpu; } @@ -818,7 +818,7 @@ const char *sysinfo_cpu(void) * * @return the number of CPU cores. */ -int sysinfo_cpucores(void) +static int sysinfo_cpucores(void) { return sysinfo->p->cpucores; } @@ -836,7 +836,7 @@ int sysinfo_cpucores(void) * * Output example: "x86", "x86_64", "IA-64", "ARM", etc. */ -const char *sysinfo_arch(void) +static const char *sysinfo_arch(void) { return sysinfo->p->arch; } @@ -847,7 +847,7 @@ const char *sysinfo_arch(void) * @retval true if this is a 64 bit build. * @retval false if this isn't a 64 bit build (i.e. it is a 32 bit build). */ -bool sysinfo_is64bit(void) +static bool sysinfo_is64bit(void) { #ifdef _LP64 return true; @@ -866,7 +866,7 @@ bool sysinfo_is64bit(void) * Output example: "Microsoft Visual C++ 2012 (v170050727)", * "Clang v5.0.0", "MinGW32 v3.20", "GCC v4.7.3", etc. */ -const char *sysinfo_compiler(void) +static const char *sysinfo_compiler(void) { return sysinfo->p->compiler; } @@ -882,7 +882,7 @@ const char *sysinfo_compiler(void) * * Output example: "-ggdb -O2 -flto -pipe -ffast-math ..." */ -const char *sysinfo_cflags(void) +static const char *sysinfo_cflags(void) { return sysinfo->p->cflags; } @@ -898,7 +898,7 @@ const char *sysinfo_cflags(void) * * @see VCSTYPE_NONE, VCSTYPE_GIT, VCSTYPE_SVN, VCSTYPE_UNKNOWN */ -int sysinfo_vcstypeid(void) +static int sysinfo_vcstypeid(void) { return sysinfo->p->vcstype; } @@ -916,7 +916,7 @@ int sysinfo_vcstypeid(void) * * Output example: "Git", "SVN", "Exported" */ -const char *sysinfo_vcstype(void) +static const char *sysinfo_vcstype(void) { return sysinfo->p->vcstype_name; } @@ -935,7 +935,7 @@ const char *sysinfo_vcstype(void) * * Output example: Git: "9128feccf3bddda94a7f8a170305565416815b40", SVN: "17546" */ -const char *sysinfo_vcsrevision_src(void) +static const char *sysinfo_vcsrevision_src(void) { return sysinfo->p->vcsrevision_src; } @@ -952,7 +952,7 @@ const char *sysinfo_vcsrevision_src(void) * * Output example: Git: "9128feccf3bddda94a7f8a170305565416815b40", SVN: "17546" */ -const char *sysinfo_vcsrevision_scripts(void) +static const char *sysinfo_vcsrevision_scripts(void) { return sysinfo->p->vcsrevision_scripts; } @@ -961,7 +961,7 @@ const char *sysinfo_vcsrevision_scripts(void) * Reloads the run-time (scripts) VCS revision information. To be used during * script reloads to refresh the cached version. */ -void sysinfo_vcsrevision_reload(void) +static void sysinfo_vcsrevision_reload(void) { if (sysinfo->p->vcsrevision_scripts != NULL) { aFree(sysinfo->p->vcsrevision_scripts); @@ -984,7 +984,7 @@ void sysinfo_vcsrevision_reload(void) * @retval false if the current process is running as regular user, or * in any case under Windows. */ -bool sysinfo_is_superuser(void) +static bool sysinfo_is_superuser(void) { #ifndef _WIN32 if (geteuid() == 0) @@ -996,7 +996,7 @@ bool sysinfo_is_superuser(void) /** * Interface runtime initialization. */ -void sysinfo_init(void) +static void sysinfo_init(void) { sysinfo->p->compiler = SYSINFO_COMPILER; #ifdef WIN32 @@ -1023,7 +1023,7 @@ void sysinfo_init(void) /** * Interface shutdown cleanup. */ -void sysinfo_final(void) +static void sysinfo_final(void) { #ifdef WIN32 // Only need to be free'd in win32, they're #defined elsewhere |