From 7d555a62f2106faf5ad89bec54aeb41ca06cac7d Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Thu, 20 Jun 2013 23:25:53 +0200 Subject: Little logic change --- src/pooptmodule.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/pooptmodule.c') 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); } -- cgit v1.2.3