diff options
author | Emmanuel Bouthenot <kolter@openics.org> | 2006-02-12 01:31:35 +0000 |
---|---|---|
committer | Emmanuel Bouthenot <kolter@openics.org> | 2006-02-12 01:31:35 +0000 |
commit | 00eef1c1bceb0042e8e177744ef9a4dce6b05d0d (patch) | |
tree | 5ff306a04014f9411e03cdc8f340fb8a13d90d3e /src/plugins/scripts/python | |
parent | e7fd1a0cb7eb68a097db25e2589fd4d485927d00 (diff) | |
download | weechat-00eef1c1bceb0042e8e177744ef9a4dce6b05d0d.zip |
clean some code
Diffstat (limited to 'src/plugins/scripts/python')
-rw-r--r-- | src/plugins/scripts/python/weechat-python.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c index c516ae963..b33a61444 100644 --- a/src/plugins/scripts/python/weechat-python.c +++ b/src/plugins/scripts/python/weechat-python.c @@ -999,7 +999,7 @@ PyMethodDef weechat_python_funcs[] = { static PyObject * weechat_python_output (PyObject *self, PyObject *args) { - char *msg; + char *msg, *p; /* make gcc happy */ (void) self; @@ -1013,11 +1013,12 @@ weechat_python_output (PyObject *self, PyObject *args) return NULL; } - while (strlen(msg) > 0 && msg[strlen(msg)-1] == '\n') - msg[strlen(msg)-1] = '\0'; - - python_plugin->printf_server (python_plugin, - "Python stdin/stdout: %s", msg); + while ((p = strrchr(msg, '\n')) != NULL) + *p = '\0'; + + if (strlen(msg) > 0) + python_plugin->printf_server (python_plugin, + "Python stdin/stdout: %s", msg); return Py_BuildValue ("i", 1); } |