THRIFT-1003 Polishing c_glib code

Patch: Anatol Pomozov


git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1039299 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/c_glib/src/thrift_struct.c b/lib/c_glib/src/thrift_struct.c
index 3f73c38..8a0928a 100644
--- a/lib/c_glib/src/thrift_struct.c
+++ b/lib/c_glib/src/thrift_struct.c
@@ -1,41 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "thrift.h"
 #include "thrift_struct.h"
 
-static void
-thrift_struct_class_init (ThriftStructClass *cls)
-{
-  ThriftStructClass *c = THRIFT_STRUCT_CLASS (cls);
-  c->read = thrift_struct_read;
-  c->write = thrift_struct_write;
-}
-
-GType
-thrift_struct_get_type (void)
-{
-  static GType type = 0;
-
-  if (type == 0)
-  {
-    static const GTypeInfo type_info =
-      {
-        sizeof (ThriftStructClass),
-        NULL, /* base_init */
-        NULL, /* base finalize */
-        (GClassInitFunc) thrift_struct_class_init,
-        NULL, /* class finalize */
-        NULL, /* class data */
-        sizeof (ThriftStruct),
-        0, /* n_preallocs */
-        NULL, /* instance_init */
-        NULL, /* value_table */
-      };
-
-    type = g_type_register_static (G_TYPE_OBJECT,
-                                   "ThriftStructType",
-                                   &type_info, G_TYPE_FLAG_ABSTRACT);
-  }
-
-  return type;
-}
+G_DEFINE_ABSTRACT_TYPE(ThriftStruct, thrift_struct, G_TYPE_OBJECT)
 
 gint32
 thrift_struct_read (ThriftStruct *object, ThriftProtocol *protocol,
@@ -53,3 +38,15 @@
   return THRIFT_STRUCT_GET_CLASS (object)->write (object, protocol, error);
 }
 
+static void
+thrift_struct_class_init (ThriftStructClass *cls)
+{
+  cls->read = thrift_struct_read;
+  cls->write = thrift_struct_write;
+}
+
+static void
+thrift_struct_init (ThriftStruct *structure)
+{
+  THRIFT_UNUSED_VAR (structure);
+}