Anonymous avatar Anonymous committed a8e4327

Minor header cleanups for proper compat inclusion.

Comments (0)

Files changed (23)

src/base/internals.h

 #ifndef _PYGAME_BASE_INTERNALS_H_
 #define _PYGAME_BASE_INTERNALS_H_
 
-#include <Python.h>
 #include "pgcompat.h"
 #include "pgtypes.h"
 

src/base/pgbase.h

 #ifndef _PYGAME_BASE_H_
 #define _PYGAME_BASE_H_
 
-#include <Python.h>
 #include "pgcompat.h"
 #include "pgdefines.h"
 

src/freetype/ft_mod.h

 #ifndef _PYGAME_FREETYPEMOD_H_
 #define _PYGAME_FREETYPEMOD_H_
 
-#include <Python.h>
+#include "pgcompat.h"
 
 #define PYGAME_FREETYPE_INTERNAL
 #define PYGAME_FREETYPE_FONT_INTERNAL

src/mask/maskmod.h

 
 #define PYGAME_MASK_INTERNAL
 
-#include <Python.h>
 #include <math.h>
+#include "pgcompat.h"
 #include "pgdefines.h"
 #include "bitmask.h"
 

src/mask/pgmask.h

 #ifndef _PYGAME_MASK_H_
 #define _PYGAME_MASK_H_
 
-#include <Python.h>
 #include "bitmask.h"
 #include "pgbase.h"
 

src/physics/pgphysics.h

 #define _PHYSICS_H_
 
 #include <math.h>
-#include <Python.h>
-#include "pgcompat.h"
 #include "pgbase.h"
 
 #ifdef __cplusplus

src/physics/physicsmod.h

 #ifndef _PHYSICS_PHYSICSMOD_H_
 #define _PHYSICS_PHYSICSMOD_H_
 
-#include <Python.h>
+#include "pgcompat.h"
 #include <structmember.h>
 
 #define PHYSICS_MATH_INTERNAL

src/sdl/cdrommod.h

 #ifndef _PYGAME_SDLCDROM_H_
 #define _PYGAME_SDLCDROM_H_
 
-#include <Python.h>
+#include "pgcompat.h"
 #include <SDL.h>
 
 #define PYGAME_SDLCDROM_INTERNAL

src/sdl/eventmod.h

 #ifndef _PYGAME_SDLEVENT_H_
 #define _PYGAME_SDLEVENT_H_
 
-#include <Python.h>
+#include "pgcompat.h"
 #include <SDL.h>
 
 #define PYGAME_SDLEVENT_INTERNAL

src/sdl/joystickmod.h

 #ifndef _PYGAME_SDLJOYSTICK_H_
 #define _PYGAME_SDLJOYSTICK_H_
 
-#include <Python.h>
+#include "pgcompat.h"
 #include <SDL.h>
 
 #define PYGAME_SDLJOYSTICK_INTERNAL

src/sdl/mousemod.h

 #ifndef _PYGAME_SDLMOUSE_H_
 #define _PYGAME_SDLMOUSE_H_
 
-#include <Python.h>
+#include "pgcompat.h"
 #include <SDL.h>
 
 #define PYGAME_SDLCURSOR_INTERNAL
 #ifndef _PYGAME_SDL_H_
 #define _PYGAME_SDL_H_
 
-#include <Python.h>
 #include <SDL.h>
 
 #include "pgbase.h"
     int initialized : 1;
 } _SDLState;
 
-#ifdef IS_PYTHON_3
-static struct PyModuleDef _sdlmodule = {
-    PyModuleDef_HEAD_INIT,
-    "base",
-    DOC_BASE,
-    sizeof (_SDLState),
-    _sdl_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
-};
-#define SDL_MOD_STATE(mod) ((_BaseState*)PyModule_GetState(mod))
-#define SDL_STATE SDL_MOD_STATE(PyState_FindModule(&_sdlmodule))
-#else
-_SDLState _modstate;
-#define SDL_MOD_STATE(mod) (&_modstate)
-#define SDL_STATE SDL_MOD_STATE(NULL)
-#endif
-
 static void _quit (void);
 static int _check_sdl (void);
 
     { NULL, NULL, 0, NULL },
 };
 
