fix undefined symbol utf8FromString in _rpmb module when frpm rpm_tizen import _rpmb
authorbiao716.wang <biao716.wang@samsung.com>
Thu, 7 Sep 2023 04:00:52 +0000 (13:00 +0900)
committerwangbiao <biao716.wang@samsung.com>
Fri, 3 Nov 2023 02:34:53 +0000 (11:34 +0900)
Change-Id: Ib62988c5351070bcade49fbfddbe01788648531d
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
python/header-py.c
python/rpmsystem-py.h

index 6b60e96..39b4da0 100644 (file)
@@ -422,19 +422,6 @@ static PyObject * hdr_iternext(hdrObject *s)
     return res;
 }
 
-PyObject * utf8FromString(const char *s)
-{
-/* In Python 3, we return all strings as surrogate-escaped utf-8 */
-#if PY_MAJOR_VERSION >= 3
-    if (s != NULL)
-       return PyUnicode_DecodeUTF8(s, strlen(s), "surrogateescape");
-#else
-    if (s != NULL)
-       return PyBytes_FromString(s);
-#endif
-    Py_RETURN_NONE;
-}
-
 int utf8FromPyObject(PyObject *item, PyObject **str)
 {
     PyObject *res = NULL;
index c7e367e..2fc8421 100644 (file)
@@ -42,6 +42,12 @@ typedef Py_ssize_t (*lenfunc)(PyObject *);
 #define CAPSULE_EXTRACT(obj,name) PyCObject_AsVoidPtr(obj)
 #endif
 
-PyObject * utf8FromString(const char *s);
+static inline PyObject * utf8FromString(const char *s)
+{
+/* In Python 3, we return all strings as surrogate-escaped utf-8 */
+    if (s != NULL)
+       return PyUnicode_DecodeUTF8(s, strlen(s), "surrogateescape");
+    Py_RETURN_NONE;
+}
 
 #endif /* H_SYSTEM_PYTHON */