Skip to content

Commit

Permalink
Fix missing calloc
Browse files Browse the repository at this point in the history
  • Loading branch information
Twometer committed Apr 13, 2021
1 parent 97cd733 commit 6422c4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions libc/include/stdlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extern "C"
void free(void *ptr);
char *getenv(const char *);
void *realloc(void *, size_t);
void *calloc(size_t, size_t);

/* dummy stuff for gcc to stop complaining */
int atexit(void (*)(void));
Expand Down
7 changes: 7 additions & 0 deletions libc/stdlib/malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,11 @@ void *realloc(void *ptr, size_t size)
#ifndef __KERNEL
return usr_realloc(ptr, size);
#endif
}

void *calloc(size_t num, size_t size)
{
#ifndef __KERNEL
return usr_calloc(num, size);
#endif
}

0 comments on commit 6422c4a

Please sign in to comment.