Pessimistic memory allocation.
* Added/removed headers as necessary * Removed 'key_event' function from keyboard
This commit is contained in:
+9
-2
@@ -1,10 +1,17 @@
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "stack.h"
|
||||
#include "game.h"
|
||||
|
||||
void allocate_stack(struct stack **stack) {
|
||||
*stack = malloc(sizeof(**stack));
|
||||
if (!(*stack = malloc(sizeof(**stack)))) {
|
||||
fprintf(stderr, "%s: %s (%s:%d)\n", program_name, strerror(errno), __FILE__, __LINE__ - 1);
|
||||
exit(errno);
|
||||
}
|
||||
|
||||
allocate_card(&((*stack)->card));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user