mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Added calloc(3).
This commit is contained in:
parent
b5fe020b7a
commit
4841d83ff8
2 changed files with 10 additions and 1 deletions
|
@ -46,6 +46,7 @@ typedef int div_t, ldiv_t, lldiv_t;
|
||||||
/* TODO: WEXITSTATUS, WIFEXITED, WIFSIGNALED, WIFSTOPPED, WNOHANG, WSTOPSIG, WTERMSIG, WUNTRACED is missing here */
|
/* TODO: WEXITSTATUS, WIFEXITED, WIFSIGNALED, WIFSTOPPED, WNOHANG, WSTOPSIG, WTERMSIG, WUNTRACED is missing here */
|
||||||
|
|
||||||
int atoi(const char*);
|
int atoi(const char*);
|
||||||
|
void* calloc(size_t, size_t);
|
||||||
void exit(int);
|
void exit(int);
|
||||||
void _Exit(int status);
|
void _Exit(int status);
|
||||||
void free(void*);
|
void free(void*);
|
||||||
|
@ -67,7 +68,6 @@ int atoi(const char*);
|
||||||
long atol(const char*);
|
long atol(const char*);
|
||||||
long long atoll(const char*);
|
long long atoll(const char*);
|
||||||
void* bsearch(const void*, const void*, size_t, size_t, int (*)(const void*, const void*));
|
void* bsearch(const void*, const void*, size_t, size_t, int (*)(const void*, const void*));
|
||||||
void* calloc(size_t, size_t);
|
|
||||||
div_t div(int, int);
|
div_t div(int, int);
|
||||||
double drand48(void);
|
double drand48(void);
|
||||||
double erand48(unsigned short [3]);
|
double erand48(unsigned short [3]);
|
||||||
|
|
|
@ -642,6 +642,15 @@ namespace Maxsi
|
||||||
ASSERT(ValidateHeap());
|
ASSERT(ValidateHeap());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" void* calloc(size_t nmemb, size_t size)
|
||||||
|
{
|
||||||
|
size_t total = nmemb * size;
|
||||||
|
void* result = Allocate(total);
|
||||||
|
if ( !result ) { return NULL; }
|
||||||
|
Memory::Set(result, 0, total);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue