Cleanup fc_match_postscript_name
This commit is contained in:
parent
bc7f689165
commit
0b2726ec33
@ -205,14 +205,15 @@ end:
|
|||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
fc_match_postscript_name(PyObject UNUSED *self, PyObject *args) {
|
fc_match_postscript_name(PyObject UNUSED *self, PyObject *args) {
|
||||||
char *postscript_name = NULL;
|
const char *postscript_name = NULL;
|
||||||
FcPattern *pat = NULL;
|
FcPattern *pat = NULL;
|
||||||
PyObject *ans = NULL;
|
PyObject *ans = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|z", &postscript_name)) return NULL;
|
if (!PyArg_ParseTuple(args, "s", &postscript_name)) return NULL;
|
||||||
|
if (!postscript_name || !postscript_name[0]) { PyErr_SetString(PyExc_KeyError, "postscript_name must not be empty"); return NULL; }
|
||||||
|
|
||||||
pat = FcPatternCreate();
|
pat = FcPatternCreate();
|
||||||
if (pat == NULL) return PyErr_NoMemory();
|
if (pat == NULL) return PyErr_NoMemory();
|
||||||
if (!postscript_name || strlen(postscript_name) == 0) return NULL;
|
|
||||||
|
|
||||||
AP(FcPatternAddString, FC_POSTSCRIPT_NAME, (const FcChar8*)postscript_name, "postscript_name");
|
AP(FcPatternAddString, FC_POSTSCRIPT_NAME, (const FcChar8*)postscript_name, "postscript_name");
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user