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
39f59b08
Kaydet (Commit)
39f59b08
authored
Kas 23, 2002
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove MALLOC_ZERO_RETURNS_NULL.
üst
19cf4ee6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
5 additions
and
110 deletions
+5
-110
pymem.h
Include/pymem.h
+4
-9
obmalloc.c
Objects/obmalloc.c
+0
-2
pyconfig.h
RISCOS/pyconfig.h
+0
-3
configure
configure
+1
-64
configure.in
configure.in
+0
-29
pyconfig.h.in
pyconfig.h.in
+0
-3
No files found.
Include/pymem.h
Dosyayı görüntüle @
39f59b08
...
...
@@ -62,16 +62,11 @@ PyAPI_FUNC(void) PyMem_Free(void *);
#else
/* ! PYMALLOC_DEBUG */
#ifdef MALLOC_ZERO_RETURNS_NULL
/* PyMem_MALLOC(0) means malloc(1). Some systems would return NULL
for malloc(0), which would be treated as an error. Some platforms
would return a pointer with no memory behind it, which would break
pymalloc. To solve these problems, allocate an extra byte. */
#define PyMem_MALLOC(n) malloc((n) ? (n) : 1)
#else
#define PyMem_MALLOC malloc
#endif
/* Caution: whether MALLOC_ZERO_RETURNS_NULL is #defined has nothing to
do with whether platform realloc(non-NULL, 0) normally frees the memory
or returns NULL. Rather than introduce yet another config variation,
just make a realloc to 0 bytes act as if to 1 instead. */
#define PyMem_REALLOC(p, n) realloc((p), (n) ? (n) : 1)
#endif
/* PYMALLOC_DEBUG */
...
...
Objects/obmalloc.c
Dosyayı görüntüle @
39f59b08
...
...
@@ -688,10 +688,8 @@ redirect:
* last chance to serve the request) or when the max memory limit
* has been reached.
*/
#ifdef MALLOC_ZERO_RETURNS_NULL
if
(
nbytes
==
0
)
nbytes
=
1
;
#endif
return
(
void
*
)
malloc
(
nbytes
);
}
...
...
RISCOS/pyconfig.h
Dosyayı görüntüle @
39f59b08
...
...
@@ -184,9 +184,6 @@
/* Define if nice() returns success/failure instead of the new priority. */
#undef HAVE_BROKEN_NICE
/* Define if malloc(0) returns a NULL pointer */
#undef MALLOC_ZERO_RETURNS_NULL
/* Define if you have POSIX threads */
#undef _POSIX_THREADS
...
...
configure
Dosyayı görüntüle @
39f59b08
#! /bin/sh
# From configure.in Revision: 1.37
0
.
# From configure.in Revision: 1.37
1
.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.53 for python 2.3.
#
...
...
@@ -15306,69 +15306,6 @@ done
LIBS
=
$LIBS_SAVE
# check whether malloc(0) returns NULL or not
echo
"
$as_me
:
$LINENO
: checking what malloc(0) returns"
>
&5
echo
$ECHO_N
"checking what malloc(0) returns...
$ECHO_C
"
>
&6
if
test
"
${
ac_cv_malloc_zero
+set
}
"
=
set
;
then
echo
$ECHO_N
"(cached)
$ECHO_C
"
>
&6
else
if
test
"
$cross_compiling
"
=
yes
;
then
ac_cv_malloc_zero
=
nonnull
else
cat
>
conftest.
$ac_ext
<<
_ACEOF
#line
$LINENO
"configure"
#include "confdefs.h"
#include <stdio.h>
#ifdef HAVE_STDLIB
#include <stdlib.h>
#else
char *malloc(), *realloc();
int *free();
#endif
main() {
char *p;
p = malloc(0);
if (p == NULL) exit(1);
p = realloc(p, 0);
if (p == NULL) exit(1);
free(p);
exit(0);
}
_ACEOF
rm
-f
conftest
$ac_exeext
if
{
(
eval echo
"
$as_me
:
$LINENO
:
\"
$ac_link
\"
"
)
>
&5
(
eval
$ac_link
)
2>&5
ac_status
=
$?
echo
"
$as_me
:
$LINENO
:
\$
? =
$ac_status
"
>
&5
(
exit
$ac_status
)
;
}
&&
{
ac_try
=
'./conftest$ac_exeext'
{
(
eval echo
"
$as_me
:
$LINENO
:
\"
$ac_try
\"
"
)
>
&5
(
eval
$ac_try
)
2>&5
ac_status
=
$?
echo
"
$as_me
:
$LINENO
:
\$
? =
$ac_status
"
>
&5
(
exit
$ac_status
)
;
}
;
}
;
then
ac_cv_malloc_zero
=
nonnull
else
echo
"
$as_me
: program exited with status
$ac_status
"
>
&5
echo
"
$as_me
: failed program was:"
>
&5
cat
conftest.
$ac_ext
>
&5
(
exit
$ac_status
)
ac_cv_malloc_zero
=
null
fi
rm
-f
core core.
*
*
.core conftest
$ac_exeext
conftest.
$ac_objext
conftest.
$ac_ext
fi
fi
# XXX arm cross-compile?
echo
"
$as_me
:
$LINENO
: result:
$ac_cv_malloc_zero
"
>
&5
echo
"
${
ECHO_T
}
$ac_cv_malloc_zero
"
>
&6
if
test
"
$ac_cv_malloc_zero
"
=
null
then
cat
>>
confdefs.h
<<
\
_ACEOF
#define MALLOC_ZERO_RETURNS_NULL 1
_ACEOF
fi
# check for wchar.h
if
test
"
${
ac_cv_header_wchar_h
+set
}
"
=
set
;
then
echo
"
$as_me
:
$LINENO
: checking for wchar.h"
>
&5
...
...
configure.in
Dosyayı görüntüle @
39f59b08
...
...
@@ -2243,35 +2243,6 @@ LIBS="$LIBS $LIBM"
AC_REPLACE_FUNCS(hypot)
LIBS=$LIBS_SAVE
# check whether malloc(0) returns NULL or not
AC_MSG_CHECKING(what malloc(0) returns)
AC_CACHE_VAL(ac_cv_malloc_zero,
[AC_TRY_RUN([#include <stdio.h>
#ifdef HAVE_STDLIB
#include <stdlib.h>
#else
char *malloc(), *realloc();
int *free();
#endif
main() {
char *p;
p = malloc(0);
if (p == NULL) exit(1);
p = realloc(p, 0);
if (p == NULL) exit(1);
free(p);
exit(0);
}],
ac_cv_malloc_zero=nonnull,
ac_cv_malloc_zero=null,
ac_cv_malloc_zero=nonnull)]) # XXX arm cross-compile?
AC_MSG_RESULT($ac_cv_malloc_zero)
if test "$ac_cv_malloc_zero" = null
then
AC_DEFINE(MALLOC_ZERO_RETURNS_NULL, 1,
[Define if malloc(0) returns a NULL pointer.])
fi
# check for wchar.h
AC_CHECK_HEADER(wchar.h, [
AC_DEFINE(HAVE_WCHAR_H, 1,
...
...
pyconfig.h.in
Dosyayı görüntüle @
39f59b08
...
...
@@ -603,9 +603,6 @@
<sysmacros.h>. */
#undef MAJOR_IN_SYSMACROS
/* Define if malloc(0) returns a NULL pointer. */
#undef MALLOC_ZERO_RETURNS_NULL
/* Define if mvwdelch in curses.h is an expression. */
#undef MVWDELCH_IS_EXPRESSION
...
...
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