[med-svn] [cnrun] 02/05: have CHost::del_model return false on nx model args

andrei zavada hmmr-guest at moszumanska.debian.org
Wed Dec 28 17:57:00 UTC 2016


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

hmmr-guest pushed a commit to branch WIP
in repository cnrun.

commit 42f66dfcd73fbcdb37905c558af60e73d812491e
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Wed Dec 28 02:14:01 2016 +0200

    have CHost::del_model return false on nx model args
---
 upstream/src/lua-cnrun/cnhost.hh   |  9 ++++++---
 upstream/src/lua-cnrun/commands.cc | 24 ++++++++++++++----------
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/upstream/src/lua-cnrun/cnhost.hh b/upstream/src/lua-cnrun/cnhost.hh
index 84d9418..c674b31 100644
--- a/upstream/src/lua-cnrun/cnhost.hh
+++ b/upstream/src/lua-cnrun/cnhost.hh
@@ -81,11 +81,14 @@ class CHost
                         } else
                                 return -1;
                 }
-        void del_model( const string& name)
+        bool del_model( const string& name)
                 {
-                        if ( models.find(name) != models.end() )
+                        if ( models.find(name) != models.end() ) {
                                 delete models[name];
-                        models.erase( name);
+                                models.erase( name);
+                                return true;
+                        } else
+                                return false;
                 }
         // cmd_new_model( const TArgs&);
         // cmd_delete_model( const TArgs&);
diff --git a/upstream/src/lua-cnrun/commands.cc b/upstream/src/lua-cnrun/commands.cc
index c91386e..8b3390f 100644
--- a/upstream/src/lua-cnrun/commands.cc
+++ b/upstream/src/lua-cnrun/commands.cc
@@ -176,16 +176,6 @@ int new_model( lua_State *L)
 }
 
 
-int delete_model( lua_State *L)
-{
-        INTRO_WITH_MODEL_NAME("ps");
-
-        C.del_model( model_name);
-
-        VOID_RETURN;
-}
-
-
 int list_models( lua_State *L)
 {
         INTRO_WITH_CONTEXT("p");
@@ -207,6 +197,20 @@ int list_models( lua_State *L)
                         __FUNCTION__, model_name); \
         auto& M = *C.get_model(model_name);
 
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-variable"
+int delete_model( lua_State *L)
+{
+        INTRO_WITH_MODEL("ps");
+
+        C.del_model( model_name);
+
+        VOID_RETURN;
+}
+#pragma GCC diagnostic pop
+
+
 int import_nml( lua_State *L)
 {
         INTRO_WITH_MODEL("pss");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/cnrun.git



More information about the debian-med-commit mailing list