Ai
4 Star 11 Fork 5

乌合之众/live555_source_control

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
strDup.cpp 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
乌合之众 提交于 2015-07-14 15:10 +08:00 . live555源码注释第一次
/**********
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2.1 of the License, or (at your
option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********/
// Copyright (c) 1996-2012 Live Networks, Inc. All rights reserved.
// A C++ equivalent to the standard C routine "strdup()".
// This generates a char* that can be deleted using "delete[]"
// Implementation
#include "strDup.hh"
#include "string.h"
char* strDup(char const* str) {
if (str == NULL) return NULL;
size_t len = strlen(str) + 1;
char* copy = new char[len];
if (copy != NULL) {
memcpy(copy, str, len);
}
return copy;
}
char* strDupSize(char const* str) {
if (str == NULL) return NULL;
size_t len = strlen(str) + 1;
char* copy = new char[len];
return copy;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/solym/live555_source_control.git
git@gitee.com:solym/live555_source_control.git
solym
live555_source_control
live555_source_control
master

搜索帮助