mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-05 09:20:29 +00:00
Clean up new.cc, remove extraneous code
This commit is contained in:
parent
cc86a38d14
commit
b35baab0a1
1 changed files with 12 additions and 15 deletions
27
ctl/new.cc
27
ctl/new.cc
|
@ -16,23 +16,18 @@
|
||||||
// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
// PERFORMANCE OF THIS SOFTWARE.
|
// PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
/* We do not actually use anything defined in new.h, but it is included here
|
||||||
|
to follow the usual pattern that the source file for a header file is the
|
||||||
|
place that makes sure that the header can be included without an implicit
|
||||||
|
dependency picked up out of a prior include. */
|
||||||
#include "new.h"
|
#include "new.h"
|
||||||
|
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
|
|
||||||
using ctl::align_val_t;
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
namespace {
|
void*
|
||||||
|
ctl_alloc(size_t n, size_t a)
|
||||||
constexpr auto a1 = align_val_t(1);
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
void* ctl_alloc(size_t n, size_t a)
|
|
||||||
{
|
{
|
||||||
void* p;
|
void* p;
|
||||||
if (!(p = memalign(a, n)))
|
if (!(p = memalign(a, n)))
|
||||||
|
@ -40,12 +35,14 @@ void* ctl_alloc(size_t n, size_t a)
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* ctl_alloc1(size_t n)
|
void*
|
||||||
|
ctl_alloc1(size_t n)
|
||||||
{
|
{
|
||||||
return ctl_alloc(n, 1);
|
return ctl_alloc(n, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* ctl_ret(size_t, void* p)
|
void*
|
||||||
|
ctl_ret(size_t, void* p)
|
||||||
{
|
{
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -108,4 +105,4 @@ __weak_reference(free, _ZdlPvS_);
|
||||||
// operator delete[](void*, void*)
|
// operator delete[](void*, void*)
|
||||||
__weak_reference(free, _ZdaPvS_);
|
__weak_reference(free, _ZdaPvS_);
|
||||||
|
|
||||||
} // extern "C"
|
COSMOPOLITAN_C_END_
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue