Commits

Lenard Lindstrom  committed 5114f26

Make PyBUF_HAS_FLAG macro available to all C source files.

  • Participants
  • Parent commits b3ee3ed

Comments (0)

Files changed (3)

 #define INT_CHECK(o) (PyInt_Check(o) || PyLong_Check(o))
 #endif
 
-#define PyBUF_HAS_FLAG(f, F) (((f) & (F)) == (F))
-
 /* Extended array struct */
 typedef struct capsule_interface_s {
     PyArrayInterface inter;

File src/pygame.h

 #define PyBUF_SHADOW 0x400
 #endif /* #if !defined(PyBUF_SIMPLE) */
 
+#define PyBUF_HAS_FLAG(f, F) (((f) & (F)) == (F))
+
 /* Array information exchange struct C type; inherits from Py_buffer */
 
 struct pg_bufferinfo_s;

File src/surface.c

     VIEWKIND_RAW
 } SurfViewKind;
 
-#define PyBUF_HAS_FLAG(f, F) (((f) & (F)) == (F))
-#define PyBUF_NO_DIM (PyBUF_WRITABLE | PyBUF_FORMAT)
-#define PyBUF_IS_DIMLESS(f) (((f) | PyBUF_NO_DIM) == PyBUF_NO_DIM)
-
 /* To avoid problems with non-const Py_buffer format field */
 static char FormatUint8[] = "B";
 static char FormatUint16[] = "=H";
     int itemsize = surface->format->BytesPerPixel;
 
     view_p->obj = 0;
-    if (PyBUF_IS_DIMLESS (flags)) {
+    if (!PyBUF_HAS_FLAG (flags, PyBUF_ND)) {
         if (surface->pitch != surface->w * itemsize) {
             PyErr_SetString (PgExc_BufferError,
                              "A 2D surface view is not C contiguous");