Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
58e3457a
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
1 年多 前同步成功
通知
10
Star
18
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
58e3457a
编写于
9月 17, 2015
作者:
E
Emilia Kasper
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
BUF_strdup and friends: update docs
Reviewed-by:
N
Matt Caswell
<
matt@openssl.org
>
上级
de8883e1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
24 deletion
+25
-24
doc/crypto/buffer.pod
doc/crypto/buffer.pod
+25
-24
未找到文件。
doc/crypto/buffer.pod
浏览文件 @
58e3457a
...
...
@@ -2,8 +2,11 @@
=head1 NAME
BUF_MEM_new, BUF_MEM_free, BUF_MEM_grow, BUF_strdup - simple
character arrays structure
BUF_MEM_new, BUF_MEM_new_ex, BUF_MEM_free, BUF_MEM_grow - simple
character array structure
BUF_strdup, BUF_strndup, BUF_memdup, BUF_strlcpy, BUF_strlcat -
standard C library equivalents
=head1 SYNOPSIS
...
...
@@ -13,31 +16,26 @@ character arrays structure
#define BUF_MEM_FLAG_SECURE
BUF_MEM *
BUF_MEM_new_ex(unsigned long flags);
BUF_MEM *BUF_MEM_new_ex(unsigned long flags);
void BUF_MEM_free(BUF_MEM *a);
int BUF_MEM_grow(BUF_MEM *str, int len);
char *
BUF_strdup(const char *str);
char *BUF_strdup(const char *str);
=head1 DESCRIPTION
char *BUF_strndup(const char *str, size_t siz);
The buffer library handles simple character arrays. Buffers are used for
various purposes in the library, most notably memory BIOs.
void *BUF_memdup(const void *data, size_t siz);
The library uses the BUF_MEM structure defined in buffer.h:
size_t BUF_strlcpy(char *dst, const char *src, size_t size);
typedef struct buf_mem_st
{
int length; /* current number of bytes */
char *data;
int max; /* size of buffer */
} BUF_MEM;
size_t BUF_strlcat(char *dst, const char *src, size_t size);
B<length> is the current size of the buffer in bytes, B<max> is the amount of
memory allocated to the buffer. There are three functions which handle these
and one "miscellaneous" function.
=head1 DESCRIPTION
The buffer library handles simple character arrays. Buffers are used for
various purposes in the library, most notably memory BIOs.
BUF_MEM_new() allocates a new buffer of zero size.
...
...
@@ -52,14 +50,17 @@ BUF_MEM_grow() changes the size of an already existing buffer to
B<len>. Any data already in the buffer is preserved if it increases in
size.
BUF_strdup() 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 OPENSSL_malloc() 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.
BUF_strdup(), BUF_strndup(), BUF_memdup(), BUF_strlcpy() and
BUF_strlcat() are equivalents of the standard C library functions. The
dup() functions use OPENSSL_malloc() underneath and so should be used
in preference to the standard library for memory leak checking or
replacing the malloc() function.
Memory allocated from these functions should be freed up using the
OPENSSL_free() function.
The memory allocated from BUF_strdup() should be freed up using the OPENSSL_free()
function
.
BUF_strndup makes the explicit guarantee that it will never read past
the first B<siz> bytes of B<str>
.
=head1 RETURN VALUES
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录