8000 Cruft removal: · python/cpython@f6657e6 · GitHub
[go: up one dir, main page]

Skip to content

Commit f6657e6

Browse files
committed
Cruft removal:
* DL_IMPORT/DL_EXPORT * #if 0'd code * Py_PROTO which was obsolete, but still used in one place in addrinfo.h
1 parent 545686b commit f6657e6

File tree

6 files changed

+8
-98
lines changed

6 files changed

+8
-98
lines changed

Include/Python.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,6 @@
4848

4949
#include "pyport.h"
5050

51-
/* pyconfig.h or pyport.h may or may not define DL_IMPORT */
52-
#ifndef DL_IMPORT /* declarations for DLL import/export */
53-
#define DL_IMPORT(RTYPE) RTYPE
54-
#endif
55-
#ifndef DL_EXPORT /* declarations for DLL import/export */
56-
#define DL_EXPORT(RTYPE) RTYPE
57-
#endif
58-
5951
/* Debug-mode build with pymalloc implies PYMALLOC_DEBUG.
6052
* PYMALLOC_DEBUG is in error if pymalloc is not in use.
6153
*/

Include/pyport.h

Lines changed: 1 addition & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,6 @@ Used in: PY_LONG_LONG
3535
3636
**************************************************************************/
3737

38-
39-
/* For backward compatibility only. Obsolete, do not use. */
40-
#ifdef HAVE_PROTOTYPES
41-
#define Py_PROTO(x) x
42-
#else
43-
#define Py_PROTO(x) ()
44-
#endif
45-
#ifndef Py_FPROTO
46-
#define Py_FPROTO(x) Py_PROTO(x)
47-
#endif
48-
4938
/* typedefs for some C9X-defined synonyms for integral types.
5039
*
5140
* The names in Python are exactly the same as the C9X names, except with a
@@ -226,9 +215,7 @@ typedef Py_intptr_t Py_ssize_t;
226215
/* NB caller must include <sys/types.h> */
227216

228217
#ifdef HAVE_SYS_SELECT_H
229-
230218
#include <sys/select.h>
231-
232219
#endif /* !HAVE_SYS_SELECT_H */
233220

234221
/*******************************
@@ -504,7 +491,7 @@ extern int gethostname(char *, int);
504491
#ifdef __BEOS__
505492
/* Unchecked */
506493
/* It's in the libs, but not the headers... - [cjh] */
507-
int shutdown( int, int );
494+
int shutdown(int, int);
508495
#endif
509496

510497
#ifdef HAVE__GETPTY
@@ -523,25 +510,6 @@ extern int forkpty(int *, char *, struct termios *, struct winsize *);
523510
#endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */
524511

525512

526-
/* These are pulled from various places. It isn't obvious on what platforms
527-
they are necessary, nor what the exact prototype should look like (which
528-
is likely to vary between platforms!) If you find you need one of these
529-
declarations, please move them to a platform-specific block and include
530-
proper prototypes. */
531-
#if 0
532-
533-
/* From Modules/resource.c */
534-
extern int getrusage();
535-
extern int getpagesize();
536-
537-
/* From Python/sysmodule.c and Modules/posixmodule.c */
538-
extern int fclose(FILE *);
539-
540-
/* From Modules/posixmodule.c */
541-
extern int fdatasync(int);
542-
#endif /* 0 */
543-
544-
545513
/************************
546514
* WRAPPER FOR <math.h> *
547515
************************/
@@ -651,56 +619,6 @@ extern double hypot(double, double);
651619
# endif /* __cplusplus */
652620
#endif
653621

