lbussy / LCBUrl

Arduino library for handling URLs
MIT License
7 stars 1 forks source link

Pass String to setURL() as const reference #9

Closed puzzle-star closed 4 years ago

puzzle-star commented 4 years ago

First of all, thanks for sharing this It has saved me a lot of time (mostly writing this myself).

Could I suggest to pass the String to setUrl as a const reference instead of an object copy?

bool setUrl(const String &);

This will prevent copying the string when passing it to the function (it will be copied anyway again within the function to the object variable). This will save some time and memory in an already memory constrained Arduino (an my sketch is...).

Passing it as const will allow to pass the function Strings that are already const. non const Strings will still work.

Thanks in advance!

lbussy commented 4 years ago

I can look at that, sure. Will be a few days I think before I am home and can look at it.

puzzle-star commented 4 years ago

Thanks Lee!

No urgency: I already modified it in my local copy. The suggestion is for future vesions of the library and for the benefit of others :-)

Pedro

lbussy commented 4 years ago

Patched with aa5d56d. It will take a few hours for the repos to catch up.

Closing.