Skip to content

Commit

Permalink
Saves some bytes in Photon system-part1 by using strncasecmp to check…
Browse files Browse the repository at this point in the history
… if the event is spark/ prefixed
  • Loading branch information
avtolstoy committed Sep 26, 2017
1 parent 02a83fb commit 13efa08
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions communication/src/spark_protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,12 +510,7 @@ int SparkProtocol::variable_value(unsigned char *buf,

inline bool is_system(const char* event_name) {
// if there were a strncmpi this would be easier!
char prefix[6];
if (!*event_name || strlen(event_name)<5)
return false;
memcpy(prefix, event_name, 5);
prefix[5] = '\0';
return !strcasecmp(prefix, "spark");
return !strncasecmp(event_name, "spark", 5);
}

// Returns true on success, false on sending timeout or rate-limiting failure
Expand Down

0 comments on commit 13efa08

Please sign in to comment.