Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
03490918
Kaydet (Commit)
03490918
authored
Eki 03, 2011
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add _PyUnicode_HAS_WSTR_MEMORY() macro
üst
9ce5a835
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
unicodeobject.c
Objects/unicodeobject.c
+10
-5
No files found.
Objects/unicodeobject.c
Dosyayı görüntüle @
03490918
...
@@ -151,6 +151,14 @@ extern "C" {
...
@@ -151,6 +151,14 @@ extern "C" {
&& _PyUnicode_UTF8(op) \
&& _PyUnicode_UTF8(op) \
&& _PyUnicode_UTF8(op) != PyUnicode_DATA(op)))
&& _PyUnicode_UTF8(op) != PyUnicode_DATA(op)))
/* true if the Unicode object has an allocated wstr memory block
(not shared with other data) */
#define _PyUnicode_HAS_WSTR_MEMORY(op) \
(assert(_PyUnicode_CHECK(op)), \
(_PyUnicode_WSTR(op) && \
(!PyUnicode_IS_READY(op) || \
_PyUnicode_WSTR(op) != PyUnicode_DATA(op))))
/* Generic helper macro to convert characters of different types.
/* Generic helper macro to convert characters of different types.
from_type and to_type have to be valid type names, begin and end
from_type and to_type have to be valid type names, begin and end
are pointers to the source characters which should be of type
are pointers to the source characters which should be of type
...
@@ -1238,9 +1246,7 @@ unicode_dealloc(register PyUnicodeObject *unicode)
...
@@ -1238,9 +1246,7 @@ unicode_dealloc(register PyUnicodeObject *unicode)
Py_FatalError("Inconsistent interned string state.");
Py_FatalError("Inconsistent interned string state.");
}
}
if (_PyUnicode_WSTR(unicode) &&
if (_PyUnicode_HAS_WSTR_MEMORY(unicode))
(!PyUnicode_IS_READY(unicode) ||
_PyUnicode_WSTR(unicode) != PyUnicode_DATA(unicode)))
PyObject_DEL(_PyUnicode_WSTR(unicode));
PyObject_DEL(_PyUnicode_WSTR(unicode));
if (_PyUnicode_HAS_UTF8_MEMORY(unicode))
if (_PyUnicode_HAS_UTF8_MEMORY(unicode))
PyObject_DEL(_PyUnicode_UTF8(unicode));
PyObject_DEL(_PyUnicode_UTF8(unicode));
...
@@ -12061,8 +12067,7 @@ unicode__sizeof__(PyUnicodeObject *v)
...
@@ -12061,8 +12067,7 @@ unicode__sizeof__(PyUnicodeObject *v)
}
}
/* If the wstr pointer is present, account for it unless it is shared
/* If the wstr pointer is present, account for it unless it is shared
with the data pointer. Check if the data is not shared. */
with the data pointer. Check if the data is not shared. */
if (_PyUnicode_WSTR(v) &&
if (_PyUnicode_HAS_WSTR_MEMORY(v))
(PyUnicode_DATA(v) != _PyUnicode_WSTR(v)))
size += (PyUnicode_WSTR_LENGTH(v) + 1) * sizeof(wchar_t);
size += (PyUnicode_WSTR_LENGTH(v) + 1) * sizeof(wchar_t);
if (_PyUnicode_HAS_UTF8_MEMORY(v))
if (_PyUnicode_HAS_UTF8_MEMORY(v))
size += PyUnicode_UTF8_LENGTH(v) + 1;
size += PyUnicode_UTF8_LENGTH(v) + 1;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment