Skip to content

Commit

Permalink
Improve areSame checking for null values
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioprates committed Apr 19, 2022
1 parent 68916b1 commit f9bfa32
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/include/sugar.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ string readFile(string filepath);
void println(string s) { printf("%s\n", s); }

bool areSame(string s1, string s2) {
if (!s1 && !s2)
return true;
if (!s1 || !s2)
return false;
return strcmp(s1, s2) == 0 ? true : false;
}

Expand Down

0 comments on commit f9bfa32

Please sign in to comment.