~asdfghjkl-deactivatedaccount1/python-imaging/gif-fix

« back to all changes in this revision

Viewing changes to map.c

  • Committer: effbot
  • Date: 2006-07-05 20:36:11 UTC
  • Revision ID: svn-v4:be285980-f00d-0410-a9fe-d4747b46ecd0:pil:348
Load Imaging-1.1.6b1 into pil.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * The Python Imaging Library.
3
 
 * $Id: map.c 2319 2005-03-11 16:41:26Z fredrik $
 
3
 * $Id: map.c 2751 2006-06-18 19:50:45Z fredrik $
4
4
 *
5
5
 * standard memory mapping interface for the Imaging library
6
6
 *
22
22
#include "Python.h"
23
23
 
24
24
#if PY_VERSION_HEX < 0x01060000
25
 
#define PyObject_DEL(op) PyMem_DEL((op))
 
25
#define PyObject_New PyObject_NEW
 
26
#define PyObject_Del PyMem_DEL
26
27
#endif
27
28
 
28
29
#include "Imaging.h"
60
61
 
61
62
    ImagingMapperType.ob_type = &PyType_Type;
62
63
 
63
 
    mapper = PyObject_NEW(ImagingMapperObject, &ImagingMapperType);
 
64
    mapper = PyObject_New(ImagingMapperObject, &ImagingMapperType);
64
65
    if (mapper == NULL)
65
66
        return NULL;
66
67
 
81
82
        NULL);
82
83
    if (mapper->hFile == (HANDLE)-1) {
83
84
        PyErr_SetString(PyExc_IOError, "cannot open file");
84
 
        PyObject_DEL(mapper);
 
85
        PyObject_Del(mapper);
85
86
        return NULL;
86
87
    }
87
88
 
92
93
    if (mapper->hMap == (HANDLE)-1) {
93
94
        CloseHandle(mapper->hFile);
94
95
        PyErr_SetString(PyExc_IOError, "cannot map file");
95
 
        PyObject_DEL(mapper);
 
96
        PyObject_Del(mapper);
96
97
        return NULL;
97
98
    }
98
99
 
120
121
    mapper->base = 0;
121
122
    mapper->hMap = mapper->hFile = (HANDLE)-1;
122
123
#endif
123
 
    PyObject_DEL(mapper);
 
124
    PyObject_Del(mapper);
124
125
}
125
126
 
126
127
/* -------------------------------------------------------------------- */