Skip to content

Commit b62525e

Browse files
committed
Do not use string functions in stringptr.h
1 parent 6a43490 commit b62525e

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

include/scratchcpp/stringptr.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#pragma once
44

55
#include "global.h"
6-
#include "string_functions.h"
76

87
namespace libscratchcpp
98
{
@@ -15,7 +14,7 @@ extern "C"
1514
{
1615
// NOTE: Constructors and destructors only work in C++ code and are not supposed to be used in LLVM IR
1716
StringPtr() = default;
18-
StringPtr(const std::string &str) { string_assign_cstring(this, str.c_str()); }
17+
StringPtr(const std::string &str);
1918
StringPtr(const StringPtr &) = delete;
2019

2120
~StringPtr()

src/blocks/eventblocks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <scratchcpp/thread.h>
1111
#include <scratchcpp/compilerconstant.h>
1212
#include <scratchcpp/promise.h>
13-
#include <scratchcpp/stringptr.h>
13+
#include <scratchcpp/string_functions.h>
1414
#include <scratchcpp/sprite.h>
1515
#include <scratchcpp/itimer.h>
1616
#include <utf8.h>

src/blocks/looksblocks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <scratchcpp/sprite.h>
1212
#include <scratchcpp/stage.h>
1313
#include <scratchcpp/costume.h>
14-
#include <scratchcpp/stringptr.h>
14+
#include <scratchcpp/string_functions.h>
1515
#include <scratchcpp/string_pool.h>
1616
#include <scratchcpp/value.h>
1717
#include <scratchcpp/input.h>

src/scratch/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ target_sources(scratchcpp
22
PRIVATE
33
value_functions.cpp
44
value_functions_p.h
5+
stringptr.cpp
56
string_functions.cpp
67
string_pool.cpp
78
string_pool_p.h

src/scratch/stringptr.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
3+
#include <scratchcpp/stringptr.h>
4+
#include <scratchcpp/string_functions.h>
5+
6+
using namespace libscratchcpp;
7+
8+
StringPtr::StringPtr(const std::string &str)
9+
{
10+
string_assign_cstring(this, str.c_str());
11+
}

0 commit comments

Comments
 (0)