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
8deda70b
Kaydet (Commit)
8deda70b
authored
Mar 30, 2002
tarafından
Tim Peters
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Eliminate DONT_SHARE_SHORT_STRINGS.
üst
522cf1f6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
15 deletions
+5
-15
NEWS
Misc/NEWS
+3
-3
stringobject.c
Objects/stringobject.c
+2
-12
No files found.
Misc/NEWS
Dosyayı görüntüle @
8deda70b
...
@@ -91,9 +91,9 @@ Build
...
@@ -91,9 +91,9 @@ Build
- On Unix, a shared libpython2.3.so can be created with --enable-shared.
- On Unix, a shared libpython2.3.so can be created with --enable-shared.
-
References to the CACHE_HASH and INTERN_STRINGS preprocessor symbols
-
All uses of the CACHE_HASH, INTERN_STRINGS, and DONT_SHARE_SHORT_STRINGS
were eliminated. They were always defined, and the internal features
preprocessor symbols were eliminated. The internal decisions they
they enab
led stopped being experimental long ago.
control
led stopped being experimental long ago.
C API
C API
...
...
Objects/stringobject.c
Dosyayı görüntüle @
8deda70b
...
@@ -14,9 +14,7 @@ int null_strings, one_strings;
...
@@ -14,9 +14,7 @@ int null_strings, one_strings;
#endif
#endif
static
PyStringObject
*
characters
[
UCHAR_MAX
+
1
];
static
PyStringObject
*
characters
[
UCHAR_MAX
+
1
];
#ifndef DONT_SHARE_SHORT_STRINGS
static
PyStringObject
*
nullstring
;
static
PyStringObject
*
nullstring
;
#endif
/*
/*
For both PyString_FromString() and PyString_FromStringAndSize(), the
For both PyString_FromString() and PyString_FromStringAndSize(), the
...
@@ -47,7 +45,6 @@ PyObject *
...
@@ -47,7 +45,6 @@ PyObject *
PyString_FromStringAndSize
(
const
char
*
str
,
int
size
)
PyString_FromStringAndSize
(
const
char
*
str
,
int
size
)
{
{
register
PyStringObject
*
op
;
register
PyStringObject
*
op
;
#ifndef DONT_SHARE_SHORT_STRINGS
if
(
size
==
0
&&
(
op
=
nullstring
)
!=
NULL
)
{
if
(
size
==
0
&&
(
op
=
nullstring
)
!=
NULL
)
{
#ifdef COUNT_ALLOCS
#ifdef COUNT_ALLOCS
null_strings
++
;
null_strings
++
;
...
@@ -64,7 +61,6 @@ PyString_FromStringAndSize(const char *str, int size)
...
@@ -64,7 +61,6 @@ PyString_FromStringAndSize(const char *str, int size)
Py_INCREF
(
op
);
Py_INCREF
(
op
);
return
(
PyObject
*
)
op
;
return
(
PyObject
*
)
op
;
}
}
#endif
/* DONT_SHARE_SHORT_STRINGS */
/* PyObject_NewVar is inlined */
/* PyObject_NewVar is inlined */
op
=
(
PyStringObject
*
)
op
=
(
PyStringObject
*
)
...
@@ -77,7 +73,7 @@ PyString_FromStringAndSize(const char *str, int size)
...
@@ -77,7 +73,7 @@ PyString_FromStringAndSize(const char *str, int size)
if
(
str
!=
NULL
)
if
(
str
!=
NULL
)
memcpy
(
op
->
ob_sval
,
str
,
size
);
memcpy
(
op
->
ob_sval
,
str
,
size
);
op
->
ob_sval
[
size
]
=
'\0'
;
op
->
ob_sval
[
size
]
=
'\0'
;
#ifndef DONT_SHARE_SHORT_STRINGS
/* share short strings */
if
(
size
==
0
)
{
if
(
size
==
0
)
{
PyObject
*
t
=
(
PyObject
*
)
op
;
PyObject
*
t
=
(
PyObject
*
)
op
;
PyString_InternInPlace
(
&
t
);
PyString_InternInPlace
(
&
t
);
...
@@ -91,7 +87,6 @@ PyString_FromStringAndSize(const char *str, int size)
...
@@ -91,7 +87,6 @@ PyString_FromStringAndSize(const char *str, int size)
characters
[
*
str
&
UCHAR_MAX
]
=
op
;
characters
[
*
str
&
UCHAR_MAX
]
=
op
;
Py_INCREF
(
op
);
Py_INCREF
(
op
);
}
}
#endif
return
(
PyObject
*
)
op
;
return
(
PyObject
*
)
op
;
}
}
...
@@ -108,7 +103,6 @@ PyString_FromString(const char *str)
...
@@ -108,7 +103,6 @@ PyString_FromString(const char *str)
"string is too long for a Python string"
);
"string is too long for a Python string"
);
return
NULL
;
return
NULL
;
}
}
#ifndef DONT_SHARE_SHORT_STRINGS
if
(
size
==
0
&&
(
op
=
nullstring
)
!=
NULL
)
{
if
(
size
==
0
&&
(
op
=
nullstring
)
!=
NULL
)
{
#ifdef COUNT_ALLOCS
#ifdef COUNT_ALLOCS
null_strings
++
;
null_strings
++
;
...
@@ -123,7 +117,6 @@ PyString_FromString(const char *str)
...
@@ -123,7 +117,6 @@ PyString_FromString(const char *str)
Py_INCREF
(
op
);
Py_INCREF
(
op
);
return
(
PyObject
*
)
op
;
return
(
PyObject
*
)
op
;
}
}
#endif
/* DONT_SHARE_SHORT_STRINGS */
/* PyObject_NewVar is inlined */
/* PyObject_NewVar is inlined */
op
=
(
PyStringObject
*
)
op
=
(
PyStringObject
*
)
...
@@ -134,7 +127,7 @@ PyString_FromString(const char *str)
...
@@ -134,7 +127,7 @@ PyString_FromString(const char *str)
op
->
ob_shash
=
-
1
;
op
->
ob_shash
=
-
1
;
op
->
ob_sinterned
=
NULL
;
op
->
ob_sinterned
=
NULL
;
memcpy
(
op
->
ob_sval
,
str
,
size
+
1
);
memcpy
(
op
->
ob_sval
,
str
,
size
+
1
);
#ifndef DONT_SHARE_SHORT_STRINGS
/* share short strings */
if
(
size
==
0
)
{
if
(
size
==
0
)
{
PyObject
*
t
=
(
PyObject
*
)
op
;
PyObject
*
t
=
(
PyObject
*
)
op
;
PyString_InternInPlace
(
&
t
);
PyString_InternInPlace
(
&
t
);
...
@@ -148,7 +141,6 @@ PyString_FromString(const char *str)
...
@@ -148,7 +141,6 @@ PyString_FromString(const char *str)
characters
[
*
str
&
UCHAR_MAX
]
=
op
;
characters
[
*
str
&
UCHAR_MAX
]
=
op
;
Py_INCREF
(
op
);
Py_INCREF
(
op
);
}
}
#endif
return
(
PyObject
*
)
op
;
return
(
PyObject
*
)
op
;
}
}
...
@@ -3637,10 +3629,8 @@ PyString_Fini(void)
...
@@ -3637,10 +3629,8 @@ PyString_Fini(void)
Py_XDECREF
(
characters
[
i
]);
Py_XDECREF
(
characters
[
i
]);
characters
[
i
]
=
NULL
;
characters
[
i
]
=
NULL
;
}
}
#ifndef DONT_SHARE_SHORT_STRINGS
Py_XDECREF
(
nullstring
);
Py_XDECREF
(
nullstring
);
nullstring
=
NULL
;
nullstring
=
NULL
;
#endif
if
(
interned
)
{
if
(
interned
)
{
int
pos
,
changed
;
int
pos
,
changed
;
PyObject
*
key
,
*
value
;
PyObject
*
key
,
*
value
;
...
...
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