aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/Print.cpp
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2010-08-28 10:23:54 +0000
committerDavid A. Mellis <d.mellis@arduino.cc>2010-08-28 10:23:54 +0000
commit4bbd4f7448907ed0133ef737fc694751f9f97ea3 (patch)
treedd2455545cc79ad5b09c598f7fdbb0d4f4e4b4b4 /cores/arduino/Print.cpp
parent1362ca26c198082235f71192861656385a1eab20 (diff)
Changing String::toCharArray() and getBytes() to accept a buffer, rather than return one. That way they don't expose the internal representation of the String class, allowing future optimization. Thanks to Paul Stoffregen.
Diffstat (limited to 'cores/arduino/Print.cpp')
-rwxr-xr-xcores/arduino/Print.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/cores/arduino/Print.cpp b/cores/arduino/Print.cpp
index 6fe162d..4ee556d 100755
--- a/cores/arduino/Print.cpp
+++ b/cores/arduino/Print.cpp
@@ -45,7 +45,9 @@ void Print::write(const uint8_t *buffer, size_t size)
void Print::print(const String &s)
{
- print(s.toCharArray());
+ for (int i = 0; i < s.length(); i++) {
+ write(s[i]);
+ }
}
void Print::print(const char str[])