File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed
Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -281,11 +281,11 @@ extern "C"
281281 else if (v->type == ValueType::Bool) {
282282 if (v->boolValue ) {
283283 StringPtr *ret = string_pool_new ();
284- string_assign_cstring (ret, " true " );
284+ string_assign (ret, &TRUE_STR );
285285 return ret;
286286 } else {
287287 StringPtr *ret = string_pool_new ();
288- string_assign_cstring (ret, " false " );
288+ string_assign (ret, &FALSE_STR );
289289 return ret;
290290 }
291291 } else
@@ -453,13 +453,7 @@ extern "C"
453453 */
454454 const StringPtr *value_boolToStringPtr (bool v)
455455 {
456- if (v) {
457- static const StringPtr ret (" true" );
458- return &ret;
459- } else {
460- static const StringPtr ret (" false" );
461- return &ret;
462- }
456+ return v ? &TRUE_STR : &FALSE_STR;
463457 }
464458
465459 /* ! Converts the given string to double. */
Original file line number Diff line number Diff line change 2121namespace libscratchcpp
2222{
2323
24+ static const StringPtr TRUE_STR (" true" );
25+ static const StringPtr FALSE_STR (" false" );
26+
2427template <typename T>
2528inline unsigned int value_intDigitCount (T v)
2629{
You can’t perform that action at this time.
0 commit comments