[Bf-blender-cvs] [35747ee] master: Rename "BLI_cpu.h" to "BLI_system.h" and add to it BLI_getpid() helper.

Bastien Montagne noreply at git.blender.org
Wed Apr 2 12:09:21 CEST 2014


Commit: 35747ee3d54765a05d7594ee52fdcd564464b18f
Author: Bastien Montagne
Date:   Wed Apr 2 11:43:54 2014 +0200
https://developer.blender.org/rB35747ee3d54765a05d7594ee52fdcd564464b18f

Rename "BLI_cpu.h" to "BLI_system.h" and add to it BLI_getpid() helper.

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

===================================================================

M	source/blender/blenkernel/intern/pointcache.c
D	source/blender/blenlib/BLI_cpu.h
A	source/blender/blenlib/BLI_system.h
M	source/blender/blenlib/CMakeLists.txt
D	source/blender/blenlib/intern/cpu.c
A	source/blender/blenlib/intern/system.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/imbuf/intern/thumbs.c
M	source/blender/render/intern/source/rayshade.c
M	source/blender/windowmanager/intern/wm_files.c
M	source/creator/creator.c

===================================================================

diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 20107aa..7458b4a 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -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"
 
@@ -100,9 +102,7 @@
 /* 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
 
diff --git a/source/blender/blenlib/BLI_cpu.h b/source/blender/blenlib/BLI_system.h
similarity index 80%
rename from source/blender/blenlib/BLI_cpu.h
rename to source/blender/blenlib/BLI_system.h
index fa29162..8cdc9e4 100644
--- a/source/blender/blenlib/BLI_cpu.h
+++ b/source/blender/blenlib/BLI_system.h
@@ -18,14 +18,21 @@
  * ***** 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__ */
+
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index 491f988..205935f 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -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
diff --git a/source/blender/blenlib/intern/cpu.c b/source/blender/blenlib/intern/system.c
similarity index 91%
rename from source/blender/blenlib/intern/cpu.c
rename to source/blender/blenlib/intern/system.c
index 784b190..e6389bc 100644
--- a/source/blender/blenlib/intern/cpu.c
+++ b/source/blender/blenlib/intern/system.c
@@ -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
@@ -18,12 +18,12 @@
  * ***** 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)
 {
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index ffd1d6d..6c4fac6 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -81,12 +81,9 @@
 
 #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
 
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index 1826804..843134a 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -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"
@@ -59,12 +61,9 @@
 #  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)
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index 60327c7..7e6fd04 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -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"
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 952fb42..850e4e1 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -46,10 +46,7 @@
 #  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"
 
diff --git a/source/creator/creator.c b/source/creator/creator.c
index b74c64f..de32038 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -40,13 +40,6 @@
 #  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"




More information about the Bf-blender-cvs mailing list