YSTest
PreAlpha_b400_20130424
The YSLib Test Project
首页
相关页面
模块
命名空间
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
cstring.cpp
浏览该文件的文档.
1
/*
2
Copyright by FrankHB 2009 - 2013.
3
4
This file is part of the YSLib project, and may only be used,
5
modified, and distributed under the terms of the YSLib project
6
license, LICENSE.TXT. By continuing to use, modify, or distribute
7
this file you indicate that you have read the license and
8
understand and accept it fully.
9
*/
10
28
#include "
ystdex/cstring.h
"
29
#include <cstdio>
30
31
namespace
ystdex
32
{
33
34
size_t
35
strlen_n
(
const
char
* s)
36
{
37
return
s ? std::strlen(s) : 0;
38
}
39
40
char
*
41
strcpy_n
(
char
* d,
const
char
* s)
42
{
43
return
d && s ? std::strcpy(d, s) :
nullptr
;
44
}
45
46
char
*
47
strcpycat
(
char
* d,
const
char
* s1,
const
char
* s2)
48
{
49
if
(
YB_UNLIKELY
(!d))
50
return
nullptr
;
51
if
(s1)
52
std::strcpy(d, s1);
53
if
(s2)
54
std::strcat(d, s2);
55
return
d;
56
}
57
58
char
*
59
strcatdup
(
const
char
* s1,
const
char
* s2,
void
*(*fun)(
size_t
))
60
{
61
auto
d(static_cast<char*>(
62
fun((strlen(s1) + strlen(s2) + 1) *
sizeof
(
char
))));
63
64
return
strcpycat
(d, s1, s2);
65
}
66
67
}
// namespace ystdex;
68
YBase
source
ystdex
cstring.cpp
生成于 2013年 四月 24日 星期三 18:41:27 , 为 YSTest使用
1.8.2