+#ifdef IS_PYTHON_3
+static struct PyModuleDef _sdlmodule = {
+    PyModuleDef_HEAD_INIT,
+    "base",
+    DOC_BASE,
+    sizeof (_SDLState),
+    _sdl_methods,
+    NULL,
+    NULL,
+    NULL,
+    NULL
+};
+#define SDL_MOD_STATE(mod) ((_SDLState*)PyModule_GetState(mod))
+#define SDL_STATE SDL_MOD_STATE(PyState_FindModule(&_sdlmodule))
+#else
+_SDLState _modstate;
+#define SDL_MOD_STATE(mod) (&_modstate)
+#define SDL_STATE SDL_MOD_STATE(NULL)
+#endif
+
 static void
 _quit (void)
 {

src/sdl/videomod.h

 #ifndef _PYGAME_SDLVIDEO_H_
 #define _PYGAME_SDLVIDEO_H_
 
-#include <Python.h>
+#include "pgcompat.h"
 #include <SDL.h>
 
 #define PYGAME_SDLSURFACE_INTERNAL

src/sdlext/filters_32.c

     templine = (Uint16 *) malloc((size_t)(dstpitch * 2));
     if (templine == 0)
         return;
-    memset(templine, 0, dstpitch * 2);
+    memset(templine, 0, (size_t)(dstpitch * 2));
 
     asm __volatile__(" /* MMX code for Y-shrink area average filter */ "
         " movl             %5,      %%ecx;           " /* ecx == ycounter */
     templine = (Uint16 *) malloc((size_t)(dstpitch * 2));
     if (templine == 0)
         return;
-    memset(templine, 0, dstpitch * 2);
+    memset(templine, 0, (size_t)(dstpitch * 2));
     asm __volatile__(" /* MMX code for Y-shrink area average filter */ "
         " movl             %5,      %%ecx;           " /* ecx == ycounter */
         " pxor          %%mm0,      %%mm0;           "

src/sdlext/pgsdlext.h

 #ifndef _PYGAME_SDLEXT_H_
 #define _PYGAME_SDLEXT_H_
 
-#include <Python.h>
 #include <SDL.h>
 
 #include "pgbase.h"

src/sdlext/sdlextmod.h

 #ifndef _PYGAME_SDLEXTMOD_H_
 #define _PYGAME_SDLEXTMOD_H_
 
-#include <Python.h>
+#include "pgcompat.h"
 #include <SDL.h>
 
 #define PYGAME_SDLEXTPIXELARRAY_INTERNAL

src/sdlgfx/gfxmod.h

 #ifndef _PYGAME_SDLGFXMOD_H_
 #define _PYGAME_SDLGFXMOD_H_
 
-#include <Python.h>
+#include "pgcompat.h"
 #include <SDL.h>
 
 #define PYGAME_SDLGFXFPS_INTERNAL

src/sdlgfx/pggfx.h

 #ifndef _PYGAME_SDLGFX_H_
 #define _PYGAME_SDLGFX_H_
 
-#include <Python.h>
 #include <SDL.h>
 #include <SDL_framerate.h>
 

src/sdlmixer/mixermod.h

 #ifndef _PYGAME_SDLMIXERMOD_H_
 #define _PYGAME_SDLMIXERMOD_H_
 
-#include <Python.h>
+#include "pgcompat.h"
 #include <SDL_mixer.h>
 
 #define PYGAME_SDLMIXER_INTERNAL

src/sdlmixer/pgmixer.h

 #ifndef _PYGAME_SDLMIXER_H_
 #define _PYGAME_SDLMIXER_H_
 
-#include <Python.h>
 #include <SDL.h>
 #include <SDL_mixer.h>
 

src/sdlttf/pgttf.h

 #ifndef _PYGAME_SDLTTF_H_
 #define _PYGAME_SDLTTF_H_
 
-#include <Python.h>
 #include <SDL.h>
 #include <SDL_ttf.h>
 
 #include "pgbase.h"
 
-
 #ifdef __cplusplus
 extern "C" {
 #endif

src/sdlttf/ttfmod.h

 #ifndef _PYGAME_SDLTTFMOD_H_
 #define _PYGAME_SDLTTFMOD_H_
 
-#include <Python.h>
+#include "pgcompat.h"
 #include <SDL.h>
 
 #define PYGAME_SDLTTF_INTERNAL
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.