projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move filesys_init into main_thread.
[pintos-anon]
/
src
/
threads
/
malloc.c
diff --git
a/src/threads/malloc.c
b/src/threads/malloc.c
index 8da4c4e4b0aaf2319f0e885859698daed1222671..72b441488393d862daed5c1a8ba367314089a90a 100644
(file)
--- a/
src/threads/malloc.c
+++ b/
src/threads/malloc.c
@@
-97,6
+97,23
@@
malloc (size_t size)
return get_free_slot (d);
}
return get_free_slot (d);
}
+void *
+calloc (size_t a, size_t b)
+{
+ void *p;
+ size_t size;
+
+ size = a * b;
+ if (size < a || size < b)
+ return NULL;
+
+ p = malloc (size);
+ if (p != NULL)
+ memset (p, 0, size);
+
+ return p;
+}
+
void
free (void *p)
{
void
free (void *p)
{