Skip to content

Commit 5a8c80d

Browse files
SanderMertensfacebook-github-bot
authored andcommitted
Remove redundant call to strcpy (#1406)
Summary: Pull Request resolved: #1406 Remove redundant call to strcpy in C++ component registration code. Reviewed By: Jason-M-Fugate Differential Revision: D64566958
1 parent 74e2dc3 commit 5a8c80d

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

distr/flecs.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21148,12 +21148,9 @@ char* ecs_cpp_get_symbol_name(
2114821148
const char *type_name,
2114921149
size_t len)
2115021150
{
21151-
// Symbol is same as name, but with '::' replaced with '.'
21152-
ecs_os_strcpy(symbol_name, type_name);
21153-
21154-
char *ptr;
21151+
const char *ptr;
2115521152
size_t i;
21156-
for (i = 0, ptr = symbol_name; i < len && *ptr; i ++, ptr ++) {
21153+
for (i = 0, ptr = type_name; i < len && *ptr; i ++, ptr ++) {
2115721154
if (*ptr == ':') {
2115821155
symbol_name[i] = '.';
2115921156
ptr ++;

src/addons/flecs_cpp.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,9 @@ char* ecs_cpp_get_symbol_name(
9898
const char *type_name,
9999
size_t len)
100100
{
101-
// Symbol is same as name, but with '::' replaced with '.'
102-
ecs_os_strcpy(symbol_name, type_name);
103-
104-
char *ptr;
101+
const char *ptr;
105102
size_t i;
106-
for (i = 0, ptr = symbol_name; i < len && *ptr; i ++, ptr ++) {
103+
for (i = 0, ptr = type_name; i < len && *ptr; i ++, ptr ++) {
107104
if (*ptr == ':') {
108105
symbol_name[i] = '.';
109106
ptr ++;

0 commit comments

Comments
 (0)