From f9b3e513d2cb70831552e0e081514010c9a0356a Mon Sep 17 00:00:00 2001 From: Christian Forfang Date: Sat, 17 Nov 2012 20:46:48 +0100 Subject: [PATCH] Don't create std::string on glCheckError unless necessary. --- src/SFML/Graphics/GLCheck.cpp | 5 +++-- src/SFML/Graphics/GLCheck.hpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/SFML/Graphics/GLCheck.cpp b/src/SFML/Graphics/GLCheck.cpp index c991bccf8..bddaa5649 100644 --- a/src/SFML/Graphics/GLCheck.cpp +++ b/src/SFML/Graphics/GLCheck.cpp @@ -34,13 +34,14 @@ namespace sf namespace priv { //////////////////////////////////////////////////////////// -void glCheckError(const std::string& file, unsigned int line) +void glCheckError(const char* file, unsigned int line) { // Get the last error GLenum errorCode = glGetError(); if (errorCode != GL_NO_ERROR) { + std::string fileString(file); std::string error = "unknown error"; std::string description = "no description"; @@ -99,7 +100,7 @@ void glCheckError(const std::string& file, unsigned int line) // Log the error err() << "An internal OpenGL call failed in " - << file.substr(file.find_last_of("\\/") + 1) << " (" << line << ") : " + << fileString.substr(fileString.find_last_of("\\/") + 1) << " (" << line << ") : " << error << ", " << description << std::endl; } diff --git a/src/SFML/Graphics/GLCheck.hpp b/src/SFML/Graphics/GLCheck.hpp index 5dda7abb8..b1d5e0f5f 100644 --- a/src/SFML/Graphics/GLCheck.hpp +++ b/src/SFML/Graphics/GLCheck.hpp @@ -59,7 +59,7 @@ namespace priv /// \param line Line number of the source file where the call is located /// //////////////////////////////////////////////////////////// -void glCheckError(const std::string& file, unsigned int line); +void glCheckError(const char* file, unsigned int line); //////////////////////////////////////////////////////////// /// \brief Make sure that GLEW is initialized