From: jsteube Date: Fri, 8 Jul 2016 21:23:16 +0000 (+0200) Subject: Replace LINUX macro with compiler predefined macro __linux__ X-Git-Url: https://www.flypig.org.uk/git/?p=hashcat.git;a=commitdiff_plain;h=49f693a1c93a47ec80c4d7c68cb67f860188ed53 Replace LINUX macro with compiler predefined macro __linux__ --- diff --git a/docs/changes.txt b/docs/changes.txt index 9e84431..2c4818c 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -10,7 +10,8 @@ - The Time.Estimated attribute in status display should also show --runtime limit if user set it - Fix some strict aliasing rule violation on older compilers - Fix some variable initializers on older compilers -- Replace DARWIN macro with __APPLE__ +- Replace DARWIN macro with compiler predefined macro __APPLE__ +- Replace LINUX macro with compiler predefined macro __linux__ ## ## Bugs diff --git a/include/common.h b/include/common.h index 91cb370..c36a3e0 100644 --- a/include/common.h +++ b/include/common.h @@ -40,7 +40,7 @@ #include #include -#ifdef LINUX +#ifdef __linux__ #include #include #endif diff --git a/include/ext_OpenCL.h b/include/ext_OpenCL.h index c3598c9..5ba85f3 100644 --- a/include/ext_OpenCL.h +++ b/include/ext_OpenCL.h @@ -22,7 +22,7 @@ // #include // used for CL_DEVICE_TOPOLOGY_AMD but broken for dual GPU #endif -#ifdef LINUX +#ifdef __linux__ #include // #include // used for CL_DEVICE_TOPOLOGY_AMD but broken for dual GPU #endif diff --git a/src/Makefile b/src/Makefile index 6cd6684..1ec2b2d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -120,7 +120,7 @@ LFLAGS_NATIVE += $(LDFLAGS) endif # darwin ifeq ($(UNAME),Linux) -CFLAGS_NATIVE := -D_POSIX -DLINUX +CFLAGS_NATIVE := -D_POSIX ifndef DEBUG CFLAGS_NATIVE += -s endif @@ -141,7 +141,7 @@ endif # freebsd ## Cross compilation target ## -CFLAGS_CROSS_LINUX := -D_POSIX -DLINUX +CFLAGS_CROSS_LINUX := -D_POSIX ifndef DEBUG CFLAGS_CROSS_LINUX += -s endif diff --git a/src/ext_OpenCL.c b/src/ext_OpenCL.c index 9bbca71..cab332a 100644 --- a/src/ext_OpenCL.c +++ b/src/ext_OpenCL.c @@ -82,7 +82,7 @@ int ocl_init (OCL_PTR *ocl) log_info (""); log_info ("ATTENTION! Can't find OpenCL ICD loader library"); log_info (""); - #if defined (LINUX) + #ifdef __linux__ log_info ("You're probably missing the \"ocl-icd-libopencl1\" package (Debian/Ubuntu)"); log_info (" sudo apt-get install ocl-icd-libopencl1"); log_info (""); diff --git a/src/hashcat.c b/src/hashcat.c index 0049333..89076e4 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -4350,7 +4350,7 @@ static void *thread_monitor (void *p) hm_set_fanspeed_with_device_id_nvapi (device_id, fan_speed_new, 1); #endif - #ifdef LINUX + #ifdef __linux__ hm_set_fanspeed_with_device_id_xnvctrl (device_id, fan_speed_new); #endif } @@ -6179,7 +6179,7 @@ int main (int argc, char **argv) char *exec_path = get_exec_path (); - #if defined(LINUX) || defined(__APPLE__) || defined(__FreeBSD__) + #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) char *resolved_install_folder = realpath (INSTALL_FOLDER, NULL); char *resolved_exec_path = realpath (exec_path, NULL); @@ -14255,7 +14255,7 @@ int main (int argc, char **argv) { need_nvml = 1; - #ifdef LINUX + #ifdef __linux__ need_xnvctrl = 1; #endif @@ -16459,7 +16459,7 @@ int main (int argc, char **argv) } else if (device_param->device_vendor_id == VENDOR_ID_NV) { - #ifdef LINUX + #ifdef __linux__ rc = set_fan_control (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_TRUE); #endif @@ -18641,7 +18641,7 @@ int main (int argc, char **argv) } else if (device_param->device_vendor_id == VENDOR_ID_NV) { - #ifdef LINUX + #ifdef __linux__ rc = set_fan_control (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_FALSE); #endif diff --git a/src/shared.c b/src/shared.c index f4c76f9..f693122 100644 --- a/src/shared.c +++ b/src/shared.c @@ -2338,7 +2338,7 @@ void drupal7_encode (u8 digest[64], u8 buf[43]) * tty */ -#ifdef LINUX +#ifdef __linux__ static struct termios savemodes; static int havemodes = 0; @@ -4353,7 +4353,7 @@ char *get_exec_path () char *exec_path = (char *) mymalloc (exec_path_len); - #ifdef LINUX + #ifdef __linux__ char tmp[32] = { 0 }; @@ -4821,7 +4821,7 @@ int sort_by_dictstat (const void *s1, const void *s2) dictstat_t *d1 = (dictstat_t *) s1; dictstat_t *d2 = (dictstat_t *) s2; - #ifdef _LINUX + #ifdef __linux__ d2->stat.st_atim = d1->stat.st_atim; #else d2->stat.st_atime = d1->stat.st_atime;