Rename "BLI_cpu.h" to "BLI_system.h" and add to it BLI_getpid() helper.
authorBastien Montagne <montagne29@wanadoo.fr>
Wed, 2 Apr 2014 09:43:54 +0000 (11:43 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Wed, 2 Apr 2014 09:59:43 +0000 (11:59 +0200)
There is not much sense to have a whole BLI file just to check SSE2 on CPUs...
So idea is to rename it to more generic "BLI_system", and add to it more system-related
utils, like e.g. an include helper for getpid(), which allows to hide unix/windows
internals from rest of the code...

Reviewers: campbellbarton

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D439

source/blender/blenkernel/intern/pointcache.c
source/blender/blenlib/BLI_system.h [moved from source/blender/blenlib/BLI_cpu.h with 80% similarity]
source/blender/blenlib/CMakeLists.txt
source/blender/blenlib/intern/system.c [moved from source/blender/blenlib/intern/cpu.c with 91% similarity]
source/blender/blenloader/intern/writefile.c
source/blender/imbuf/intern/thumbs.c
source/blender/render/intern/source/rayshade.c
source/blender/windowmanager/intern/wm_files.c
source/creator/creator.c

index 20107aa41a8fc644c0a69f0675d374150951e4a1..7458b4a4fa06c5d7463f2bc85cb7a58d5a25903c 100644 (file)
@@ -51,6 +51,8 @@
 #include "BLI_threads.h"
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
+#include "BLI_system.h"
+#include BLI_SYSTEM_PID_H
 
 #include "BLF_translation.h"
 
 /* untitled blend's need getpid for a unique name */
 #ifndef WIN32
 #  include <dirent.h>
-#  include <unistd.h>
 #else
-#  include <process.h>
 #  include "BLI_winstuff.h"
 #endif
 
similarity index 80%
rename from source/blender/blenlib/BLI_cpu.h
rename to source/blender/blenlib/BLI_system.h
index fa29162e59e1a70a9cf9ebab6f6e9c66f0bb3ed2..8cdc9e4e6c58ce33053f0d51e56ec17d447cde15 100644 (file)
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef __BLI_CPU_H__
-#define __BLI_CPU_H__ 
+#ifndef __BLI_SYSTEM_H__
+#define __BLI_SYSTEM_H__
 
-/** \file BLI_cpu.h
+/** \file BLI_system.h
  *  \ingroup bli
  */
 
 int BLI_cpu_support_sse2(void);
 
+/* getpid */
+#ifdef WIN32
+#  define BLI_SYSTEM_PID_H <process.h>
+#else
+#  define BLI_SYSTEM_PID_H <unistd.h>
 #endif
 
+#endif  /* __BLI_SYSTEM_H__ */
+
index 491f988642bfbe85d2040245a079a9383f9b72af..205935f3d14d33afd391b978c9ecc52682b825b3 100644 (file)
@@ -55,7 +55,6 @@ set(SRC
        intern/buffer.c
        intern/callbacks.c
        intern/convexhull2d.c
-       intern/cpu.c
        intern/dynlib.c
        intern/easing.c
        intern/edgehash.c
@@ -97,6 +96,7 @@ set(SRC
        intern/string.c
        intern/string_cursor_utf8.c
        intern/string_utf8.c
+       intern/system.c
        intern/task.c
        intern/threads.c
        intern/time.c
@@ -117,7 +117,6 @@ set(SRC
        BLI_callbacks.h
        BLI_compiler_attrs.h
        BLI_convexhull2d.h
-       BLI_cpu.h
        BLI_dlrbTree.h
        BLI_dynlib.h
        BLI_dynstr.h
@@ -168,6 +167,7 @@ set(SRC
        BLI_string_cursor_utf8.h
        BLI_string_utf8.h
        BLI_sys_types.h
+       BLI_system.h
        BLI_task.h
        BLI_threads.h
        BLI_timecode.h
similarity index 91%
rename from source/blender/blenlib/intern/cpu.c
rename to source/blender/blenlib/intern/system.c
index 784b19007852ccd47f31f04bcd4d74405fe25476..e6389bc68f3159c072de54b05a752805a7b92436 100644 (file)
@@ -4,7 +4,7 @@
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. 
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/blenlib/intern/cpu.c
+/** \file blender/blenlib/intern/system.c
  *  \ingroup bli
  */
 
 
-#include "BLI_cpu.h"
+#include "BLI_system.h"
 
 int BLI_cpu_support_sse2(void)
 {
index ffd1d6d1be1354852093a9f6c5a33df58d2d48d5..6c4fac6064622a8717543340dc06514a5b2f70a1 100644 (file)
 
 #include "zlib.h"
 
-#ifndef WIN32
-#  include <unistd.h>
-#else
+#ifdef WIN32
 #  include "winsock2.h"
 #  include <io.h>
-#  include <process.h> // for getpid
 #  include "BLI_winstuff.h"
 #endif
 
index 18268043a04863b5bdc004d4911d5a59ff722029..843134a4289741f46d9e8296d8b3cfb35b818743 100644 (file)
@@ -39,6 +39,8 @@
 #include "BLI_path_util.h"
 #include "BLI_fileops.h"
 #include "BLI_md5.h"
+#include "BLI_system.h"
+#include BLI_SYSTEM_PID_H
 
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
 #  endif
 #  include <shlobj.h>  /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff
                         * because 'near' is disabled through BLI_windstuff */
-#  include <process.h> /* getpid */
 #  include <direct.h> /* chdir */
 #  include "BLI_winstuff.h"
 #  include "utfconv.h"
-#else
-#  include <unistd.h>
 #endif
 
 #define URI_MAX (FILE_MAX * 3 + 8)
index 60327c7db8df1c1ab567c54f9c62edef0de2b2d0..7e6fd04c3f49b2eeed261dad8e473a226cf26823 100644 (file)
@@ -41,7 +41,7 @@
 #include "DNA_lamp_types.h"
 
 #include "BLI_blenlib.h"
-#include "BLI_cpu.h"
+#include "BLI_system.h"
 #include "BLI_math.h"
 #include "BLI_rand.h"
 #include "BLI_utildefines.h"
index 952fb42d607d42c52f1daa8696ee9cbff43b7530..850e4e13b75c1e922ddbffa4029c1c90efe46ef8 100644 (file)
 #  endif
 #  include <shlobj.h>  /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff
                         * because 'near' is disabled through BLI_windstuff */
-#  include <process.h> /* getpid */
 #  include "BLI_winstuff.h"
-#else
-#  include <unistd.h> /* getpid */
 #endif
 
 #include "MEM_guardedalloc.h"
@@ -60,6 +57,8 @@
 #include "BLI_utildefines.h"
 #include "BLI_threads.h"
 #include "BLI_callbacks.h"
+#include "BLI_system.h"
+#include BLI_SYSTEM_PID_H
 
 #include "BLF_translation.h"
 
index b74c64fa6b8044cf9ed0086ba4645f3fab808af4..de320386bf8726861709dcd9ba7544eaa57cbf14 100644 (file)
 #  include <xmmintrin.h>
 #endif
 
-/* crash handler */
-#ifdef WIN32
-#  include <process.h> /* getpid */
-#else
-#  include <unistd.h> /* getpid */
-#endif
-
 #ifdef WIN32
 #  include <windows.h>
 #  include "utfconv.h"
@@ -79,6 +72,8 @@
 #include "BLI_callbacks.h"
 #include "BLI_blenlib.h"
 #include "BLI_mempool.h"
+#include "BLI_system.h"
+#include BLI_SYSTEM_PID_H
 
 #include "DNA_ID.h"
 #include "DNA_scene_types.h"