From f3f8de20114405bae29a354d67c38a7bf0b096a2 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 23 Feb 2009 23:04:35 -0500 Subject: Bug 572790 - Don't register #defines from .c files as constants We keep track of the source filename for every symbol. This enables us to later filter symbols based on that name. --- giscanner/giscannermodule.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'giscanner/giscannermodule.c') diff --git a/giscanner/giscannermodule.c b/giscanner/giscannermodule.c index b7ac3167..7d637845 100644 --- a/giscanner/giscannermodule.c +++ b/giscanner/giscannermodule.c @@ -151,6 +151,19 @@ symbol_get_const_string (PyGISourceSymbol *self, return PyString_FromString (self->symbol->const_string); } +static PyObject * +symbol_get_source_filename (PyGISourceSymbol *self, + void *context) +{ + if (!self->symbol->source_filename) + { + Py_INCREF(Py_None); + return Py_None; + } + + return PyString_FromString (self->symbol->source_filename); +} + static const PyGetSetDef _PyGISourceSymbol_getsets[] = { /* int ref_count; */ { "type", (getter)symbol_get_type, NULL, NULL}, @@ -159,7 +172,8 @@ static const PyGetSetDef _PyGISourceSymbol_getsets[] = { { "base_type", (getter)symbol_get_base_type, NULL, NULL}, /* gboolean const_int_set; */ { "const_int", (getter)symbol_get_const_int, NULL, NULL}, - { "const_string", (getter)symbol_get_const_string, NULL, NULL}, + { "const_string", (getter)symbol_get_const_string, NULL, NULL}, + { "source_filename", (getter)symbol_get_source_filename, NULL, NULL}, { 0 } }; -- cgit v1.2.1