Skip to content
Snippets Groups Projects
Commit 6e335604 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Replace strStartsWith() and strcmp() by strIsEqual().

parent 3ce4c9ca
No related branches found
No related tags found
No related merge requests found
......@@ -19,10 +19,10 @@ char *strToLower(char *str)
bool strStartsWith(const char *vstr, const char *cstr)
{
bool is_equal = false;
if (vstr && *vstr)
if (vstr && cstr)
{
size_t clen = (cstr != NULL) ? strlen(cstr) : 0;
size_t vlen = (vstr != NULL) ? strlen(vstr) : 0;
size_t clen = strlen(cstr);
size_t vlen = strlen(vstr);
if (clen <= vlen) is_equal = (memcmp(vstr, cstr, clen) == 0);
}
return is_equal;
......
......@@ -41,6 +41,13 @@ char *strdup(const char *s);
char *strToLower(char *str);
bool strStartsWith(const char *vstr, const char *cstr);
inline bool
strIsEqual(const char *x, const char *y)
{
return (*x == *y) && strcmp(x, y) == 0;
}
#ifndef M_PI
#define M_PI 3.14159265358979323846 /* pi */
#endif
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment