Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
526f38b6
Commit
526f38b6
authored
Sep 20, 2016
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace usage of Py_VA_COPY with the (C99) standard va_copy
parent
74d68aac
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
11 additions
and
71 deletions
+11
-71
Include/pyport.h
Include/pyport.h
+1
-9
Objects/abstract.c
Objects/abstract.c
+1
-1
Objects/unicodeobject.c
Objects/unicodeobject.c
+2
-3
Python/getargs.c
Python/getargs.c
+6
-6
Python/modsupport.c
Python/modsupport.c
+1
-1
configure
configure
+0
-34
configure.ac
configure.ac
+0
-14
pyconfig.h.in
pyconfig.h.in
+0
-3
No files found.
Include/pyport.h
View file @
526f38b6
...
...
@@ -723,15 +723,7 @@ extern pid_t forkpty(int *, char *, struct termios *, struct winsize *);
#define Py_ULL(x) Py_LL(x##U)
#endif
#ifdef VA_LIST_IS_ARRAY
#define Py_VA_COPY(x, y) memcpy((x), (y), sizeof(va_list))
#else
#ifdef __va_copy
#define Py_VA_COPY __va_copy
#else
#define Py_VA_COPY(x, y) (x) = (y)
#endif
#endif
#define Py_VA_COPY va_copy
/*
* Convenient macros to deal with endianness of the platform. WORDS_BIGENDIAN is
...
...
Objects/abstract.c
View file @
526f38b6
...
...
@@ -2683,7 +2683,7 @@ objargs_mkstack(PyObject **small_stack, Py_ssize_t small_stack_size,
PyObject
**
stack
;
/* Count the number of arguments */
Py_VA_COPY
(
countva
,
va
);
va_copy
(
countva
,
va
);
n
=
0
;
while
(
1
)
{
...
...
Objects/unicodeobject.c
View file @
526f38b6
...
...
@@ -2874,9 +2874,8 @@ PyUnicode_FromFormatV(const char *format, va_list vargs)
writer
.
min_length
=
strlen
(
format
)
+
100
;
writer
.
overallocate
=
1
;
/* va_list may be an array (of 1 item) on some platforms (ex: AMD64).
Copy it to be able to pass a reference to a subfunction. */
Py_VA_COPY
(
vargs2
,
vargs
);
// Copy varags to be able to pass a reference to a subfunction.
va_copy
(
vargs2
,
vargs
);
for
(
f
=
format
;
*
f
;
)
{
if
(
*
f
==
'%'
)
{
...
...
Python/getargs.c
View file @
526f38b6
...
...
@@ -142,7 +142,7 @@ PyArg_VaParse(PyObject *args, const char *format, va_list va)
{
va_list
lva
;
Py_VA_COPY
(
lva
,
va
);
va_copy
(
lva
,
va
);
return
vgetargs1
(
args
,
format
,
&
lva
,
0
);
}
...
...
@@ -152,7 +152,7 @@ _PyArg_VaParse_SizeT(PyObject *args, const char *format, va_list va)
{
va_list
lva
;
Py_VA_COPY
(
lva
,
va
);
va_copy
(
lva
,
va
);
return
vgetargs1
(
args
,
format
,
&
lva
,
FLAG_SIZE_T
);
}
...
...
@@ -1402,7 +1402,7 @@ PyArg_VaParseTupleAndKeywords(PyObject *args,
return
0
;
}
Py_VA_COPY
(
lva
,
va
);
va_copy
(
lva
,
va
);
retval
=
vgetargskeywords
(
args
,
keywords
,
format
,
kwlist
,
&
lva
,
0
);
return
retval
;
...
...
@@ -1426,7 +1426,7 @@ _PyArg_VaParseTupleAndKeywords_SizeT(PyObject *args,
return
0
;
}
Py_VA_COPY
(
lva
,
va
);
va_copy
(
lva
,
va
);
retval
=
vgetargskeywords
(
args
,
keywords
,
format
,
kwlist
,
&
lva
,
FLAG_SIZE_T
);
...
...
@@ -1531,7 +1531,7 @@ _PyArg_VaParseTupleAndKeywordsFast(PyObject *args, PyObject *keywords,
return
0
;
}
Py_VA_COPY
(
lva
,
va
);
va_copy
(
lva
,
va
);
retval
=
vgetargskeywordsfast
(
args
,
keywords
,
parser
,
&
lva
,
0
);
return
retval
;
...
...
@@ -1552,7 +1552,7 @@ _PyArg_VaParseTupleAndKeywordsFast_SizeT(PyObject *args, PyObject *keywords,
return
0
;
}
Py_VA_COPY
(
lva
,
va
);
va_copy
(
lva
,
va
);
retval
=
vgetargskeywordsfast
(
args
,
keywords
,
parser
,
&
lva
,
FLAG_SIZE_T
);
return
retval
;
...
...
Python/modsupport.c
View file @
526f38b6
...
...
@@ -468,7 +468,7 @@ va_build_value(const char *format, va_list va, int flags)
int
n
=
countformat
(
f
,
'\0'
);
va_list
lva
;
Py_VA_COPY
(
lva
,
va
);
va_copy
(
lva
,
va
);
if
(
n
<
0
)
return
NULL
;
...
...
configure
View file @
526f38b6
...
...
@@ -13539,40 +13539,6 @@ $as_echo "no" >&6; }
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
va_list_is_array
=
no
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking whether va_list is an array"
>
&5
$as_echo_n
"checking whether va_list is an array... "
>
&6
;
}
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
#ifdef HAVE_STDARG_PROTOTYPES
#include <stdarg.h>
#else
#include <varargs.h>
#endif
int
main ()
{
va_list list1, list2; list1 = list2;
;
return 0;
}
_ACEOF
if
ac_fn_c_try_compile
"
$LINENO
"
;
then
:
else
$as_echo
"#define VA_LIST_IS_ARRAY 1"
>>
confdefs.h
va_list_is_array
=
yes
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$va_list_is_array
"
>
&5
$as_echo
"
$va_list_is_array
"
>
&6
;
}
# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
...
...
configure.ac
View file @
526f38b6
...
...
@@ -4038,20 +4038,6 @@ x.sa_len = 0;]])],
[AC_MSG_RESULT(no)]
)
va_list_is_array=no
AC_MSG_CHECKING(whether va_list is an array)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_STDARG_PROTOTYPES
#include <stdarg.h>
#else
#include <varargs.h>
#endif
]], [[va_list list1, list2; list1 = list2;]])],[],[
AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
va_list_is_array=yes
])
AC_MSG_RESULT($va_list_is_array)
# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
[Define this if you have some version of gethostbyname_r()])
...
...
pyconfig.h.in
View file @
526f38b6
...
...
@@ -1361,9 +1361,6 @@
#endif
/* Define if a va_list is an array of some kind */
#undef VA_LIST_IS_ARRAY
/* Define if you want SIGFPE handled (see Include/pyfpe.h). */
#undef WANT_SIGFPE_HANDLER
...
...
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