summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-08-09 16:16:06 +0200
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-08-11 10:13:48 +0200
commitd79d0c83452212355d212e8fcd4ad5c27c1906fc (patch)
tree7d48d577b1f20ba76aa9deec150e3823451370c8 /src
parentef1b8f5fa4c2e939e9b6f08069ee08d362ee0ee5 (diff)
Remove the DB() makro, replace with logdebug() where sensible
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
Diffstat (limited to 'src')
-rw-r--r--src/app.cpp10
-rw-r--r--src/layers.cpp7
-rw-r--r--src/util.hpp11
3 files changed, 6 insertions, 22 deletions
diff --git a/src/app.cpp b/src/app.cpp
index 0a21635..779997a 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -41,7 +41,6 @@ App *g_app;
using json = nlohmann::json;
struct wm::area area_from_json(json const &j) {
- DB(j);
return wm::area{
j["name"],
{
@@ -53,7 +52,6 @@ struct wm::area area_from_json(json const &j) {
}
result<struct layout> layout_from_json(json const &j) {
- DB(j);
auto &ja = j["areas"];
auto l = layout{j["name"], uint32_t(ja.size()), {}};
@@ -83,7 +81,7 @@ result<json> file_to_json(char const *filename) {
// Will throw if parsing fails
struct result<layouts_type> load_layout(char const *filename) {
- DB("loading layout from " << filename);
+ logdebug("loading layout from %s", filename);
auto j = file_to_json(filename);
if (j.is_err()) {
@@ -101,7 +99,7 @@ struct result<layouts_type> load_layout(char const *filename) {
struct result<layer_map>
load_layer_map(char const *filename) {
- DB("loading IDs from " << filename);
+ logdebug("loading IDs from %s", filename);
auto j = file_to_json(filename);
if (j.is_err()) {
@@ -368,7 +366,7 @@ void App::execute_pending() {
// | .__/|_| \___/_/\_\_|\___|\__,_| |_____| \_/ \___|_| |_|\__|___/
// |_|
void App::surface_created(uint32_t surface_id) {
- DB("surface_id is " << surface_id);
+ logdebug("surface_id is %u", surface_id);
// We need to execute the surface setup after its creation.
this->add_task("surface_set_layout",
@@ -376,7 +374,7 @@ void App::surface_created(uint32_t surface_id) {
}
void App::surface_removed(uint32_t surface_id) {
- DB("surface_id is " << surface_id);
+ logdebug("surface_id is %u", surface_id);
}
// _ _ _ _ _ _ _
diff --git a/src/layers.cpp b/src/layers.cpp
index 2209847..0110f17 100644
--- a/src/layers.cpp
+++ b/src/layers.cpp
@@ -25,7 +25,6 @@ namespace wm {
using json = nlohmann::json;
layer::layer(nlohmann::json const &j) {
- DB(j);
if (j["type"] == "range") {
this->id_min = j["first_surface_id"];
this->id_max = j["last_surface_id"];
@@ -45,7 +44,6 @@ layer::layer(nlohmann::json const &j) {
}
struct result<struct layer_map> to_layer_map(nlohmann::json const &j) {
- DB(j);
try {
layer_map stl{};
auto m = j["mappings"];
@@ -76,7 +74,7 @@ struct result<struct layer_map> to_layer_map(nlohmann::json const &j) {
auto jtests = j.value("tests", json());
if (!jtests.empty()) {
- DB("Embedded tests...");
+ logdebug("Embedded tests...");
std::vector<std::pair<int, int>> tests;
tests.reserve(jtests.size());
std::transform(std::cbegin(jtests), std::cend(jtests),
@@ -88,8 +86,7 @@ struct result<struct layer_map> to_layer_map(nlohmann::json const &j) {
for (auto sid : tests) {
int lid = stl.get_layer_id(sid.first).value_or(-1);
- DB("this=" << sid.first << ", that=" << lid
- << ", expect=" << sid.second);
+ logdebug("this=%d, that=%d, expect=%d", sid.first, lid, sid.second);
if (lid != sid.second) {
return Err<layer_map>("ID Map embedded test failed!");
}
diff --git a/src/util.hpp b/src/util.hpp
index 0703809..ab9019b 100644
--- a/src/util.hpp
+++ b/src/util.hpp
@@ -49,17 +49,6 @@ extern "C" {
#define logdebug(...)
#endif
-#ifndef NDEBUG
-#define DB(expr) \
- do { \
- std::ostringstream o; \
- o << __FILE__ << ":" << __LINE__ << ":" << __func__ << ": " << expr; \
- logdebug("%s", o.str().c_str()); \
- } while (0)
-#else
-#define DB(expr)
-#endif
-
// _ _ _ __ _
// ___| |_ _ __ _ _ ___| |_ _ _ _ __ (_) __ _ _ _ ___ / _| __| |
// / __| __| '__| | | |/ __| __| | | | | '_ \| |/ _` | | | |/ _ \ | |_ / _` |