Skip to content

Commit

Permalink
test: define cfree() as free() in vmmalloc_calloc
Browse files Browse the repository at this point in the history
Makes cfree() an alias to free(), if cfree() is not exported by glibc.
The cfree() function has been removed from glibc since version 2.26.
This is why vmmalloc_calloc test compilation started to fail
on Fedora 27.
  • Loading branch information
krzycz committed May 18, 2017
1 parent ab781e1 commit 925ea61
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/test/vmmalloc_calloc/TEST0
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e
#
# Copyright 2014-2016, Intel Corporation
# Copyright 2014-2017, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -32,8 +32,7 @@
#

#
# src/test/vmmalloc_calloc/TEST0 -- unit test for
# libvmmalloc calloc/cfree
# src/test/vmmalloc_calloc/TEST0 -- unit test for libvmmalloc calloc
#
export UNITTEST_NAME=vmmalloc_calloc/TEST0
export UNITTEST_NUM=0
Expand Down
9 changes: 7 additions & 2 deletions src/test/vmmalloc_calloc/vmmalloc_calloc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016, Intel Corporation
* Copyright 2014-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -31,7 +31,7 @@
*/

/*
* vmmalloc_calloc.c -- unit test for libvmmalloc calloc/cfree
* vmmalloc_calloc.c -- unit test for libvmmalloc calloc
*
* usage: vmmalloc_calloc
*/
Expand All @@ -43,6 +43,11 @@
#define DEFAULT_COUNT (SMALL_MAXCLASS / 4)
#define DEFAULT_N 100

/* cfree() has been removed from glibc since version 2.26 */
#ifndef cfree
#define cfree free
#endif

int
main(int argc, char *argv[])
{
Expand Down

0 comments on commit 925ea61

Please sign in to comment.