?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #include <stdlib.h>
  2.  
  3. #include "mhmt-globals.h"
  4.  
  5.  
  6. struct globals wrk;
  7.  
  8. // init wrk container
  9. void init_globals(void)
  10. {
  11.         wrk.packtype = PK_MLZ;
  12.         wrk.greedy   = 0;
  13.         wrk.mode     = 0;
  14.         wrk.zxheader = 0;
  15.         wrk.wordbit  = 0;
  16.         wrk.bigend   = 0;
  17.         wrk.fullbits = 0;
  18.         wrk.maxwin   = 4352;
  19.         wrk.prebin   = 0;
  20.  
  21.         wrk.fname_in     = NULL;
  22.         wrk.fname_out    = NULL;
  23.         wrk.fname_prebin = NULL;
  24.  
  25.         wrk.file_in     = NULL;
  26.         wrk.file_out    = NULL;
  27.         wrk.file_prebin = NULL;
  28.  
  29.         wrk.indata     = NULL;
  30.         wrk.indata_raw = NULL;
  31.        
  32.         wrk.inlen  = 0;
  33.  
  34.         wrk.prelen  = 0;
  35. }
  36.  
  37.  
  38.  
  39. // free all stuff from wrk container
  40. void free_globals(void)
  41. {
  42.         if( wrk.indata_raw ) free( wrk.indata_raw );
  43.  
  44.         if( wrk.file_out    ) fclose( wrk.file_out    );
  45.         if( wrk.file_in     ) fclose( wrk.file_in     );
  46.         if( wrk.file_prebin ) fclose( wrk.file_prebin );
  47.  
  48.         if( wrk.fname_out    ) free( wrk.fname_out    );
  49.         if( wrk.fname_in     ) free( wrk.fname_in     );
  50.         if( wrk.fname_prebin ) free( wrk.fname_prebin );
  51. }
  52.  
  53.