static int set_str(_RepomdRecordObject *self, PyObject *value, void *member_offset) { if (check_RepomdRecordStatus(self)) return -1; if (!PyUnicode_Check(value) && !PyBytes_Check(value) && value != Py_None) { PyErr_SetString(PyExc_TypeError, "Unicode, bytes, or None expected!"); return -1; } cr_RepomdRecord *rec = self->record; char *str = cr_safe_string_chunk_insert(rec->chunk, PyObject_ToStrOrNull(value)); *((char **) ((size_t) rec + (size_t) member_offset)) = str; return 0; }
static int set_str(_UpdateCollectionPackageObject *self, PyObject *value, void *member_offset) { if (check_UpdateCollectionPackageStatus(self)) return -1; if (!PyString_Check(value) && value != Py_None) { PyErr_SetString(PyExc_TypeError, "String or None expected!"); return -1; } cr_UpdateCollectionPackage *pkg = self->pkg; char *str = cr_safe_string_chunk_insert(pkg->chunk, PyObject_ToStrOrNull(value)); *((char **) ((size_t) pkg + (size_t) member_offset)) = str; return 0; }