From 5e886961bdebce35103d177e2a91615f1be587d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 1 Mar 2015 09:57:35 +0100 Subject: [PATCH] scripts: fix return code of function bar_set in python/perl/ruby/lua/tcl/guile plugins --- ChangeLog.asciidoc | 2 ++ src/plugins/guile/weechat-guile-api.c | 14 ++++++++------ src/plugins/lua/weechat-lua-api.c | 11 +++++------ src/plugins/perl/weechat-perl-api.c | 9 +++++---- src/plugins/python/weechat-python-api.c | 11 +++++------ src/plugins/ruby/weechat-ruby-api.c | 11 +++++------ src/plugins/tcl/weechat-tcl-api.c | 10 +++++----- 7 files changed, 35 insertions(+), 33 deletions(-) diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index eb3a483ce..de32475b5 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -39,6 +39,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * python: fix name of function "bar_update" in case of error * python: fix restore of old interpreter when a function is not found in the script +* scripts: fix return code of function bar_set in + python/perl/ruby/lua/tcl/guile plugins * scripts: fix type of value returned by function hdata_time (from string to long integer) in perl/ruby/lua/tcl/guile plugins diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c index 1e140ed50..1f6178bfb 100644 --- a/src/plugins/guile/weechat-guile-api.c +++ b/src/plugins/guile/weechat-guile-api.c @@ -3837,16 +3837,18 @@ weechat_guile_api_bar_new (SCM args) SCM weechat_guile_api_bar_set (SCM bar, SCM property, SCM value) { - API_INIT_FUNC(1, "bar_set", API_RETURN_ERROR); + int rc; + + API_INIT_FUNC(1, "bar_set", API_RETURN_INT(0)); if (!scm_is_string (bar) || !scm_is_string (property) || !scm_is_string (value)) - API_WRONG_ARGS(API_RETURN_ERROR); + API_WRONG_ARGS(API_RETURN_INT(0)); - weechat_bar_set (API_STR2PTR(API_SCM_TO_STRING(bar)), - API_SCM_TO_STRING(property), - API_SCM_TO_STRING(value)); + rc = weechat_bar_set (API_STR2PTR(API_SCM_TO_STRING(bar)), + API_SCM_TO_STRING(property), + API_SCM_TO_STRING(value)); - API_RETURN_OK; + API_RETURN_INT(rc); } SCM diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c index a62fc0418..6c2db299a 100644 --- a/src/plugins/lua/weechat-lua-api.c +++ b/src/plugins/lua/weechat-lua-api.c @@ -4055,20 +4055,19 @@ API_FUNC(bar_new) API_FUNC(bar_set) { const char *bar, *property, *value; + int rc; - API_INIT_FUNC(1, "bar_set", API_RETURN_ERROR); + API_INIT_FUNC(1, "bar_set", API_RETURN_INT(0)); if (lua_gettop (L) < 3) - API_WRONG_ARGS(API_RETURN_ERROR); + API_WRONG_ARGS(API_RETURN_INT(0)); bar = lua_tostring (L, -3); property = lua_tostring (L, -2); value = lua_tostring (L, -1); - weechat_bar_set (API_STR2PTR(bar), - property, - value); + rc = weechat_bar_set (API_STR2PTR(bar), property, value); - API_RETURN_OK; + API_RETURN_INT(rc); } API_FUNC(bar_update) diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c index 9c937bb25..98c10a2fa 100644 --- a/src/plugins/perl/weechat-perl-api.c +++ b/src/plugins/perl/weechat-perl-api.c @@ -3976,19 +3976,20 @@ API_FUNC(bar_new) API_FUNC(bar_set) { char *bar, *property, *value; + int rc; dXSARGS; - API_INIT_FUNC(1, "bar_set", API_RETURN_ERROR); + API_INIT_FUNC(1, "bar_set", API_RETURN_INT(0)); if (items < 3) - API_WRONG_ARGS(API_RETURN_ERROR); + API_WRONG_ARGS(API_RETURN_INT(0)); bar = SvPV_nolen (ST (0)); property = SvPV_nolen (ST (1)); value = SvPV_nolen (ST (2)); - weechat_bar_set (API_STR2PTR(bar), property, value); + rc = weechat_bar_set (API_STR2PTR(bar), property, value); - API_RETURN_OK; + API_RETURN_INT(rc); } API_FUNC(bar_update) diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index 160e0226c..054f4dde8 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -4006,19 +4006,18 @@ API_FUNC(bar_new) API_FUNC(bar_set) { char *bar, *property, *value; + int rc; - API_INIT_FUNC(1, "bar_set", API_RETURN_ERROR); + API_INIT_FUNC(1, "bar_set", API_RETURN_INT(0)); bar = NULL; property = NULL; value = NULL; if (!PyArg_ParseTuple (args, "sss", &bar, &property, &value)) - API_WRONG_ARGS(API_RETURN_ERROR); + API_WRONG_ARGS(API_RETURN_INT(0)); - weechat_bar_set (API_STR2PTR(bar), - property, - value); + rc = weechat_bar_set (API_STR2PTR(bar), property, value); - API_RETURN_OK; + API_RETURN_INT(rc); } API_FUNC(bar_update) diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c index 5b958da72..e5275840d 100644 --- a/src/plugins/ruby/weechat-ruby-api.c +++ b/src/plugins/ruby/weechat-ruby-api.c @@ -4836,10 +4836,11 @@ static VALUE weechat_ruby_api_bar_set (VALUE class, VALUE bar, VALUE property, VALUE value) { char *c_bar, *c_property, *c_value; + int rc; - API_INIT_FUNC(1, "bar_set", API_RETURN_ERROR); + API_INIT_FUNC(1, "bar_set", API_RETURN_INT(0)); if (NIL_P (bar) || NIL_P (property) || NIL_P (value)) - API_WRONG_ARGS(API_RETURN_ERROR); + API_WRONG_ARGS(API_RETURN_INT(0)); Check_Type (bar, T_STRING); Check_Type (property, T_STRING); @@ -4849,11 +4850,9 @@ weechat_ruby_api_bar_set (VALUE class, VALUE bar, VALUE property, VALUE value) c_property = StringValuePtr (property); c_value = StringValuePtr (value); - weechat_bar_set (API_STR2PTR(c_bar), - c_property, - c_value); + rc = weechat_bar_set (API_STR2PTR(c_bar), c_property, c_value); - API_RETURN_OK; + API_RETURN_INT(rc); } static VALUE diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c index 542474d04..f322832c8 100644 --- a/src/plugins/tcl/weechat-tcl-api.c +++ b/src/plugins/tcl/weechat-tcl-api.c @@ -4315,19 +4315,19 @@ API_FUNC(bar_set) { Tcl_Obj *objp; char *bar, *property, *value; - int i; + int i, rc; - API_INIT_FUNC(1, "bar_set", API_RETURN_ERROR); + API_INIT_FUNC(1, "bar_set", API_RETURN_INT(0)); if (objc < 4) - API_WRONG_ARGS(API_RETURN_ERROR); + API_WRONG_ARGS(API_RETURN_INT(0)); bar = Tcl_GetStringFromObj (objv[1], &i); property = Tcl_GetStringFromObj (objv[2], &i); value = Tcl_GetStringFromObj (objv[3], &i); - weechat_bar_set (API_STR2PTR(bar), property, value); + rc = weechat_bar_set (API_STR2PTR(bar), property, value); - API_RETURN_OK; + API_RETURN_INT(rc); } API_FUNC(bar_update)