(Mostly) Clean up floatnum internal allocations.

svn path=/trunk/yasm/; revision=370
0.3
Peter Johnson 24 years ago
parent a9a74064b4
commit 4bcb83da56
  1. 3
      frontends/yasm/yasm.c
  2. 23
      libyasm/floatnum.c
  3. 3
      libyasm/floatnum.h
  4. 23
      src/floatnum.c
  5. 3
      src/floatnum.h
  6. 3
      src/main.c

@ -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;
}

@ -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)
{

@ -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);

@ -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)
{

@ -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);

@ -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;
}

Loading…
Cancel
Save