summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-06-20 23:25:53 +0200
committerFlorent Le Coz <louiz@louiz.org>2013-06-20 23:25:53 +0200
commit7d555a62f2106faf5ad89bec54aeb41ca06cac7d (patch)
tree0609ddfd20ded53370b6f497fad865f9f70c5401
parent71d98bd577994d501f8e918b1f3553586f793422 (diff)
downloadpoezio-7d555a62f2106faf5ad89bec54aeb41ca06cac7d.tar.gz
poezio-7d555a62f2106faf5ad89bec54aeb41ca06cac7d.tar.bz2
poezio-7d555a62f2106faf5ad89bec54aeb41ca06cac7d.tar.xz
poezio-7d555a62f2106faf5ad89bec54aeb41ca06cac7d.zip
Little logic change
-rw-r--r--src/pooptmodule.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/pooptmodule.c b/src/pooptmodule.c
index b80bc8dc..64c1870f 100644
--- a/src/pooptmodule.c
+++ b/src/pooptmodule.c
@@ -235,6 +235,8 @@ static PyObject* poopt_cut_by_columns(PyObject* self, PyObject* args)
while (ptr < end)
{
+ if (columns == limit)
+ break ;
const size_t consumed = mbrtowc(&wc, ptr, end-ptr, NULL);
if (consumed == 0)
break ;
@@ -256,10 +258,6 @@ static PyObject* poopt_cut_by_columns(PyObject* self, PyObject* args)
break ;
ptr += consumed;
columns += cols;
- if (columns == limit)
- /* With the new character we are exactly at the column limit. No
- need to go check the next char */
- break ;
}
return Py_BuildValue("s#", start, ptr - start);
}