Skip to content
Snippets Groups Projects
Commit f13bd7fd authored by Peter Limkilde Svendsen's avatar Peter Limkilde Svendsen
Browse files

Add tests for valloc

parent 3be13d67
No related branches found
No related tags found
1 merge request!216Make valloc() get page size through sysconf(), add tests
...@@ -126,4 +126,17 @@ int main(void) { ...@@ -126,4 +126,17 @@ int main(void) {
ptr_aligned_alloc_badsize, aligned_alloc_badsize_errno, ptr_aligned_alloc_badsize, aligned_alloc_badsize_errno,
strerror(aligned_alloc_badsize_errno)); strerror(aligned_alloc_badsize_errno));
free(ptr_aligned_alloc_badsize); free(ptr_aligned_alloc_badsize);
errno = 0;
char * ptr_valloc = (char *)valloc(sample_alloc_size);
int valloc_errno = errno;
printf("valloc : %p, errno: %d = %s\n",
ptr_valloc, valloc_errno, strerror(valloc_errno));
errno = 0;
char * ptr_valloc_maxsize = (char *)valloc(max_size);
int valloc_maxsize_errno = errno;
printf("valloc (SIZE_MAX) : %p, errno: %d = %s\n",
ptr_valloc_maxsize, valloc_maxsize_errno,
strerror(valloc_maxsize_errno));
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment