Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bridge.cpp should not use string. #1831

Closed
jantje opened this issue Jan 28, 2014 · 2 comments
Closed

bridge.cpp should not use string. #1831

jantje opened this issue Jan 28, 2014 · 2 comments
Assignees
Labels
Library: Bridge The Bridge Arduino library

Comments

@jantje
Copy link

jantje commented Jan 28, 2014

Currently the bridge library relies on the String class for put command. I think that including String only for put is a bit expensive. The author probably agrees with this as the code has following comment

// TODO: do it in a more efficient way

I think extending transfer to another data set and this (untested) code would be far better

void BridgeClass::put(const char *key, const char *value) {
transfer("D",1,key,strlen(key),"\xFE",1,value,strlen(value));
}
Best regards
Jantje

@bigjosh
Copy link

bigjosh commented Mar 31, 2014

I agree. These strings use up precious RAM and fail silently when dynamic RAM runs out. I'd prefer if all the Bridge functions used statically allocated buffers becuase they would be much more efficient in time and memory and at least you would know when you ran out of RAM at compile time rather than crashing at run time.

@agdl
Copy link
Member

agdl commented Jul 12, 2016

This issue was moved to arduino-libraries/Bridge#11

@agdl agdl closed this as completed Jul 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Library: Bridge The Bridge Arduino library
Projects
None yet
Development

No branches or pull requests

5 participants