~ubuntu-branches/ubuntu/precise/python-lzma/precise

« back to all changes in this revision

Viewing changes to src/liblzma.h

  • Committer: Bazaar Package Importer
  • Author(s): Richard Darst
  • Date: 2010-04-19 14:16:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100419141648-qwz3nm7shemqp37n
Tags: 0.5.3-1
* New upstream version
* Upgrade to 3.0 (quilt) just to be able to use .orig.tar.bz2
* Bump standards-version to 3.8.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef LIBLZMA_H
 
2
#define LIBLZMA_H 1
 
3
 
 
4
/* To handle length as ssize_t in stead of int, otherwise we'd either have to
 
5
 * use the internal _PyArg_ParseTuple_SizeT function to avoid screwups
 
6
 */
 
7
#define PY_SSIZE_T_CLEAN 1
 
8
#include <Python.h>
 
9
#include <stdio.h>
 
10
#include <stdlib.h>
 
11
#if defined (__APPLE__) || defined(__FreeBSD__) || \
 
12
    defined(__OpenBSD__) || defined(__NetBSD__) || \
 
13
    defined (__sun) || defined (__svr4__)
 
14
#include <stdlib.h>
 
15
#else
 
16
#include <malloc.h>
 
17
#endif
 
18
#include <string.h>
 
19
#include <inttypes.h>
 
20
#if !defined(linux) && !defined(__sun) && !defined(__svr4__)
 
21
typedef unsigned long ulong;
 
22
#endif
 
23
#include <sys/types.h>
 
24
#include <lzma.h>
 
25
 
 
26
#ifdef WITH_THREAD
 
27
#include <pythread.h>
 
28
#define ACQUIRE_LOCK(obj) do { \
 
29
        if (!PyThread_acquire_lock(obj->lock, 0)) { \
 
30
                Py_BEGIN_ALLOW_THREADS \
 
31
                PyThread_acquire_lock(obj->lock, 1); \
 
32
                Py_END_ALLOW_THREADS \
 
33
        } } while(0)
 
34
#define RELEASE_LOCK(obj) PyThread_release_lock(obj->lock)
 
35
#else
 
36
#define ACQUIRE_LOCK(obj)
 
37
#define RELEASE_LOCK(obj)
 
38
#endif
 
39
 
 
40
#ifdef __STDC_VERSION__
 
41
#if __STDC_VERSION__ >= 199901L
 
42
#include <stdbool.h>
 
43
#endif
 
44
#elif defined(__C99FEATURES__)
 
45
#include <stdbool.h>
 
46
#else
 
47
#define bool    uint8_t
 
48
#define true    1
 
49
#define false   0
 
50
#ifndef inline
 
51
#define inline __inline__
 
52
#endif
 
53
#endif
 
54
 
 
55
#define INITCHECK if (!self->is_initialised) {  PyErr_Format(PyExc_RuntimeError, "%s object not initialised!", self->ob_type->tp_name); return NULL; }
 
56
 
 
57
#endif /* LIBLZMA_H */