[pygobject] gi/pygi-info.c, gi/pygi-repository.c: Deal with C99isms



commit 9e0c41509d62e8df7d0d82608a8be75f3defe05c
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Jan 25 13:05:18 2013 +0800

    gi/pygi-info.c, gi/pygi-repository.c: Deal with C99isms
    
    Drop the array forward static declarations. They are not necessary and are not
    valid in C89.
    
    Also move declarations of variables to the top of their respective blocks.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692856

 gi/pygi-info.c       |   18 ++++++++++--------
 gi/pygi-repository.c |    2 --
 2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/gi/pygi-info.c b/gi/pygi-info.c
index cd3d97d..4d5b9bb 100644
--- a/gi/pygi-info.c
+++ b/gi/pygi-info.c
@@ -88,8 +88,6 @@ _base_info_richcompare (PyGIBaseInfo *self, PyObject *other, int op)
     return res;
 }
 
-static PyMethodDef _PyGIBaseInfo_methods[];
-
 PYGLIB_DEFINE_TYPE("gi.BaseInfo", PyGIBaseInfo_Type, PyGIBaseInfo);
 
 static PyObject *
@@ -406,11 +404,14 @@ _g_arg_get_pytype_hint (PyGIBaseInfo *self)
 {
     GIArgInfo *arg_info = (GIArgInfo*)self->info;
     GITypeInfo type_info;
+    GITypeTag type_tag;
+    PyObject *py_type;
+
     g_arg_info_load_type(arg_info, &type_info);
-    GITypeTag type_tag = g_type_info_get_tag(&type_info);
+    type_tag = g_type_info_get_tag(&type_info);
 
     /* First attempt getting a python type object. */
-    PyObject *py_type = _pygi_get_py_type_hint(type_tag);
+    py_type = _pygi_get_py_type_hint(type_tag);
     if (py_type != Py_None && PyObject_HasAttrString(py_type, "__name__")) {
 	PyObject *name = PyObject_GetAttrString(py_type, "__name__");
 	Py_DecRef(py_type);
@@ -422,8 +423,9 @@ _g_arg_get_pytype_hint (PyGIBaseInfo *self)
 	    gchar *name = g_strdup_printf("%s.%s",
 		    g_base_info_get_namespace(iface),
 		    g_base_info_get_name (iface));
+        PyObject *py_string;
 	    g_base_info_unref(iface);
-	    PyObject *py_string = PYGLIB_PyUnicode_FromString(name);
+	    py_string = PYGLIB_PyUnicode_FromString(name);
 	    g_free(name);
 	    return py_string;
 	}
@@ -908,11 +910,11 @@ pygi_g_struct_info_is_simple (GIStructInfo *struct_info)
     for (i = 0; i < n_field_infos && is_simple; i++) {
         GIFieldInfo *field_info;
         GITypeInfo *field_type_info;
+        GITypeTag field_type_tag;
 
         field_info = g_struct_info_get_field (struct_info, i);
         field_type_info = g_field_info_get_type (field_info);
 
-        GITypeTag field_type_tag;
 
         field_type_tag = g_type_info_get_tag (field_type_info);
 
@@ -1512,13 +1514,13 @@ _wrap_g_field_info_set_value (PyGIBaseInfo *self,
     } else if (g_type_info_is_pointer (field_type_info)
             && (g_type_info_get_tag (field_type_info) == GI_TYPE_TAG_VOID
                 || g_type_info_get_tag (field_type_info) == GI_TYPE_TAG_UTF8)) {
-
+        int offset;
         value = _pygi_argument_from_object (py_value, field_type_info, GI_TRANSFER_NOTHING);
         if (PyErr_Occurred()) {
             goto out;
         }
 
-        int offset = g_field_info_get_offset ((GIFieldInfo *) self->info);
+        offset = g_field_info_get_offset ((GIFieldInfo *) self->info);
         G_STRUCT_MEMBER (gpointer, pointer, offset) = (gpointer)value.v_pointer;
 
         retval = Py_None;
diff --git a/gi/pygi-repository.c b/gi/pygi-repository.c
index 7de293a..d54326d 100644
--- a/gi/pygi-repository.c
+++ b/gi/pygi-repository.c
@@ -27,8 +27,6 @@
 
 PyObject *PyGIRepositoryError;
 
-static PyMethodDef _PyGIRepository_methods[];
-
 PYGLIB_DEFINE_TYPE("gi.Repository", PyGIRepository_Type, PyGIRepository);
 
 static PyObject *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]