Correct warning if used -Wextra
This commit is contained in:
parent
fc6afeda5b
commit
a4b5f36b3c
@ -109,6 +109,10 @@ void __free_string_array(char** arr, size_t size) {
|
||||
|
||||
static void* __sized_malloc(size_t size) {
|
||||
void* ptr = malloc(size);
|
||||
if (ptr == NULL) {
|
||||
puts("Out of memory!");
|
||||
abort();
|
||||
}
|
||||
memset(ptr, ((int)(unsigned long)NULL), size);
|
||||
return (void*)ptr;
|
||||
}
|
||||
@ -145,6 +149,10 @@ static unsigned char __compile_and_equals_sflag(char* flags, char* str) {
|
||||
|
||||
static char* malloc_str(char* str) {
|
||||
char* ptr = (char*)malloc((strlen(str)) * sizeof(char) + sizeof(char));
|
||||
if ((void*)ptr == NULL) {
|
||||
puts("Out of memory!");
|
||||
abort();
|
||||
}
|
||||
strcpy(ptr, str);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user