Pessimistic memory allocation.

* Added/removed headers as necessary
* Removed 'key_event' function from keyboard
This commit is contained in:
Murilo Pereira
2011-02-06 03:45:58 -02:00
parent d1a7d6fc24
commit 75d1e5f23b
17 changed files with 81 additions and 24 deletions
+8 -1
View File
@@ -1,8 +1,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include <errno.h>
#include "card.h"
void allocate_card(struct card **card) {
*card = malloc(sizeof(**card));
if (!(*card = malloc(sizeof(**card)))) {
fprintf(stderr, "%s: %s (%s:%d)\n", program_name, strerror(errno), __FILE__, __LINE__ - 1);
exit(errno);
}
allocate_frame(&((*card)->frame));