use malloc instead of sbrk
This commit is contained in:
		
							parent
							
								
									6d85667761
								
							
						
					
					
						commit
						16c73e6654
					
				
					 4 changed files with 7 additions and 7 deletions
				
			
		|  | @ -114,7 +114,7 @@ extern FILE	*fftemp(); | |||
| /* some library functions used */ | ||||
| extern long	atol(); | ||||
| extern char	*mktemp(); | ||||
| extern char	*sbrk(); | ||||
| extern char	*malloc(); | ||||
| extern char	*getenv(); | ||||
| 
 | ||||
| /* ========== Machine dependent C declarations ========== */ | ||||
|  |  | |||
|  | @ -474,8 +474,8 @@ item_alloc(typ) | |||
| 	static item_t *next; | ||||
| 
 | ||||
| 	if (--nleft < 0) { | ||||
| 		next = (item_t *) sbrk(MEMINCR); | ||||
| 		if ((int) next == -1) | ||||
| 		next = (item_t *) malloc(MEMINCR); | ||||
| 		if (next == 0) | ||||
| 			fatal("out of memory"); | ||||
| 		nleft += (MEMINCR / sizeof(item_t)); | ||||
| 	} | ||||
|  |  | |||
|  | @ -398,8 +398,8 @@ new_common(ip) | |||
| 	static struct common_t *next; | ||||
| 
 | ||||
| 	if (--nleft < 0) { | ||||
| 		next = (struct common_t *) sbrk(MEMINCR); | ||||
| 		if ((int) next == -1) { | ||||
| 		next = (struct common_t *) malloc(MEMINCR); | ||||
| 		if (next == 0) { | ||||
| 			fatal("out of memory"); | ||||
| 		} | ||||
| 		nleft += (MEMINCR / sizeof (struct common_t)); | ||||
|  |  | |||
|  | @ -70,8 +70,8 @@ register char *s; | |||
| 		n++; | ||||
| 	while (*p++); | ||||
| 	if ((nleft -= n) < 0) { | ||||
| 		next = sbrk(MEMINCR); | ||||
| 		if ((int) next == -1) | ||||
| 		next = malloc(MEMINCR); | ||||
| 		if (next == 0) | ||||
| 			fatal("out of memory"); | ||||
| 		nleft = (MEMINCR / sizeof(char)) - n; | ||||
| 		assert(nleft >= 0); | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue