ack/util/ceg/ce_back/obj_back/memory.c

73 lines
1.6 KiB
C
Raw Normal View History

1987-11-20 10:41:03 +00:00
#include <out.h>
#include <system.h>
#include "data.h"
#include "hash.h"
1988-10-20 13:06:10 +00:00
#include <alloc.h>
1987-11-20 10:41:03 +00:00
1987-11-25 13:54:01 +00:00
/* The routines allocate more space for the segments and update the
* global variables. Each time the space asked for is multiplied with 2.
*/
1987-11-20 10:41:03 +00:00
mem_text()
{
/* print( "text_area too small %d %d \n", text_area, text); */
1988-10-20 13:06:10 +00:00
int diff = text - text_area;
1987-11-20 10:41:03 +00:00
1988-10-20 13:06:10 +00:00
text_area = Realloc( text_area, sizeof( char) * 2 * size_text);
text = text_area + diff;
_text_cnt += size_text;
1987-11-20 10:41:03 +00:00
size_text = 2 * size_text;
}
mem_data()
{
/* print( "data_area too small\n"); */
1988-10-20 13:06:10 +00:00
int diff = data - data_area;
1987-11-20 10:41:03 +00:00
1988-10-20 13:06:10 +00:00
data_area = Realloc( data_area, sizeof( char) * 2 * size_data);
data = data_area + diff;
_data_cnt += size_data;
1987-11-20 10:41:03 +00:00
size_data = 2 * size_data;
}
mem_symbol_hash()
{
/* print( "symbol_table out of memory\n"); */
size_symbol = 2 * size_symbol;
1988-10-20 13:06:10 +00:00
symbol_table = (struct outname *) Realloc( (char *) symbol_table,
1987-11-20 10:41:03 +00:00
sizeof( struct outname) * size_symbol);
/* print( "hash out of memory\n"); */
1988-10-20 13:06:10 +00:00
Hashitems = (struct Hashitem *) Realloc( (char *) Hashitems,
1987-11-20 10:41:03 +00:00
sizeof( struct Hashitem)*(size_symbol+1));
}
mem_relo()
{
/* print( "reloc_table out of memory\n"); */
1988-10-20 13:06:10 +00:00
int diff = relo - reloc_info;
1987-11-20 10:41:03 +00:00
1988-10-20 13:06:10 +00:00
reloc_info = (struct outrelo *) Realloc( (char *) reloc_info,
1987-11-20 10:41:03 +00:00
sizeof( struct outrelo) * 2 * size_reloc);
1988-10-20 13:06:10 +00:00
relo = reloc_info + diff;
1987-11-20 10:41:03 +00:00
size_reloc = 2 * size_reloc;
}
mem_string()
{
1988-10-20 13:06:10 +00:00
int diff = string - string_area;
1987-11-20 10:41:03 +00:00
/* print( "string_area out of memory %d %d \n", string_area, string);*/
size_string = 2 * size_string;
1988-10-20 13:06:10 +00:00
string_area = Realloc( string_area, sizeof( char) * size_string);
string = string_area + diff;
1987-11-20 10:41:03 +00:00
}