From c20c1d6a6b3eb301db88ca3e74993f445cc4d839 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Fri, 17 Jun 2016 13:07:27 +0300 Subject: [core] Avoid redundant 'inline' usage --- include/mbgl/gl/gl.hpp | 4 +- include/mbgl/gl/gl_helper.hpp | 4 +- include/mbgl/gl/gl_values.hpp | 84 ++++++++++++------------- include/mbgl/map/camera.hpp | 4 +- include/mbgl/platform/log.hpp | 10 +-- include/mbgl/style/filter_evaluator.hpp | 2 +- include/mbgl/util/color.hpp | 6 +- include/mbgl/util/exception.hpp | 16 ++--- include/mbgl/util/projection.hpp | 6 +- include/mbgl/util/range.hpp | 4 +- platform/default/image.cpp | 2 +- platform/default/sqlite3.hpp | 4 +- platform/node/src/node_style_properties.hpp | 4 +- platform/node/src/node_style_properties.hpp.ejs | 4 +- src/mbgl/annotation/symbol_annotation_impl.hpp | 2 +- src/mbgl/geometry/buffer.hpp | 8 +-- src/mbgl/geometry/vao.hpp | 4 +- src/mbgl/renderer/bucket.hpp | 2 +- src/mbgl/renderer/fill_bucket.cpp | 4 +- src/mbgl/sprite/sprite_atlas.hpp | 16 ++--- src/mbgl/sprite/sprite_parser.cpp | 6 +- src/mbgl/style/property_evaluator.cpp | 44 ++++++------- src/mbgl/text/collision_feature.hpp | 4 +- src/mbgl/text/glyph.hpp | 10 +-- src/mbgl/text/placement_config.hpp | 6 +- src/mbgl/text/shaping.hpp | 4 +- src/mbgl/util/clip_id.hpp | 8 +-- src/mbgl/util/dtoa.cpp | 10 ++- src/mbgl/util/dtoa.hpp | 9 +-- src/mbgl/util/exclusive.hpp | 10 +-- src/mbgl/util/geo.cpp | 4 +- src/mbgl/util/io.hpp | 2 +- src/mbgl/util/math.hpp | 26 ++++---- src/mbgl/util/ptr.hpp | 6 +- src/mbgl/util/rect.hpp | 10 +-- src/mbgl/util/stopwatch.hpp | 12 ++-- src/mbgl/util/thread_local.hpp | 10 +-- 37 files changed, 186 insertions(+), 185 deletions(-) diff --git a/include/mbgl/gl/gl.hpp b/include/mbgl/gl/gl.hpp index 6d601d8a23..0f54b96110 100644 --- a/include/mbgl/gl/gl.hpp +++ b/include/mbgl/gl/gl.hpp @@ -60,14 +60,14 @@ namespace gl { #endif struct Error : ::std::runtime_error { - inline Error(GLenum err, const std::string &msg) : ::std::runtime_error(msg), code(err) {}; + Error(GLenum err, const std::string &msg) : ::std::runtime_error(msg), code(err) {}; const GLenum code; }; void checkError(const char *cmd, const char *file, int line); #if defined(DEBUG) -#define MBGL_CHECK_ERROR(cmd) ([&]() { struct __MBGL_C_E { inline ~__MBGL_C_E() { ::mbgl::gl::checkError(#cmd, __FILE__, __LINE__); } } __MBGL_C_E; return cmd; }()) +#define MBGL_CHECK_ERROR(cmd) ([&]() { struct __MBGL_C_E { ~__MBGL_C_E() { ::mbgl::gl::checkError(#cmd, __FILE__, __LINE__); } } __MBGL_C_E; return cmd; }()) #else #define MBGL_CHECK_ERROR(cmd) (cmd) #endif diff --git a/include/mbgl/gl/gl_helper.hpp b/include/mbgl/gl/gl_helper.hpp index 893c73e0c3..9d46d018c3 100644 --- a/include/mbgl/gl/gl_helper.hpp +++ b/include/mbgl/gl/gl_helper.hpp @@ -6,9 +6,9 @@ namespace gl { template class Preserve { public: - inline Preserve() : data(T::Get()) { + Preserve() : data(T::Get()) { } - inline ~Preserve() { + ~Preserve() { T::Set(data); } diff --git a/include/mbgl/gl/gl_values.hpp b/include/mbgl/gl/gl_values.hpp index 0d7d294cf7..03ae46a60e 100644 --- a/include/mbgl/gl/gl_values.hpp +++ b/include/mbgl/gl/gl_values.hpp @@ -13,10 +13,10 @@ namespace gl { struct ClearDepth { using Type = GLfloat; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(glClearDepth(value)); } - inline static Type Get() { + static Type Get() { Type clearDepth; MBGL_CHECK_ERROR(glGetFloatv(GL_DEPTH_CLEAR_VALUE, &clearDepth)); return clearDepth; @@ -26,10 +26,10 @@ struct ClearDepth { struct ClearColor { using Type = Color; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(glClearColor(value.r, value.g, value.b, value.a)); } - inline static Type Get() { + static Type Get() { GLfloat floats[4]; MBGL_CHECK_ERROR(glGetFloatv(GL_COLOR_CLEAR_VALUE, floats)); return { floats[0], floats[1], floats[2], floats[3] }; @@ -39,10 +39,10 @@ struct ClearColor { struct ClearStencil { using Type = GLint; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(glClearStencil(value)); } - inline static Type Get() { + static Type Get() { Type clearStencil; MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &clearStencil)); return clearStencil; @@ -52,10 +52,10 @@ struct ClearStencil { struct StencilMask { using Type = GLuint; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(glStencilMask(value)); } - inline static Type Get() { + static Type Get() { GLint stencilMask; MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_WRITEMASK, &stencilMask)); return stencilMask; @@ -65,10 +65,10 @@ struct StencilMask { struct DepthMask { using Type = GLboolean; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(glDepthMask(value)); } - inline static Type Get() { + static Type Get() { Type depthMask; MBGL_CHECK_ERROR(glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMask)); return depthMask; @@ -78,10 +78,10 @@ struct DepthMask { struct ColorMask { struct Type { bool r, g, b, a; }; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(glColorMask(value.r, value.g, value.b, value.a)); } - inline static Type Get() { + static Type Get() { GLboolean bools[4]; MBGL_CHECK_ERROR(glGetBooleanv(GL_COLOR_WRITEMASK, bools)); return { static_cast(bools[0]), static_cast(bools[1]), @@ -89,17 +89,17 @@ struct ColorMask { } }; -inline bool operator!=(const ColorMask::Type& a, const ColorMask::Type& b) { +constexpr bool operator!=(const ColorMask::Type& a, const ColorMask::Type& b) { return a.r != b.r || a.g != b.g || a.b != b.b || a.a != b.a; } struct StencilFunc { struct Type { GLenum func; GLint ref; GLuint mask; }; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(glStencilFunc(value.func, value.ref, value.mask)); } - inline static Type Get() { + static Type Get() { GLint func, ref, mask; MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_FUNC, &func)); MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_REF, &ref)); @@ -108,17 +108,17 @@ struct StencilFunc { } }; -inline bool operator!=(const StencilFunc::Type& a, const StencilFunc::Type& b) { +constexpr bool operator!=(const StencilFunc::Type& a, const StencilFunc::Type& b) { return a.func != b.func || a.ref != b.ref || a.mask != b.mask; } struct StencilTest { using Type = bool; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(value ? glEnable(GL_STENCIL_TEST) : glDisable(GL_STENCIL_TEST)); } - inline static Type Get() { + static Type Get() { Type stencilTest; MBGL_CHECK_ERROR(stencilTest = glIsEnabled(GL_STENCIL_TEST)); return stencilTest; @@ -128,10 +128,10 @@ struct StencilTest { struct StencilOp { struct Type { GLenum sfail, dpfail, dppass; }; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(glStencilOp(value.sfail, value.dpfail, value.dppass)); } - inline static Type Get() { + static Type Get() { GLint sfail, dpfail, dppass; MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_FAIL, &sfail)); MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, &dpfail)); @@ -143,27 +143,27 @@ struct StencilOp { struct DepthRange { struct Type { GLfloat near, far; }; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(glDepthRange(value.near, value.far)); } - inline static Type Get() { + static Type Get() { GLfloat floats[2]; MBGL_CHECK_ERROR(glGetFloatv(GL_DEPTH_RANGE, floats)); return { floats[0], floats[1] }; } }; -inline bool operator!=(const DepthRange::Type& a, const DepthRange::Type& b) { +constexpr bool operator!=(const DepthRange::Type& a, const DepthRange::Type& b) { return a.near != b.near || a.far != b.far; } struct DepthTest { using Type = bool; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(value ? glEnable(GL_DEPTH_TEST) : glDisable(GL_DEPTH_TEST)); } - inline static Type Get() { + static Type Get() { Type depthTest; MBGL_CHECK_ERROR(depthTest = glIsEnabled(GL_DEPTH_TEST)); return depthTest; @@ -173,10 +173,10 @@ struct DepthTest { struct DepthFunc { using Type = GLenum; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(glDepthFunc(value)); } - inline static Type Get() { + static Type Get() { GLint depthFunc; MBGL_CHECK_ERROR(glGetIntegerv(GL_DEPTH_FUNC, &depthFunc)); return depthFunc; @@ -186,10 +186,10 @@ struct DepthFunc { struct Blend { using Type = bool; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(value ? glEnable(GL_BLEND) : glDisable(GL_BLEND)); } - inline static Type Get() { + static Type Get() { Type blend; MBGL_CHECK_ERROR(blend = glIsEnabled(GL_BLEND)); return blend; @@ -199,10 +199,10 @@ struct Blend { struct BlendFunc { struct Type { GLenum sfactor, dfactor; }; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(glBlendFunc(value.sfactor, value.dfactor)); } - inline static Type Get() { + static Type Get() { GLint sfactor, dfactor; MBGL_CHECK_ERROR(glGetIntegerv(GL_BLEND_SRC_ALPHA, &sfactor)); MBGL_CHECK_ERROR(glGetIntegerv(GL_BLEND_DST_ALPHA, &dfactor)); @@ -213,10 +213,10 @@ struct BlendFunc { struct Program { using Type = GLuint; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(glUseProgram(value)); } - inline static Type Get() { + static Type Get() { GLint program; MBGL_CHECK_ERROR(glGetIntegerv(GL_CURRENT_PROGRAM, &program)); return program; @@ -226,10 +226,10 @@ struct Program { struct LineWidth { using Type = GLfloat; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(glLineWidth(value)); } - inline static Type Get() { + static Type Get() { Type lineWidth; MBGL_CHECK_ERROR(glGetFloatv(GL_LINE_WIDTH, &lineWidth)); return lineWidth; @@ -239,10 +239,10 @@ struct LineWidth { struct ActiveTexture { using Type = GLint; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(glActiveTexture(value)); } - inline static Type Get() { + static Type Get() { Type activeTexture; MBGL_CHECK_ERROR(glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTexture)); return activeTexture; @@ -254,10 +254,10 @@ struct ActiveTexture { struct PixelZoom { struct Type { GLfloat xfactor; GLfloat yfactor; }; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(glPixelZoom(value.xfactor, value.yfactor)); } - inline static Type Get() { + static Type Get() { Type value; MBGL_CHECK_ERROR(glGetFloatv(GL_ZOOM_X, &value.xfactor)); MBGL_CHECK_ERROR(glGetFloatv(GL_ZOOM_Y, &value.yfactor)); @@ -265,17 +265,17 @@ struct PixelZoom { } }; -inline bool operator!=(const PixelZoom::Type& a, const PixelZoom::Type& b) { +constexpr bool operator!=(const PixelZoom::Type& a, const PixelZoom::Type& b) { return a.xfactor != b.xfactor || a.yfactor != b.yfactor; } struct RasterPos { using Type = std::array; static const Type Default; - inline static void Set(const Type& value) { + static void Set(const Type& value) { MBGL_CHECK_ERROR(glRasterPos4d(value[0], value[1], value[2], value[3])); } - inline static Type Get() { + static Type Get() { Type pos; MBGL_CHECK_ERROR(glGetDoublev(GL_CURRENT_RASTER_POSITION, pos.data())); return pos; diff --git a/include/mbgl/map/camera.hpp b/include/mbgl/map/camera.hpp index 4520321655..3f39ca2dc9 100644 --- a/include/mbgl/map/camera.hpp +++ b/include/mbgl/map/camera.hpp @@ -67,10 +67,10 @@ struct AnimationOptions { std::function transitionFinishFn; /** Creates an animation with no options specified. */ - inline AnimationOptions() {} + AnimationOptions() {} /** Creates an animation with the specified duration. */ - inline AnimationOptions(Duration d) + AnimationOptions(Duration d) : duration(d) {} }; diff --git a/include/mbgl/platform/log.hpp b/include/mbgl/platform/log.hpp index 48b9e3dc70..d5bb1c2fcc 100644 --- a/include/mbgl/platform/log.hpp +++ b/include/mbgl/platform/log.hpp @@ -37,27 +37,27 @@ private: public: template - static inline void Debug(Event event, Args&& ...args) { + static void Debug(Event event, Args&& ...args) { Record(EventSeverity::Debug, event, ::std::forward(args)...); } template - static inline void Info(Event event, Args&& ...args) { + static void Info(Event event, Args&& ...args) { Record(EventSeverity::Info, event, ::std::forward(args)...); } template - static inline void Warning(Event event, Args&& ...args) { + static void Warning(Event event, Args&& ...args) { Record(EventSeverity::Warning, event, ::std::forward(args)...); } template - static inline void Error(Event event, Args&& ...args) { + static void Error(Event event, Args&& ...args) { Record(EventSeverity::Error, event, ::std::forward(args)...); } template - static inline void Record(EventSeverity severity, Event event, Args&& ...args) { + static void Record(EventSeverity severity, Event event, Args&& ...args) { if (!includes(severity, disabledEventSeverities) && !includes(event, disabledEvents) && !includes({ severity, event }, disabledEventPermutations)) { diff --git a/include/mbgl/style/filter_evaluator.hpp b/include/mbgl/style/filter_evaluator.hpp index a458a2807b..e7b6e0f5a0 100644 --- a/include/mbgl/style/filter_evaluator.hpp +++ b/include/mbgl/style/filter_evaluator.hpp @@ -173,7 +173,7 @@ private: }; template -inline bool Filter::operator()(FeatureType type, PropertyAccessor accessor) const { +bool Filter::operator()(FeatureType type, PropertyAccessor accessor) const { return FilterBase::visit(*this, FilterEvaluator { type, accessor }); } diff --git a/include/mbgl/util/color.hpp b/include/mbgl/util/color.hpp index 6491f75801..4be380fde3 100644 --- a/include/mbgl/util/color.hpp +++ b/include/mbgl/util/color.hpp @@ -20,15 +20,15 @@ public: static optional parse(const std::string&); }; -inline bool operator==(const Color& colorA, const Color& colorB) { +constexpr bool operator==(const Color& colorA, const Color& colorB) { return colorA.r == colorB.r && colorA.g == colorB.g && colorA.b == colorB.b && colorA.a == colorB.a; } -inline bool operator!=(const Color& colorA, const Color& colorB) { +constexpr bool operator!=(const Color& colorA, const Color& colorB) { return !(colorA == colorB); } -inline Color operator*(const Color& color, float alpha) { +constexpr Color operator*(const Color& color, float alpha) { return { color.r * alpha, color.g * alpha, diff --git a/include/mbgl/util/exception.hpp b/include/mbgl/util/exception.hpp index b73a94fcd2..7c331636d4 100644 --- a/include/mbgl/util/exception.hpp +++ b/include/mbgl/util/exception.hpp @@ -6,23 +6,23 @@ namespace mbgl { namespace util { struct Exception : std::runtime_error { - inline Exception(const char *msg) : std::runtime_error(msg) {} - inline Exception(const std::string &msg) : std::runtime_error(msg) {} + Exception(const char *msg) : std::runtime_error(msg) {} + Exception(const std::string &msg) : std::runtime_error(msg) {} }; struct SpriteImageException : Exception { - inline SpriteImageException(const char *msg) : Exception(msg) {} - inline SpriteImageException(const std::string &msg) : Exception(msg) {} + SpriteImageException(const char *msg) : Exception(msg) {} + SpriteImageException(const std::string &msg) : Exception(msg) {} }; struct MisuseException : Exception { - inline MisuseException(const char *msg) : Exception(msg) {} - inline MisuseException(const std::string &msg) : Exception(msg) {} + MisuseException(const char *msg) : Exception(msg) {} + MisuseException(const std::string &msg) : Exception(msg) {} }; struct ShaderException : Exception { - inline ShaderException(const char *msg) : Exception(msg) {} - inline ShaderException(const std::string &msg) : Exception(msg) {} + ShaderException(const char *msg) : Exception(msg) {} + ShaderException(const std::string &msg) : Exception(msg) {} }; } // namespace util diff --git a/include/mbgl/util/projection.hpp b/include/mbgl/util/projection.hpp index 76c60f5cd8..eb45088580 100644 --- a/include/mbgl/util/projection.hpp +++ b/include/mbgl/util/projection.hpp @@ -11,14 +11,14 @@ namespace mbgl { class Projection { public: - static inline double getMetersPerPixelAtLatitude(double lat, double zoom) { + static double getMetersPerPixelAtLatitude(double lat, double zoom) { const double constrainedZoom = util::clamp(zoom, util::MIN_ZOOM, util::MAX_ZOOM); const double mapPixelWidthAtZoom = std::pow(2.0, constrainedZoom) * util::tileSize; const double constrainedLatitude = util::clamp(lat, -util::LATITUDE_MAX, util::LATITUDE_MAX); return std::cos(constrainedLatitude * util::DEG2RAD) * util::M2PI * util::EARTH_RADIUS_M / mapPixelWidthAtZoom; } - static inline ProjectedMeters projectedMetersForLatLng(const LatLng& latLng) { + static ProjectedMeters projectedMetersForLatLng(const LatLng& latLng) { const double constrainedLatitude = util::clamp(latLng.latitude, -util::LATITUDE_MAX, util::LATITUDE_MAX); const double constrainedLongitude = util::clamp(latLng.longitude, -util::LONGITUDE_MAX, util::LONGITUDE_MAX); @@ -31,7 +31,7 @@ public: return ProjectedMeters(northing, easting); } - static inline LatLng latLngForProjectedMeters(const ProjectedMeters& projectedMeters) { + static LatLng latLngForProjectedMeters(const ProjectedMeters& projectedMeters) { double latitude = (2 * std::atan(std::exp(projectedMeters.northing / util::EARTH_RADIUS_M)) - (M_PI / 2)) * util::RAD2DEG; double longitude = projectedMeters.easting * util::RAD2DEG / util::EARTH_RADIUS_M; diff --git a/include/mbgl/util/range.hpp b/include/mbgl/util/range.hpp index d04164afb7..8da2dd45bb 100644 --- a/include/mbgl/util/range.hpp +++ b/include/mbgl/util/range.hpp @@ -13,12 +13,12 @@ public: }; template -inline bool operator==(const Range& a, const Range& b) { +bool operator==(const Range& a, const Range& b) { return a.min == b.min && a.max == b.max; } template -inline bool operator!=(const Range& a, const Range& b) { +bool operator!=(const Range& a, const Range& b) { return !(a == b); } diff --git a/platform/default/image.cpp b/platform/default/image.cpp index d4e42d8a1b..890d442683 100644 --- a/platform/default/image.cpp +++ b/platform/default/image.cpp @@ -5,7 +5,7 @@ #include template -inline static std::string sprintf(const char *msg, Args... args) { +static std::string sprintf(const char *msg, Args... args) { char res[max]; int len = snprintf(res, sizeof(res), msg, args...); return std::string(res, len); diff --git a/platform/default/sqlite3.hpp b/platform/default/sqlite3.hpp index 57ee18e9f3..cdc6f87380 100644 --- a/platform/default/sqlite3.hpp +++ b/platform/default/sqlite3.hpp @@ -22,8 +22,8 @@ enum OpenFlag : int { }; struct Exception : std::runtime_error { - inline Exception(int err, const char *msg) : std::runtime_error(msg), code(err) {} - inline Exception(int err, const std::string& msg) : std::runtime_error(msg), code(err) {} + Exception(int err, const char *msg) : std::runtime_error(msg), code(err) {} + Exception(int err, const std::string& msg) : std::runtime_error(msg), code(err) {} const int code = 0; }; diff --git a/platform/node/src/node_style_properties.hpp b/platform/node/src/node_style_properties.hpp index 88142f8e1f..2b0f233d73 100644 --- a/platform/node/src/node_style_properties.hpp +++ b/platform/node/src/node_style_properties.hpp @@ -9,7 +9,7 @@ namespace node_mbgl { -inline PropertySetters makeLayoutPropertySetters() { +PropertySetters makeLayoutPropertySetters() { using namespace mbgl::style; PropertySetters result; @@ -60,7 +60,7 @@ inline PropertySetters makeLayoutPropertySetters() { return result; } -inline PropertySetters makePaintPropertySetters() { +PropertySetters makePaintPropertySetters() { using namespace mbgl::style; PropertySetters result; diff --git a/platform/node/src/node_style_properties.hpp.ejs b/platform/node/src/node_style_properties.hpp.ejs index 1937421fa5..1b7fc49d8d 100644 --- a/platform/node/src/node_style_properties.hpp.ejs +++ b/platform/node/src/node_style_properties.hpp.ejs @@ -6,7 +6,7 @@ namespace node_mbgl { -inline PropertySetters makeLayoutPropertySetters() { +PropertySetters makeLayoutPropertySetters() { using namespace mbgl::style; PropertySetters result; @@ -19,7 +19,7 @@ inline PropertySetters makeLayoutPropertySetters() { return result; } -inline PropertySetters makePaintPropertySetters() { +PropertySetters makePaintPropertySetters() { using namespace mbgl::style; PropertySetters result; diff --git a/src/mbgl/annotation/symbol_annotation_impl.hpp b/src/mbgl/annotation/symbol_annotation_impl.hpp index 48ab321500..2e98f2414c 100644 --- a/src/mbgl/annotation/symbol_annotation_impl.hpp +++ b/src/mbgl/annotation/symbol_annotation_impl.hpp @@ -55,7 +55,7 @@ namespace index { template <> struct indexable> { using result_type = mbgl::LatLng; - inline mbgl::LatLng operator()(const std::shared_ptr& v) const { + mbgl::LatLng operator()(const std::shared_ptr& v) const { const mbgl::Point& p = v->annotation.geometry; return mbgl::LatLng(p.y, p.x); } diff --git a/src/mbgl/geometry/buffer.hpp b/src/mbgl/geometry/buffer.hpp index 6465b6f8e3..d372a040bf 100644 --- a/src/mbgl/geometry/buffer.hpp +++ b/src/mbgl/geometry/buffer.hpp @@ -27,11 +27,11 @@ public: // Returns the number of elements in this buffer. This is not the number of // bytes, but rather the number of coordinates with associated information. - inline GLsizei index() const { + GLsizei index() const { return static_cast(pos / itemSize); } - inline bool empty() const { + bool empty() const { return pos == 0; } @@ -65,7 +65,7 @@ public: } // Uploads the buffer to the GPU to be available when we need it. - inline void upload(gl::ObjectStore& store) { + void upload(gl::ObjectStore& store) { if (!buffer) { bind(store); } @@ -73,7 +73,7 @@ public: protected: // increase the buffer size by at least /required/ bytes. - inline void *addElement() { + void *addElement() { if (buffer) { throw std::runtime_error("Can't add elements after buffer was bound to GPU"); } diff --git a/src/mbgl/geometry/vao.hpp b/src/mbgl/geometry/vao.hpp index 93489fcc7b..6821be182a 100644 --- a/src/mbgl/geometry/vao.hpp +++ b/src/mbgl/geometry/vao.hpp @@ -20,7 +20,7 @@ public: ~VertexArrayObject(); template - inline void bind(Shader& shader, VertexBuffer &vertexBuffer, GLbyte *offset, gl::ObjectStore& store) { + void bind(Shader& shader, VertexBuffer &vertexBuffer, GLbyte *offset, gl::ObjectStore& store) { bindVertexArrayObject(store); if (bound_shader == 0) { vertexBuffer.bind(store); @@ -34,7 +34,7 @@ public: } template - inline void bind(Shader& shader, VertexBuffer &vertexBuffer, ElementsBuffer &elementsBuffer, GLbyte *offset, gl::ObjectStore& store) { + void bind(Shader& shader, VertexBuffer &vertexBuffer, ElementsBuffer &elementsBuffer, GLbyte *offset, gl::ObjectStore& store) { bindVertexArrayObject(store); if (bound_shader == 0) { vertexBuffer.bind(store); diff --git a/src/mbgl/renderer/bucket.hpp b/src/mbgl/renderer/bucket.hpp index 510f22ed14..9c572113be 100644 --- a/src/mbgl/renderer/bucket.hpp +++ b/src/mbgl/renderer/bucket.hpp @@ -41,7 +41,7 @@ public: virtual bool needsClipping() const = 0; - inline bool needsUpload() const { + bool needsUpload() const { return !uploaded; } diff --git a/src/mbgl/renderer/fill_bucket.cpp b/src/mbgl/renderer/fill_bucket.cpp index df8b01c474..cd69f43375 100644 --- a/src/mbgl/renderer/fill_bucket.cpp +++ b/src/mbgl/renderer/fill_bucket.cpp @@ -15,11 +15,11 @@ namespace mapbox { namespace util { template <> struct nth<0, mbgl::GeometryCoordinate> { - inline static int64_t get(const mbgl::GeometryCoordinate& t) { return t.x; }; + static int64_t get(const mbgl::GeometryCoordinate& t) { return t.x; }; }; template <> struct nth<1, mbgl::GeometryCoordinate> { - inline static int64_t get(const mbgl::GeometryCoordinate& t) { return t.y; }; + static int64_t get(const mbgl::GeometryCoordinate& t) { return t.y; }; }; } // namespace util } // namespace mapbox diff --git a/src/mbgl/sprite/sprite_atlas.hpp b/src/mbgl/sprite/sprite_atlas.hpp index 5d8e05a60c..4d1ee1c38c 100644 --- a/src/mbgl/sprite/sprite_atlas.hpp +++ b/src/mbgl/sprite/sprite_atlas.hpp @@ -56,14 +56,14 @@ public: // the texture is only bound when the data is out of date (=dirty). void upload(gl::ObjectStore&); - inline dimension getWidth() const { return width; } - inline dimension getHeight() const { return height; } - inline dimension getTextureWidth() const { return pixelWidth; } - inline dimension getTextureHeight() const { return pixelHeight; } - inline float getPixelRatio() const { return pixelRatio; } + dimension getWidth() const { return width; } + dimension getHeight() const { return height; } + dimension getTextureWidth() const { return pixelWidth; } + dimension getTextureHeight() const { return pixelHeight; } + float getPixelRatio() const { return pixelRatio; } // Only for use in tests. - inline const uint32_t* getData() const { return data.get(); } + const uint32_t* getData() const { return data.get(); } private: const GLsizei width, height; @@ -71,8 +71,8 @@ private: const float pixelRatio; struct Holder : private util::noncopyable { - inline Holder(std::shared_ptr, Rect); - inline Holder(Holder&&); + Holder(std::shared_ptr, Rect); + Holder(Holder&&); std::shared_ptr spriteImage; const Rect pos; }; diff --git a/src/mbgl/sprite/sprite_parser.cpp b/src/mbgl/sprite/sprite_parser.cpp index 9fbca51112..190ac66e14 100644 --- a/src/mbgl/sprite/sprite_parser.cpp +++ b/src/mbgl/sprite/sprite_parser.cpp @@ -46,7 +46,7 @@ SpriteImagePtr createSpriteImage(const PremultipliedImage& image, namespace { -inline uint16_t getUInt16(const JSValue& value, const char* name, const uint16_t def = 0) { +uint16_t getUInt16(const JSValue& value, const char* name, const uint16_t def = 0) { if (value.HasMember(name)) { auto& v = value[name]; if (v.IsUint() && v.GetUint() <= std::numeric_limits::max()) { @@ -60,7 +60,7 @@ inline uint16_t getUInt16(const JSValue& value, const char* name, const uint16_t return def; } -inline double getDouble(const JSValue& value, const char* name, const double def = 0) { +double getDouble(const JSValue& value, const char* name, const double def = 0) { if (value.HasMember(name)) { auto& v = value[name]; if (v.IsNumber()) { @@ -73,7 +73,7 @@ inline double getDouble(const JSValue& value, const char* name, const double def return def; } -inline bool getBoolean(const JSValue& value, const char* name, const bool def = false) { +bool getBoolean(const JSValue& value, const char* name, const bool def = false) { if (value.HasMember(name)) { auto& v = value[name]; if (v.IsBool()) { diff --git a/src/mbgl/style/property_evaluator.cpp b/src/mbgl/style/property_evaluator.cpp index 3394d69e41..fd31451d72 100644 --- a/src/mbgl/style/property_evaluator.cpp +++ b/src/mbgl/style/property_evaluator.cpp @@ -11,27 +11,27 @@ namespace mbgl { namespace style { template -inline T defaultStopsValue(); - -template <> inline bool defaultStopsValue() { return true; } -template <> inline float defaultStopsValue() { return 1.0f; } -template <> inline Color defaultStopsValue() { return { 0, 0, 0, 1 }; } -template <> inline std::vector defaultStopsValue() { return {{ 1, 0 }}; } -template <> inline std::vector defaultStopsValue() { return {{}}; } -template <> inline std::array defaultStopsValue() { return {{ 0, 0 }}; } -template <> inline std::array defaultStopsValue() { return {{ 0, 0, 0, 0 }}; } - -template <> inline std::string defaultStopsValue() { return {}; } -template <> inline TranslateAnchorType defaultStopsValue() { return {}; } -template <> inline RotateAnchorType defaultStopsValue() { return {}; } -template <> inline LineCapType defaultStopsValue() { return {}; } -template <> inline LineJoinType defaultStopsValue() { return {}; } -template <> inline SymbolPlacementType defaultStopsValue() { return {}; } -template <> inline TextAnchorType defaultStopsValue() { return {}; } -template <> inline TextJustifyType defaultStopsValue() { return {}; } -template <> inline TextTransformType defaultStopsValue() { return {}; } -template <> inline AlignmentType defaultStopsValue() { return {}; } -template <> inline IconTextFitType defaultStopsValue() { return {}; }; +T defaultStopsValue(); + +template <> bool defaultStopsValue() { return true; } +template <> float defaultStopsValue() { return 1.0f; } +template <> Color defaultStopsValue() { return { 0, 0, 0, 1 }; } +template <> std::vector defaultStopsValue() { return {{ 1, 0 }}; } +template <> std::vector defaultStopsValue() { return {{}}; } +template <> std::array defaultStopsValue() { return {{ 0, 0 }}; } +template <> std::array defaultStopsValue() { return {{ 0, 0, 0, 0 }}; } + +template <> std::string defaultStopsValue() { return {}; } +template <> TranslateAnchorType defaultStopsValue() { return {}; } +template <> RotateAnchorType defaultStopsValue() { return {}; } +template <> LineCapType defaultStopsValue() { return {}; } +template <> LineJoinType defaultStopsValue() { return {}; } +template <> SymbolPlacementType defaultStopsValue() { return {}; } +template <> TextAnchorType defaultStopsValue() { return {}; } +template <> TextJustifyType defaultStopsValue() { return {}; } +template <> TextTransformType defaultStopsValue() { return {}; } +template <> AlignmentType defaultStopsValue() { return {}; } +template <> IconTextFitType defaultStopsValue() { return {}; }; template T PropertyEvaluator::operator()(const Function& fn) const { @@ -114,7 +114,7 @@ Faded CrossFadedPropertyEvaluator::operator()(const T& constant) const { } template -inline T getBiggestStopLessThan(const Function& function, float z) { +T getBiggestStopLessThan(const Function& function, float z) { const auto& stops = function.getStops(); for (uint32_t i = 0; i < stops.size(); i++) { if (stops[i].first > z) { diff --git a/src/mbgl/text/collision_feature.hpp b/src/mbgl/text/collision_feature.hpp index f0bb0f7340..5c0095bc6d 100644 --- a/src/mbgl/text/collision_feature.hpp +++ b/src/mbgl/text/collision_feature.hpp @@ -33,7 +33,7 @@ namespace mbgl { class CollisionFeature { public: // for text - inline explicit CollisionFeature(const GeometryCoordinates &line, const Anchor &anchor, + explicit CollisionFeature(const GeometryCoordinates &line, const Anchor &anchor, const Shaping &shapedText, const float boxScale, const float padding, const bool alongLine, const IndexedSubfeature& indexedFeature_) : CollisionFeature(line, anchor, @@ -41,7 +41,7 @@ namespace mbgl { boxScale, padding, alongLine, indexedFeature_, false) {} // for icons - inline explicit CollisionFeature(const GeometryCoordinates &line, const Anchor &anchor, + explicit CollisionFeature(const GeometryCoordinates &line, const Anchor &anchor, const PositionedIcon &shapedIcon, const float boxScale, const float padding, const bool alongLine, const IndexedSubfeature& indexedFeature_) : CollisionFeature(line, anchor, diff --git a/src/mbgl/text/glyph.hpp b/src/mbgl/text/glyph.hpp index ce07b1b3fd..975dc4ad23 100644 --- a/src/mbgl/text/glyph.hpp +++ b/src/mbgl/text/glyph.hpp @@ -28,8 +28,8 @@ struct GlyphMetrics { }; struct Glyph { - inline explicit Glyph() : rect(0, 0, 0, 0), metrics() {} - inline explicit Glyph(Rect rect_, GlyphMetrics metrics_) + explicit Glyph() : rect(0, 0, 0, 0), metrics() {} + explicit Glyph(Rect rect_, GlyphMetrics metrics_) : rect(std::move(rect_)), metrics(std::move(metrics_)) {} operator bool() const { @@ -44,7 +44,7 @@ typedef std::map GlyphPositions; class PositionedGlyph { public: - inline explicit PositionedGlyph(uint32_t glyph_, float x_, float y_) + explicit PositionedGlyph(uint32_t glyph_, float x_, float y_) : glyph(glyph_), x(x_), y(y_) {} uint32_t glyph = 0; @@ -54,8 +54,8 @@ public: class Shaping { public: - inline explicit Shaping() : top(0), bottom(0), left(0), right(0) {} - inline explicit Shaping(float x, float y, std::u32string text_) + explicit Shaping() : top(0), bottom(0), left(0), right(0) {} + explicit Shaping(float x, float y, std::u32string text_) : text(std::move(text_)), top(y), bottom(y), left(x), right(x) {} std::vector positionedGlyphs; std::u32string text; diff --git a/src/mbgl/text/placement_config.hpp b/src/mbgl/text/placement_config.hpp index 75345b89e8..7e61cabc24 100644 --- a/src/mbgl/text/placement_config.hpp +++ b/src/mbgl/text/placement_config.hpp @@ -4,15 +4,15 @@ namespace mbgl { class PlacementConfig { public: - inline PlacementConfig(float angle_ = 0, float pitch_ = 0, bool debug_ = false) + PlacementConfig(float angle_ = 0, float pitch_ = 0, bool debug_ = false) : angle(angle_), pitch(pitch_), debug(debug_) { } - inline bool operator==(const PlacementConfig& rhs) const { + bool operator==(const PlacementConfig& rhs) const { return angle == rhs.angle && pitch == rhs.pitch && debug == rhs.debug; } - inline bool operator!=(const PlacementConfig& rhs) const { + bool operator!=(const PlacementConfig& rhs) const { return !operator==(rhs); } diff --git a/src/mbgl/text/shaping.hpp b/src/mbgl/text/shaping.hpp index c33b3788d5..cd5e8105fd 100644 --- a/src/mbgl/text/shaping.hpp +++ b/src/mbgl/text/shaping.hpp @@ -15,8 +15,8 @@ class SymbolLayoutProperties; class PositionedIcon { public: - inline explicit PositionedIcon() {} - inline explicit PositionedIcon(const SpriteAtlasElement& _image, + explicit PositionedIcon() {} + explicit PositionedIcon(const SpriteAtlasElement& _image, float _top, float _bottom, float _left, float _right) : image(_image), top(_top), bottom(_bottom), left(_left), right(_right) {} diff --git a/src/mbgl/util/clip_id.hpp b/src/mbgl/util/clip_id.hpp index e68f21e741..de2dc51919 100644 --- a/src/mbgl/util/clip_id.hpp +++ b/src/mbgl/util/clip_id.hpp @@ -12,17 +12,17 @@ namespace mbgl { struct ClipID { - inline ClipID() {} - inline ClipID(const std::string &mask_, const std::string &reference_) : mask(mask_), reference(reference_) {} + ClipID() {} + ClipID(const std::string &mask_, const std::string &reference_) : mask(mask_), reference(reference_) {} std::bitset<8> mask; std::bitset<8> reference; - inline bool operator==(const ClipID &other) const { + bool operator==(const ClipID &other) const { return mask == other.mask && reference == other.reference; } - inline ClipID& operator|=(const ClipID &other) { + ClipID& operator|=(const ClipID &other) { mask |= other.mask; reference |= other.reference; return *this; diff --git a/src/mbgl/util/dtoa.cpp b/src/mbgl/util/dtoa.cpp index 7ccee345f6..dd4fba0f89 100644 --- a/src/mbgl/util/dtoa.cpp +++ b/src/mbgl/util/dtoa.cpp @@ -9,7 +9,7 @@ namespace { // From https://github.com/miloyip/rapidjson/blob/master/include/rapidjson/internal/dtoa.h -inline char* Prettify(char* buffer, int length, int k) { +char* Prettify(char* buffer, int length, int k) { constexpr int maxDecimalPlaces = 324; const int kk = length + k; // 10^(kk-1) <= v < 10^kk @@ -93,5 +93,13 @@ char* dtoa(double value, char* buffer) { } } +std::string dtoa(double value) { + std::string data; + data.resize(25); + auto end = dtoa(value, const_cast(data.data())); + data.resize(end - data.data()); + return data; +} + } // namespace util } // namespace mbgl diff --git a/src/mbgl/util/dtoa.hpp b/src/mbgl/util/dtoa.hpp index 17614732db..db7d309452 100644 --- a/src/mbgl/util/dtoa.hpp +++ b/src/mbgl/util/dtoa.hpp @@ -6,14 +6,7 @@ namespace mbgl { namespace util { char* dtoa(double value, char* buffer); - -inline std::string dtoa(double value) { - std::string data; - data.resize(25); - auto end = dtoa(value, const_cast(data.data())); - data.resize(end - data.data()); - return data; -} +std::string dtoa(double value); } // end namespace util } // end namespace mbgl diff --git a/src/mbgl/util/exclusive.hpp b/src/mbgl/util/exclusive.hpp index 946604af69..844588dc90 100644 --- a/src/mbgl/util/exclusive.hpp +++ b/src/mbgl/util/exclusive.hpp @@ -10,12 +10,12 @@ namespace util { template class exclusive { public: - inline exclusive(T* val, std::unique_ptr> mtx) : ptr(val), lock(std::move(mtx)) {} + exclusive(T* val, std::unique_ptr> mtx) : ptr(val), lock(std::move(mtx)) {} - inline T* operator->() { return ptr; } - inline const T* operator->() const { return ptr; } - inline T* operator*() { return ptr; } - inline const T* operator*() const { return ptr; } + T* operator->() { return ptr; } + const T* operator->() const { return ptr; } + T* operator*() { return ptr; } + const T* operator*() const { return ptr; } private: T *ptr; diff --git a/src/mbgl/util/geo.cpp b/src/mbgl/util/geo.cpp index dd40af882b..fe24334e82 100644 --- a/src/mbgl/util/geo.cpp +++ b/src/mbgl/util/geo.cpp @@ -8,12 +8,12 @@ namespace mbgl { namespace { -inline double lat(const uint8_t z, const int64_t y) { +double lat(const uint8_t z, const int64_t y) { const double n = M_PI - 2.0 * M_PI * y / std::pow(2.0, z); return util::RAD2DEG * std::atan(0.5 * (std::exp(n) - std::exp(-n))); } -inline double lon(const uint8_t z, const int64_t x) { +double lon(const uint8_t z, const int64_t x) { return x / std::pow(2.0, z) * util::DEGREES_MAX - util::LONGITUDE_MAX; } diff --git a/src/mbgl/util/io.hpp b/src/mbgl/util/io.hpp index 2679eb5360..795a465328 100644 --- a/src/mbgl/util/io.hpp +++ b/src/mbgl/util/io.hpp @@ -7,7 +7,7 @@ namespace mbgl { namespace util { struct IOException : std::runtime_error { - inline IOException(int err, const char* msg) : std::runtime_error(msg), code(err) { + IOException(int err, const char* msg) : std::runtime_error(msg), code(err) { } const int code = 0; }; diff --git a/src/mbgl/util/math.hpp b/src/mbgl/util/math.hpp index bfedc2a421..5d4220d0a2 100644 --- a/src/mbgl/util/math.hpp +++ b/src/mbgl/util/math.hpp @@ -14,18 +14,18 @@ namespace util { // Find the angle of the two vectors, solving the formula for the cross product // a x b = |a||b|sin(θ) for θ. template -inline T angle_between(const Point& a, const Point& b) { +T angle_between(const Point& a, const Point& b) { return std::atan2((a.x * b.y - a.y * b.x), a.x * b.x + a.y * b.y); } template -inline T angle_to(const Point& a, const Point& b) { +T angle_to(const Point& a, const Point& b) { return std::atan2(a.y - b.y, a.x - b.x); } // Reflect an angle around 0 degrees template -inline std::array flip(const std::array& c) { +std::array flip(const std::array& c) { return {{ static_cast(2 * M_PI - c[0]), static_cast(2 * M_PI - c[1]) @@ -33,7 +33,7 @@ inline std::array flip(const std::array& c) { } template -inline Point normal(const S1& a, const S2& b) { +Point normal(const S1& a, const S2& b) { T dx = b.x - a.x; T dy = b.y - a.y; T c = std::sqrt(dx * dx + dy * dy); @@ -41,12 +41,12 @@ inline Point normal(const S1& a, const S2& b) { } template -inline T perp(const T& a) { +T perp(const T& a) { return T(-a.y, a.x); } template -inline T dist(const S1& a, const S2& b) { +T dist(const S1& a, const S2& b) { T dx = b.x - a.x; T dy = b.y - a.y; T c = std::sqrt(dx * dx + dy * dy); @@ -54,7 +54,7 @@ inline T dist(const S1& a, const S2& b) { } template -inline T distSqr(const S1& a, const S2& b) { +T distSqr(const S1& a, const S2& b) { T dx = b.x - a.x; T dy = b.y - a.y; T c = dx * dx + dy * dy; @@ -62,23 +62,23 @@ inline T distSqr(const S1& a, const S2& b) { } template -inline T round(const T& a) { +T round(const T& a) { return T(::round(a.x), ::round(a.y)); } template -inline T length(T a, T b) { +T length(T a, T b) { return std::sqrt(a * a + b * b); } // Take the magnitude of vector a. template -inline T mag(const S& a) { +T mag(const S& a) { return std::sqrt(a.x * a.x + a.y * a.y); } template -inline S unit(const S& a) { +S unit(const S& a) { auto magnitude = mag(a); if (magnitude == 0) { return a; @@ -87,7 +87,7 @@ inline S unit(const S& a) { } template -inline T rotate(const T& a, S angle) { +T rotate(const T& a, S angle) { S cos = std::cos(angle); S sin = std::sin(angle); S x = cos * a.x - sin * a.y; @@ -96,7 +96,7 @@ inline T rotate(const T& a, S angle) { } template -inline Point matrixMultiply(const std::array& m, const Point& p) { +Point matrixMultiply(const std::array& m, const Point& p) { return Point(m[0] * p.x + m[1] * p.y, m[2] * p.x + m[3] * p.y); } diff --git a/src/mbgl/util/ptr.hpp b/src/mbgl/util/ptr.hpp index 2dc8118181..87c4e9f7cf 100644 --- a/src/mbgl/util/ptr.hpp +++ b/src/mbgl/util/ptr.hpp @@ -10,14 +10,14 @@ template class ptr : public ::std::shared_ptr { public: template - inline ptr(Args &&... args) + ptr(Args &&... args) : ::std::shared_ptr(::std::forward(args)...) {} - inline auto operator->() const -> decltype(this->::std::shared_ptr::operator->()) { + auto operator->() const -> decltype(this->::std::shared_ptr::operator->()) { assert(*this); return ::std::shared_ptr::operator->(); } - inline auto operator*() const -> decltype(this->::std::shared_ptr::operator*()) { + auto operator*() const -> decltype(this->::std::shared_ptr::operator*()) { assert(*this); return ::std::shared_ptr::operator*(); } diff --git a/src/mbgl/util/rect.hpp b/src/mbgl/util/rect.hpp index 2b877db40d..f5937f5c94 100644 --- a/src/mbgl/util/rect.hpp +++ b/src/mbgl/util/rect.hpp @@ -4,21 +4,21 @@ namespace mbgl { template struct Rect { - inline Rect() = default; - inline Rect(T x_, T y_, T w_, T h_) : x(x_), y(y_), w(w_), h(h_) {} + Rect() = default; + Rect(T x_, T y_, T w_, T h_) : x(x_), y(y_), w(w_), h(h_) {} T x = 0, y = 0; T w = 0, h = 0; template - inline Rect operator *(Number value) const { + Rect operator *(Number value) const { return Rect(x * value, y * value, w * value, h * value); } template - inline bool operator==(const R& r) const { + bool operator==(const R& r) const { return x == r.x && y == r.y && w == r.w && h == r.h; } - inline bool hasArea() const { return w != 0 && h != 0; } + bool hasArea() const { return w != 0 && h != 0; } }; } // namespace mbgl diff --git a/src/mbgl/util/stopwatch.hpp b/src/mbgl/util/stopwatch.hpp index ca6a4125f7..74cc2c412d 100644 --- a/src/mbgl/util/stopwatch.hpp +++ b/src/mbgl/util/stopwatch.hpp @@ -26,12 +26,12 @@ private: }; #else class stopwatch { - inline stopwatch(Event event = Event::General); - inline stopwatch(EventSeverity severity, Event event = Event::General); - inline stopwatch(const std::string &name, Event event = Event::General); - inline stopwatch(const std::string &name, EventSeverity severity, Event event = Event::General); - inline void report(const std::string &name) {} - inline ~stopwatch() {} + stopwatch(Event event = Event::General); + stopwatch(EventSeverity severity, Event event = Event::General); + stopwatch(const std::string &name, Event event = Event::General); + stopwatch(const std::string &name, EventSeverity severity, Event event = Event::General); + void report(const std::string &name) {} + ~stopwatch() {} }; #endif } // namespace util diff --git a/src/mbgl/util/thread_local.hpp b/src/mbgl/util/thread_local.hpp index c3364c5d42..67e3842ec6 100644 --- a/src/mbgl/util/thread_local.hpp +++ b/src/mbgl/util/thread_local.hpp @@ -12,12 +12,12 @@ namespace util { template class ThreadLocal : public noncopyable { public: - inline ThreadLocal(T* val) { + ThreadLocal(T* val) { ThreadLocal(); set(val); } - inline ThreadLocal() { + ThreadLocal() { int ret = pthread_key_create(&key, [](void *ptr) { delete reinterpret_cast(ptr); }); @@ -27,13 +27,13 @@ public: } } - inline ~ThreadLocal() { + ~ThreadLocal() { if (pthread_key_delete(key)) { throw std::runtime_error("Failed to delete local storage key."); } } - inline T* get() { + T* get() { T* ret = reinterpret_cast(pthread_getspecific(key)); if (!ret) { return nullptr; @@ -42,7 +42,7 @@ public: return ret; } - inline void set(T* ptr) { + void set(T* ptr) { if (pthread_setspecific(key, ptr)) { throw std::runtime_error("Failed to set local storage."); } -- cgit v1.2.1