Closed ysc3839 closed 4 years ago
It's not optimal, but not too bad. Sometimes code readability is to be preferred, in particular in cases when you look for a string in a context. Just looking for a substring with strstr()
can be deceitful and give false positives unless you also look for surrounding text.
In the case of cloudxns.c I'd probably go for strtok()
and strcmp()
to split up the stream in {
, }
, and :
separated tokens.
Closing. We now have two (!) JSON implementations in Inadyn, so any changes to refactor/optimize performance should probably first start with refactoring this plugin to use include/jsmn.h
(jasmine).
For example: plugins/cloudxns.c. I use
sscanf
to parse domain info. But I think usingstrstr
andstrchr
is better.