|
Revision 99fab9089e9e1709d9c3a4bc5ced0c137ac59134, 1.0 kB
(checked in by Rémi Denis-Courmont <rem@videolan.org>, 7 months ago)
|
Don't include config.h from the headers - refs #297.
Missing some cases that I could not test.
Also ffmpeg/chroma.c is locked, so I can but leave it broken.
Fix is for the remaining modules is obvious and the issue is easy to detect.
|
- Property mode set to
100644
|
| Line | |
|---|
| 1 |
#include "../pyunit.h" |
|---|
| 2 |
#ifdef HAVE_CONFIG_H |
|---|
| 3 |
# include "config.h" |
|---|
| 4 |
#endif |
|---|
| 5 |
|
|---|
| 6 |
#include <vlc/vlc.h> |
|---|
| 7 |
|
|---|
| 8 |
struct mygc |
|---|
| 9 |
{ |
|---|
| 10 |
VLC_GC_MEMBERS; |
|---|
| 11 |
int i; |
|---|
| 12 |
}; |
|---|
| 13 |
|
|---|
| 14 |
typedef struct mygc mygc; |
|---|
| 15 |
|
|---|
| 16 |
static void mygc_destructor( gc_object_t *p_gc ) |
|---|
| 17 |
{ |
|---|
| 18 |
free( p_gc ); |
|---|
| 19 |
p_gc = NULL; |
|---|
| 20 |
}; |
|---|
| 21 |
|
|---|
| 22 |
static PyObject *gc_test( PyObject *self, PyObject *args ) |
|---|
| 23 |
{ |
|---|
| 24 |
mygc *gc = (mygc *)malloc( sizeof( mygc ) ); |
|---|
| 25 |
|
|---|
| 26 |
vlc_gc_init( gc, mygc_destructor, NULL ); |
|---|
| 27 |
ASSERT( gc->i_gc_refcount == 0, "Refcount should be 0" ); |
|---|
| 28 |
vlc_gc_incref( gc ); |
|---|
| 29 |
ASSERT( gc->i_gc_refcount == 1, "Refcount should be 1" ); |
|---|
| 30 |
vlc_gc_incref( gc ); |
|---|
| 31 |
ASSERT( gc->i_gc_refcount == 2, "Refcount should be 2" ); |
|---|
| 32 |
gc->i++; |
|---|
| 33 |
vlc_gc_decref( gc ); |
|---|
| 34 |
ASSERT( gc->i_gc_refcount == 1, "Refcount should be 1" ); |
|---|
| 35 |
vlc_gc_decref( gc ); |
|---|
| 36 |
|
|---|
| 37 |
Py_INCREF( Py_None ); |
|---|
| 38 |
return Py_None; |
|---|
| 39 |
}; |
|---|
| 40 |
|
|---|
| 41 |
static PyMethodDef native_gc_test_methods[] = { |
|---|
| 42 |
DEF_METHOD( gc_test, "Test GC" ) |
|---|
| 43 |
{ NULL, NULL, 0, NULL } |
|---|
| 44 |
}; |
|---|
| 45 |
|
|---|
| 46 |
asserts = 0; |
|---|
| 47 |
|
|---|
| 48 |
DECLARE_MODULE( native_gc_test ) |
|---|