Author: toshok
Date: 2007-06-20 16:30:30 -0400 (Wed, 20 Jun 2007)
New Revision: 80361

Modified:
   trunk/moon/src/ChangeLog
   trunk/moon/src/type.cpp
   trunk/moon/src/type.cpp.in
   trunk/moon/src/type.h
   trunk/moon/src/type.h.in
Log:
2007-06-20  Chris Toshok  <[EMAIL PROTECTED]>

        * runtime.cpp (runtime_shutdown): set inited to false, since we
        want people to be able to call runtime_init again after this.

        * type.cpp.in (Type::RegisterType): allocate types if we need to.
        (Type::Shutdown): free types.

        * type.h.in (private): make the types array dynamically allocated.

        * type.h, type.cpp: sync



Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2007-06-20 20:21:26 UTC (rev 80360)
+++ trunk/moon/src/ChangeLog    2007-06-20 20:30:30 UTC (rev 80361)
@@ -1,3 +1,15 @@
+2007-06-20  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * runtime.cpp (runtime_shutdown): set inited to false, since we
+       want people to be able to call runtime_init again after this.
+
+       * type.cpp.in (Type::RegisterType): allocate types if we need to.
+       (Type::Shutdown): free types.
+
+       * type.h.in (private): make the types array dynamically allocated.
+
+       * type.h, type.cpp: sync
+
 2007-06-20  Jeffrey Stedfast  <[EMAIL PROTECTED]>
 
        * text.cpp (TextBlock): Need to actually set ActualWidth and

Modified: trunk/moon/src/type.cpp
===================================================================
--- trunk/moon/src/type.cpp     2007-06-20 20:21:26 UTC (rev 80360)
+++ trunk/moon/src/type.cpp     2007-06-20 20:30:30 UTC (rev 80361)
@@ -28,7 +28,7 @@
        Type implementation
 */
 
-Type* Type::types [];
+Type** Type::types;
 GHashTable* Type::types_by_name = NULL;
 
 Type::Type (char *name, Type::Kind type, Type::Kind parent)
@@ -65,7 +65,7 @@
 Type::RegisterType (char *name, Type::Kind type, Type::Kind parent, bool 
value_type)
 {
        if (types == NULL) {
-               memset (&types, 0, Type::LASTTYPE * sizeof (Type*));
+               types = (Type**)calloc (Type::LASTTYPE, sizeof (Type*));
        }
        if (types_by_name == NULL) {
                types_by_name = g_hash_table_new_full (g_str_hash, g_str_equal,
@@ -125,6 +125,10 @@
 void
 Type::Shutdown ()
 {
+       if (types) {
+               g_free (types);
+               types = NULL;
+       }
        if (types_by_name) {
                g_hash_table_destroy (types_by_name);
                types_by_name = NULL;

Modified: trunk/moon/src/type.cpp.in
===================================================================
--- trunk/moon/src/type.cpp.in  2007-06-20 20:21:26 UTC (rev 80360)
+++ trunk/moon/src/type.cpp.in  2007-06-20 20:30:30 UTC (rev 80361)
@@ -23,7 +23,7 @@
        Type implementation
 */
 
-Type* Type::types [];
+Type** Type::types;
 GHashTable* Type::types_by_name = NULL;
 
 Type::Type (char *name, Type::Kind type, Type::Kind parent)
@@ -60,7 +60,7 @@
 Type::RegisterType (char *name, Type::Kind type, Type::Kind parent, bool 
value_type)
 {
        if (types == NULL) {
-               memset (&types, 0, Type::LASTTYPE * sizeof (Type*));
+               types = (Type**)calloc (Type::LASTTYPE, sizeof (Type*));
        }
        if (types_by_name == NULL) {
                types_by_name = g_hash_table_new_full (g_str_hash, g_str_equal,
@@ -120,6 +120,10 @@
 void
 Type::Shutdown ()
 {
+       if (types) {
+               g_free (types);
+               types = NULL;
+       }
        if (types_by_name) {
                g_hash_table_destroy (types_by_name);
                types_by_name = NULL;

Modified: trunk/moon/src/type.h
===================================================================
--- trunk/moon/src/type.h       2007-06-20 20:21:26 UTC (rev 80360)
+++ trunk/moon/src/type.h       2007-06-20 20:30:30 UTC (rev 80361)
@@ -169,7 +169,7 @@
 private:
        Type (char *name, Type::Kind type, Type::Kind parent);
        ~Type ();
-       static Type* types [Type::LASTTYPE];
+       static Type** types;
        static GHashTable *types_by_name;
        static void free_type (gpointer v);
 };

Modified: trunk/moon/src/type.h.in
===================================================================
--- trunk/moon/src/type.h.in    2007-06-20 20:21:26 UTC (rev 80360)
+++ trunk/moon/src/type.h.in    2007-06-20 20:30:30 UTC (rev 80361)
@@ -60,7 +60,7 @@
 private:
        Type (char *name, Type::Kind type, Type::Kind parent);
        ~Type ();
-       static Type* types [Type::LASTTYPE];
+       static Type** types;
        static GHashTable *types_by_name;
        static void free_type (gpointer v);
 };

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to