Skip to content

Commit

Permalink
Simplified code
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Jan 5, 2025
1 parent 2486361 commit 05b265b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/_imagingft.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,22 +339,19 @@ text_layout_raqm(
len = PySequence_Fast_GET_SIZE(seq);
for (j = 0; j < len; j++) {
PyObject *item = PySequence_Fast_GET_ITEM(seq, j);
char *feature = NULL;
Py_ssize_t size = 0;
PyObject *bytes;
char *feature;
Py_ssize_t size;

if (!PyUnicode_Check(item)) {
Py_DECREF(seq);
PyErr_SetString(PyExc_TypeError, "expected a string");
goto failed;
}
bytes = PyUnicode_AsUTF8String(item);
if (bytes == NULL) {
feature = PyUnicode_AsUTF8AndSize(item, size);

Check warning on line 350 in src/_imagingft.c

View workflow job for this annotation

GitHub Actions / ubuntu-latest Python 3.13

passing argument 2 of ‘PyUnicode_AsUTF8AndSize’ makes pointer from integer without a cast [-Wint-conversion]

Check warning on line 350 in src/_imagingft.c

View workflow job for this annotation

GitHub Actions / ubuntu-latest Python 3.13

assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
if (feature == NULL) {
Py_DECREF(seq);
goto failed;
}
feature = PyBytes_AS_STRING(bytes);
size = PyBytes_GET_SIZE(bytes);
if (!raqm_add_font_feature(rq, feature, size)) {
Py_DECREF(seq);
Py_DECREF(bytes);

Check failure on line 357 in src/_imagingft.c

View workflow job for this annotation

GitHub Actions / ubuntu-latest Python 3.13

‘bytes’ undeclared (first use in this function)
Expand Down

0 comments on commit 05b265b

Please sign in to comment.