Skip to content

Commit

Permalink
Move negation char* conversion outide of loop
Browse files Browse the repository at this point in the history
Version bump and release
  • Loading branch information
petrpulc committed Feb 2, 2019
1 parent 2528f86 commit c05abbe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions majkamodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,12 @@ static PyObject* Majka_find(Majka* self, PyObject* args, PyObject* kwds) {

if (self->first_only) rc = 1;

#ifdef PY3K
negative = PyUnicode_AsUTF8(self->negative);
#else
negative = PyString_AsString(self->negative);
#endif

for (entry = results, i=0; i < rc; i++, entry += strlen(entry) + 1) {
colon = strchr(entry, ':');
memcpy(tmp_lemma, entry, colon-entry);
Expand All @@ -507,11 +513,6 @@ static PyObject* Majka_find(Majka* self, PyObject* args, PyObject* kwds) {
Py_DECREF(tags);
} else {
if (is_negation(colon+1)){
#ifdef PY3K
negative = PyUnicode_AsUTF8(self->negative);
#else
negative = PyString_AsString(self->negative);
#endif
memmove(tmp_lemma+strlen(negative), tmp_lemma, strlen(tmp_lemma)+1);
memcpy(tmp_lemma, negative, strlen(negative));
}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from distutils.core import setup, Extension

setup(name='majka',
version='0.6',
version='0.7',
description='Wrapper for Majka morphological analyser',
long_description='''
Native cPython binding to a C++ implementation of morphological analyser named Majka.
Expand Down

0 comments on commit c05abbe

Please sign in to comment.