654-
/* Deprecated DL_IMPORT and DL_EXPORT macros */
655-
#if defined(Py_ENABLE_SHARED) && defined (HAVE_DECLSPEC_DLL)
656-
# if defined(Py_BUILD_CORE)
657-
# define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE
658-
# define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
659-
# else
660-
# define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
661-
# define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
662-
# endif
663-
#endif
664-
#ifndef DL_EXPORT
665-
# define DL_EXPORT(RTYPE) RTYPE
666-
#endif
667-
#ifndef DL_IMPORT
668-
# define DL_IMPORT(RTYPE) RTYPE
669-
#endif
670-
/* End of deprecated DL_* macros */
671-
672-
/* If the fd manipulation macros aren't defined,
673-
here is a set that should do the job */
674-
675-
#if 0 /* disabled and probably obsolete */
676-
677-
#ifndef FD_SETSIZE
678-
#define FD_SETSIZE 256
679-
#endif
680-
681-
#ifndef FD_SET
682-
683-
typedef long fd_mask;
684-
685-
#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
686-
#ifndef howmany
687-
#define howmany(x, y) (((x)+((y)-1))/(y))
688-
#endif /* howmany */
689-
690-
typedef struct fd_set {
691-
fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
692-
} fd_set;
693-
694-
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
695-
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
696-
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
697-
#define FD_ZERO(p) memset((char *)(p), '\0', sizeof(*(p)))
698-
699-
#endif /* FD_SET */
700-
701-
#endif /* fd manipulation macros */
702-
703-
704622
/* limits.h constants that may be missing */
705623

706624
#ifndef INT_MAX

Modules/_bsddb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5627,7 +5627,7 @@ static PyMethodDef bsddb_methods[] = {
56275627
#define MODULE_NAME_MAX_LEN 11
56285628
static char _bsddbModuleName[MODULE_NAME_MAX_LEN+1] = "_bsddb";
56295629

5630-
DL_EXPORT(void) init_bsddb(void)
5630+
PyMODINIT_FUNC init_bsddb(void)
56315631
{
56325632
PyObject* m;
56335633
PyObject* d;
@@ -6032,7 +6032,7 @@ DL_EXPORT(void) init_bsddb(void)
60326032
/* allow this module to be named _pybsddb so that it can be installed
60336033
* and imported on top of python >= 2.3 that includes its own older
60346034
* copy of the library named _bsddb without importing the old version. */
6035-
DL_EXPORT(void) init_pybsddb(void)
6035+
PyMODINIT_FUNC init_pybsddb(void)
60366036
{
60376037
strncpy(_bsddbModuleName, "_pybsddb", MODULE_NAME_MAX_LEN);
60386038
init_bsddb();

Modules/_ctypes/_ctypes_test.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ struct BITS {
330330
short M: 1, N: 2, O: 3, P: 4, Q: 5, R: 6, S: 7;
331331
};
332332

333-
DL_EXPORT(void) set_bitfields(struct BITS *bits, char name, int value)
333+
PyAPI_FUNC(void) set_bitfields(struct BITS *bits, char name, int value)
334334
{
335335
switch (name) {
336336
case 'A': bits->A = value; break;
@@ -353,7 +353,7 @@ DL_EXPORT(void) set_bitfields(struct BITS *bits, char name, int value)
353353
}
354354
}
355355

356-
DL_EXPORT(int) unpack_bitfields(struct BITS *bits, char name)
356+
PyAPI_FUNC(int) unpack_bitfields(struct BITS *bits, char name)
357357
{
358358
switch (name) {
359359
case 'A': return bits->A;
@@ -547,7 +547,7 @@ EXPORT (HRESULT) KeepObject(IUnknown *punk)
547547

548548
#endif
549549

550-
DL_EXPORT(void)
550+
PyMODINIT_FUNC
551551
init_ctypes_test(void)
552552
{
553553
Py_InitModule("_ctypes_test", module_methods);

Modules/_elementtree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2612,7 +2612,7 @@ static PyMethodDef _functions[] = {
26122612
{NULL, NULL}
26132613
};
26142614

2615-
DL_EXPORT(void)
2615+
PyMODINIT_FUNC
26162616
init_elementtree(void)
26172617
{
26182618
PyObject* m;

Modules/addrinfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ struct sockaddr_storage {
170170
#ifdef __cplusplus
171171
extern "C" {
172172
#endif
173-
extern void freehostent Py_PROTO((struct hostent *));
173+
extern void freehostent(struct hostent *);
174174
#ifdef __cplusplus
175175
}
176176
#endif

0 commit comments

Comments
 (0)
0