summaryrefslogtreecommitdiff
path: root/src/bin/eolian_cxx
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-09-30 15:38:34 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-09-30 16:08:24 +0200
commit507061a145b8201f97e9ca8a269947174c3995ac (patch)
tree9651df8085dd4048ed87f1af92d1acaff29b8b2d /src/bin/eolian_cxx
parent62139f2292c9eb0136559fbc0f51300285f39e30 (diff)
bindings: Fix disposal of eolian state
Summary: It was actually leaking before. Let's use some RAII classes that were already there. ref T8280 Reviewers: q66, felipealmeida, brunobelo Reviewed By: q66 Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8280 Differential Revision: https://phab.enlightenment.org/D10237
Diffstat (limited to 'src/bin/eolian_cxx')
-rw-r--r--src/bin/eolian_cxx/eolian_cxx.cc20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/bin/eolian_cxx/eolian_cxx.cc b/src/bin/eolian_cxx/eolian_cxx.cc
index 6f719f178f..636d1ebc9a 100644
--- a/src/bin/eolian_cxx/eolian_cxx.cc
+++ b/src/bin/eolian_cxx/eolian_cxx.cc
@@ -40,10 +40,6 @@ struct options_type
40 bool main_header; 40 bool main_header;
41 41
42 options_type() : main_header(false) {} 42 options_type() : main_header(false) {}
43 ~options_type()
44 {
45 eolian_state_free(state);
46 }
47}; 43};
48 44
49static efl::eina::log_domain domain("eolian_cxx"); 45static efl::eina::log_domain domain("eolian_cxx");
@@ -386,19 +382,6 @@ run(options_type const& opts)
386} 382}
387 383
388static void 384static void
389state_init(options_type const& opts)
390{
391 Eolian_State *eos = ::eolian_state_new();
392 if (!eos)
393 {
394 EINA_CXX_DOM_LOG_ERR(eolian_cxx::domain)
395 << "Eolian failed creating state";
396 assert(false && "Error creating Eolian state");
397 }
398 opts.state = eos;
399}
400
401static void
402database_load(options_type const& opts) 385database_load(options_type const& opts)
403{ 386{
404 for (auto src : opts.include_dirs) 387 for (auto src : opts.include_dirs)
@@ -532,8 +515,9 @@ int main(int argc, char **argv)
532 { 515 {
533 efl::eina::eina_init eina_init; 516 efl::eina::eina_init eina_init;
534 efl::eolian::eolian_init eolian_init; 517 efl::eolian::eolian_init eolian_init;
518 efl::eolian::eolian_state eolian_state;
535 eolian_cxx::options_type opts = opts_get(argc, argv); 519 eolian_cxx::options_type opts = opts_get(argc, argv);
536 eolian_cxx::state_init(opts); 520 opts.state = eolian_state.value;
537 eolian_cxx::database_load(opts); 521 eolian_cxx::database_load(opts);
538 eolian_cxx::run(opts); 522 eolian_cxx::run(opts);
539 } 523 }