Skip to content
Snippets Groups Projects
Commit f29f203e authored by Thomas Jahns's avatar Thomas Jahns :cartwheel: Committed by Sergey Kosukhin
Browse files

Fix string data copied twice.

parent 783117e2
No related branches found
No related tags found
2 merge requests!34Version 2.2.0,!13Consolidation with CDI-PIO (develop)
......@@ -82,20 +82,19 @@ is_timeaxis_units(const char *timeunits)
const size_t len = strlen(timeunits);
char *tu = (char *) malloc((len + 1) * sizeof(char));
memcpy(tu, timeunits, (len + 1) * sizeof(char));
char *ptu = tu;
for (size_t i = 0; i < len; i++) ptu[i] = (char) tolower((int) ptu[i]);
for (size_t i = 0; i < len; i++) tu[i] = (char) tolower((int) timeunits[i]);
int timeunit = get_time_units(len, ptu);
int timeunit = get_time_units(len, tu);
if (timeunit != -1)
{
while (!isspace(*ptu) && *ptu != 0) ptu++;
if (*ptu)
size_t pos = 0;
while (!isspace(tu[pos]) && tu[pos] != 0) pos++;
if (tu[pos])
{
while (isspace(*ptu)) ptu++;
int timetype = strStartsWith(ptu, "as") ? TAXIS_ABSOLUTE : strStartsWith(ptu, "since") ? TAXIS_RELATIVE : -1;
status = (timetype != -1);
while (isspace(tu[pos])) pos++;
status = strStartsWith(tu + pos, "as") || strStartsWith(tu + pos, "since");
}
}
......
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