[arrayfire] 63/84: __AF_FILENAME__ returns path from src

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Jan 4 23:22:26 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository arrayfire.

commit ff8326722228fd6663f32e5f8a6b19ce834677fc
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Tue Dec 29 13:29:30 2015 -0500

    __AF_FILENAME__ returns path from src
---
 src/backend/defines.hpp | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/backend/defines.hpp b/src/backend/defines.hpp
index 7445752..a878dff 100644
--- a/src/backend/defines.hpp
+++ b/src/backend/defines.hpp
@@ -9,19 +9,31 @@
 
 #pragma once
 
-#include <string.h>
+#include <string>
+
+inline std::string
+clipFilePath(std::string path, std::string str)
+{
+    std::string::size_type pos = path.rfind(str);
+    if(pos == std::string::npos) {
+        return path;
+    } else {
+        return path.substr(pos);
+    }
+}
+
 #if defined(_WIN32) || defined(_MSC_VER)
     #define __PRETTY_FUNCTION__ __FUNCSIG__
     #if _MSC_VER < 1900
         #define snprintf sprintf_s
     #endif
     #define STATIC_ static
-    #define __AF_FILENAME__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
+    #define __AF_FILENAME__ (clipFilePath(__FILE__, "src\\").c_str())
 #else
     //#ifndef __PRETTY_FUNCTION__
     //    #define __PRETTY_FUNCTION__ __func__ // __PRETTY_FUNCTION__ Fallback
     //#endif
     #define STATIC_ inline
-    #define __AF_FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
+    #define __AF_FILENAME__ (clipFilePath(__FILE__, "src/").c_str())
 #endif
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list