]> granicus.if.org Git - yasm/commitdiff
(Mostly) Clean up floatnum internal allocations.
authorPeter Johnson <peter@tortall.net>
Sat, 1 Dec 2001 19:19:56 +0000 (19:19 -0000)
committerPeter Johnson <peter@tortall.net>
Sat, 1 Dec 2001 19:19:56 +0000 (19:19 -0000)
svn path=/trunk/yasm/; revision=370

frontends/yasm/yasm.c
libyasm/floatnum.c
libyasm/floatnum.h
src/floatnum.c
src/floatnum.h
src/main.c

index 18a8f55079235ae6b598f4f15b8f5753cdbb157e..ef560eae7a9350e87c983db97ff369880044d7df 100644 (file)
@@ -37,6 +37,7 @@
 #include "globals.h"
 #include "options.h"
 #include "errwarn.h"
+#include "floatnum.h"
 #include "symrec.h"
 
 #include "bytecode.h"
@@ -205,6 +206,8 @@ main(int argc, char *argv[])
     symrec_delete_all();
     filename_delete_all();
 
+    floatnum_shutdown();
+
     BitVector_Shutdown();
     return EXIT_SUCCESS;
 }
index 0f8e870be5fb14e2981e25363fc321cdafa4f88a..d9006349b3dda38c7f4c56a89a63534b258c44b5 100644 (file)
@@ -183,6 +183,29 @@ POT_Table_Init(void)
 }
 /*@=compdef@*/
 
+/*@-globstate@*/
+void
+floatnum_shutdown(void)
+{
+    int i;
+
+    if (!POT_TableN)
+       return;
+
+    /* Un-offset POT_TableP */
+    POT_TableP--;
+
+    for (i=0; i<14; i++) {
+       BitVector_Destroy(POT_TableN[i].f.mantissa);
+       BitVector_Destroy(POT_TableP[i].f.mantissa);
+    }
+    BitVector_Destroy(POT_TableP[14].f.mantissa);
+
+    xfree(POT_TableN);
+    xfree(POT_TableP);
+}
+/*@=globstate@*/
+
 static void
 floatnum_normalize(floatnum *flt)
 {
index b5ab637cee783d6c909ab30d344c127b09ec35ae..c699e317527f8c3a5cda38859f5c61b8781790bd 100644 (file)
@@ -24,6 +24,9 @@
 #ifndef YASM_FLOATNUM_H
 #define YASM_FLOATNUM_H
 
+/* Clean up internal allocations */
+void floatnum_shutdown(void);
+
 /*@only@*/ floatnum *floatnum_new(const char *str);
 /*@only@*/ floatnum *floatnum_copy(const floatnum *flt);
 void floatnum_delete(/*@only@*/ floatnum *flt);
index 0f8e870be5fb14e2981e25363fc321cdafa4f88a..d9006349b3dda38c7f4c56a89a63534b258c44b5 100644 (file)
@@ -183,6 +183,29 @@ POT_Table_Init(void)
 }
 /*@=compdef@*/
 
+/*@-globstate@*/
+void
+floatnum_shutdown(void)
+{
+    int i;
+
+    if (!POT_TableN)
+       return;
+
+    /* Un-offset POT_TableP */
+    POT_TableP--;
+
+    for (i=0; i<14; i++) {
+       BitVector_Destroy(POT_TableN[i].f.mantissa);
+       BitVector_Destroy(POT_TableP[i].f.mantissa);
+    }
+    BitVector_Destroy(POT_TableP[14].f.mantissa);
+
+    xfree(POT_TableN);
+    xfree(POT_TableP);
+}
+/*@=globstate@*/
+
 static void
 floatnum_normalize(floatnum *flt)
 {
index b5ab637cee783d6c909ab30d344c127b09ec35ae..c699e317527f8c3a5cda38859f5c61b8781790bd 100644 (file)
@@ -24,6 +24,9 @@
 #ifndef YASM_FLOATNUM_H
 #define YASM_FLOATNUM_H
 
+/* Clean up internal allocations */
+void floatnum_shutdown(void);
+
 /*@only@*/ floatnum *floatnum_new(const char *str);
 /*@only@*/ floatnum *floatnum_copy(const floatnum *flt);
 void floatnum_delete(/*@only@*/ floatnum *flt);
index 18a8f55079235ae6b598f4f15b8f5753cdbb157e..ef560eae7a9350e87c983db97ff369880044d7df 100644 (file)
@@ -37,6 +37,7 @@
 #include "globals.h"
 #include "options.h"
 #include "errwarn.h"
+#include "floatnum.h"
 #include "symrec.h"
 
 #include "bytecode.h"
@@ -205,6 +206,8 @@ main(int argc, char *argv[])
     symrec_delete_all();
     filename_delete_all();
 
+    floatnum_shutdown();
+
     BitVector_Shutdown();
     return EXIT_SUCCESS;
 }