Skip to content

Commit

Permalink
Remove redundant call to strcpy
Browse files Browse the repository at this point in the history
Summary: Remove redundant call to strcpy in C++ component registration code.

Differential Revision: D64566958
  • Loading branch information
SanderMertens authored and facebook-github-bot committed Oct 17, 2024
1 parent 74e2dc3 commit be7b8a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions distr/flecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -21148,12 +21148,9 @@ char* ecs_cpp_get_symbol_name(
const char *type_name,
size_t len)
{
// Symbol is same as name, but with '::' replaced with '.'
ecs_os_strcpy(symbol_name, type_name);

char *ptr;
size_t i;
for (i = 0, ptr = symbol_name; i < len && *ptr; i ++, ptr ++) {
for (i = 0, ptr = type_name; i < len && *ptr; i ++, ptr ++) {
if (*ptr == ':') {
symbol_name[i] = '.';
ptr ++;
Expand Down
5 changes: 1 addition & 4 deletions src/addons/flecs_cpp.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,9 @@ char* ecs_cpp_get_symbol_name(
const char *type_name,
size_t len)
{
// Symbol is same as name, but with '::' replaced with '.'
ecs_os_strcpy(symbol_name, type_name);

char *ptr;
size_t i;
for (i = 0, ptr = symbol_name; i < len && *ptr; i ++, ptr ++) {
for (i = 0, ptr = type_name; i < len && *ptr; i ++, ptr ++) {
if (*ptr == ':') {
symbol_name[i] = '.';
ptr ++;
Expand Down

0 comments on commit be7b8a6

Please sign in to comment.