mirror of
https://github.com/libssh2/libssh2.git
synced 2025-10-31 23:30:25 +03:00
calloc: introduce LIBSSH2_CALLOC()
A simple function using LIBSSH2_ALLOC + memset, since this pattern was used in multiple places and this simplies code in general.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2004-2008, 2010, Sara Golemon <sarag@libssh2.org>
|
||||
* Copyright (c) 2009-2011 by Daniel Stenberg
|
||||
* Copyright (c) 2009-2014 by Daniel Stenberg
|
||||
* Copyright (c) 2010 Simon Josefsson
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -152,6 +152,7 @@ static inline int writev(int sock, struct iovec *iov, int nvecs)
|
||||
|
||||
#define LIBSSH2_ALLOC(session, count) \
|
||||
session->alloc((count), &(session)->abstract)
|
||||
#define LIBSSH2_CALLOC(session, count) _libssh2_calloc(session, count)
|
||||
#define LIBSSH2_REALLOC(session, ptr, count) \
|
||||
((ptr) ? session->realloc((ptr), (count), &(session)->abstract) : \
|
||||
session->alloc((count), &(session)->abstract))
|
||||
|
||||
Reference in New Issue
Block a user