Manual Pages for UNIX Darwin command on man BUF_strdup
MyWebUniversity

Manual Pages for UNIX Darwin command on man BUF_strdup

buffer(3) OpenSSL buffer(3)

NAME

BUFMEMnew, BUFMEMfree, BUFMEMgrow, BUFstrdup - simple character

arrays structure

SYNOPSIS

#include

BUFMEM *BUFMEMnew(void); void BUFMEMfree(BUFMEM *a); int BUFMEMgrow(BUFMEM *str, int len); char * BUFstrdup(const char *str);

DESCRIPTION

The buffer library handles simple character arrays. Buffers are used for various purposes in the library, most notably memory BIOs. The library uses the BUFMEM structure defined in buffer.h: typedef struct bufmemst { int length; /* current number of bytes */ char *data; int max; /* size of buffer */ } BUFMEM; lleennggtthh is the current size of the buffer in bytes, mmaaxx is the amount of memory allocated to the buffer. There are three functions which handle these and one "miscellaneous" function. BUFMEMnew() allocates a new buffer of zero size. BUFMEMfree() frees up an already existing buffer. The data is zeroed before freeing up in case the buffer contains sensitive data. BUFMEMgrow() changes the size of an already existing buffer to lleenn. Any data already in the buffer is preserved if it increases in size. BUFstrdup() copies a null terminated string into a block of allocated memory and returns a pointer to the allocated block. Unlike the standard C library strdup() this function uses OPENSSLmalloc() and so should be used in preference to the standard library strdup() because it can be used for memory leak checking or replacing the malloc() function. The memory allocated from BUFstrdup() should be freed up using the OPENSSLfree() function.

RETURN VALUES

BUFMEMnew() returns the buffer or NULL on error. BUFMEMfree() has no return value. BUFMEMgrow() returns zero on error or the new size (i.e. lleenn).

SEE ALSO

bio(3) HISTORY BUFMEMnew(), BUFMEMfree() and BUFMEMgrow() are available in all versions of SSLeay and OpenSSL. BUFstrdup() was added in SSLeay 0.8.

0.9.7l 2000-09-19 buffer(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™