summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.asciidoc2
-rw-r--r--src/plugins/guile/weechat-guile-api.c11
-rw-r--r--src/plugins/lua/weechat-lua-api.c10
-rw-r--r--src/plugins/perl/weechat-perl-api.c15
-rw-r--r--src/plugins/ruby/weechat-ruby-api.c12
-rw-r--r--src/plugins/tcl/weechat-tcl-api.c11
6 files changed, 21 insertions, 40 deletions
diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc
index 609927b3d..ddc511b22 100644
--- a/ChangeLog.asciidoc
+++ b/ChangeLog.asciidoc
@@ -36,6 +36,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
* relay: fix up/down keys on relay buffer (closes #335)
* relay: remove v4-mapped addresses in /help relay.network.allowed_ips
(closes #325)
+* scripts: fix type of value returned by function hdata_time (from string to
+ long integer) in perl/ruby/lua/tcl/guile plugins
== Version 1.1.1 (2015-01-25)
diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c
index c2318aa46..1e140ed50 100644
--- a/src/plugins/guile/weechat-guile-api.c
+++ b/src/plugins/guile/weechat-guile-api.c
@@ -4439,22 +4439,17 @@ weechat_guile_api_hdata_pointer (SCM hdata, SCM pointer, SCM name)
SCM
weechat_guile_api_hdata_time (SCM hdata, SCM pointer, SCM name)
{
- char timebuffer[64], *result;
time_t time;
- SCM return_value;
- API_INIT_FUNC(1, "hdata_time", API_RETURN_EMPTY);
+ API_INIT_FUNC(1, "hdata_time", API_RETURN_LONG(0));
if (!scm_is_string (hdata) || !scm_is_string (pointer) || !scm_is_string (name))
- API_WRONG_ARGS(API_RETURN_EMPTY);
+ API_WRONG_ARGS(API_RETURN_LONG(0));
- timebuffer[0] = '\0';
time = weechat_hdata_time (API_STR2PTR(API_SCM_TO_STRING(hdata)),
API_STR2PTR(API_SCM_TO_STRING(pointer)),
API_SCM_TO_STRING(name));
- snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
- result = strdup (timebuffer);
- API_RETURN_STRING_FREE(result);
+ API_RETURN_LONG(time);
}
SCM
diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c
index e2b3eba7f..a62fc0418 100644
--- a/src/plugins/lua/weechat-lua-api.c
+++ b/src/plugins/lua/weechat-lua-api.c
@@ -4737,24 +4737,20 @@ API_FUNC(hdata_time)
{
const char *hdata, *pointer, *name;
time_t time;
- char timebuffer[64], *result;
- API_INIT_FUNC(1, "hdata_time", API_RETURN_EMPTY);
+ API_INIT_FUNC(1, "hdata_time", API_RETURN_LONG(0));
if (lua_gettop (L) < 3)
- API_WRONG_ARGS(API_RETURN_EMPTY);
+ API_WRONG_ARGS(API_RETURN_LONG(0));
hdata = lua_tostring (L, -3);
pointer = lua_tostring (L, -2);
name = lua_tostring (L, -1);
- timebuffer[0] = '\0';
time = weechat_hdata_time (API_STR2PTR(hdata),
API_STR2PTR(pointer),
name);
- snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
- result = strdup (timebuffer);
- API_RETURN_STRING_FREE(result);
+ API_RETURN_LONG(time);
}
API_FUNC(hdata_hashtable)
diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c
index 3f293b8aa..9c937bb25 100644
--- a/src/plugins/perl/weechat-perl-api.c
+++ b/src/plugins/perl/weechat-perl-api.c
@@ -4664,25 +4664,20 @@ API_FUNC(hdata_pointer)
API_FUNC(hdata_time)
{
time_t time;
- char timebuffer[64], *result, *hdata, *pointer, *name;
+ char *hdata, *pointer, *name;
dXSARGS;
- API_INIT_FUNC(1, "hdata_time", API_RETURN_EMPTY);
+ API_INIT_FUNC(1, "hdata_time", API_RETURN_LONG(0));
if (items < 3)
- API_WRONG_ARGS(API_RETURN_EMPTY);
+ API_WRONG_ARGS(API_RETURN_LONG(0));
hdata = SvPV_nolen (ST (0));
pointer = SvPV_nolen (ST (1));
name = SvPV_nolen (ST (2));
- timebuffer[0] = '\0';
- time = weechat_hdata_time (API_STR2PTR(hdata),
- API_STR2PTR(pointer),
- name);
- snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
- result = strdup (timebuffer);
+ time = weechat_hdata_time (API_STR2PTR(hdata), API_STR2PTR(pointer), name);
- API_RETURN_STRING_FREE(result);
+ API_RETURN_LONG(time);
}
API_FUNC(hdata_hashtable)
diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c
index cfc2e6f3b..5b958da72 100644
--- a/src/plugins/ruby/weechat-ruby-api.c
+++ b/src/plugins/ruby/weechat-ruby-api.c
@@ -5691,13 +5691,12 @@ static VALUE
weechat_ruby_api_hdata_time (VALUE class, VALUE hdata, VALUE pointer,
VALUE name)
{
- char *c_hdata, *c_pointer, *c_name, timebuffer[64], *result;
+ char *c_hdata, *c_pointer, *c_name;
time_t time;
- VALUE return_value;
- API_INIT_FUNC(1, "hdata_time", API_RETURN_EMPTY);
+ API_INIT_FUNC(1, "hdata_time", API_RETURN_LONG(0));
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name))
- API_WRONG_ARGS(API_RETURN_EMPTY);
+ API_WRONG_ARGS(API_RETURN_LONG(0));
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
@@ -5707,14 +5706,11 @@ weechat_ruby_api_hdata_time (VALUE class, VALUE hdata, VALUE pointer,
c_pointer = StringValuePtr (pointer);
c_name = StringValuePtr (name);
- timebuffer[0] = '\0';
time = weechat_hdata_time (API_STR2PTR(c_hdata),
API_STR2PTR(c_pointer),
c_name);
- snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
- result = strdup (timebuffer);
- API_RETURN_STRING_FREE(result);
+ API_RETURN_LONG(time);
}
static VALUE
diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c
index 421847a48..542474d04 100644
--- a/src/plugins/tcl/weechat-tcl-api.c
+++ b/src/plugins/tcl/weechat-tcl-api.c
@@ -5014,25 +5014,22 @@ API_FUNC(hdata_time)
{
Tcl_Obj *objp;
time_t time;
- char timebuffer[64], *result, *hdata, *pointer, *name;
+ char *hdata, *pointer, *name;
int i;
- API_INIT_FUNC(1, "hdata_time", API_RETURN_EMPTY);
+ API_INIT_FUNC(1, "hdata_time", API_RETURN_LONG(0));
if (objc < 4)
- API_WRONG_ARGS(API_RETURN_EMPTY);
+ API_WRONG_ARGS(API_RETURN_LONG(0));
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
- timebuffer[0] = '\0';
time = weechat_hdata_time (API_STR2PTR(hdata),
API_STR2PTR(pointer),
name);
- snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
- result = strdup (timebuffer);
- API_RETURN_STRING_FREE(result);
+ API_RETURN_LONG(time);
}
API_FUNC(hdata_hashtable)