Indent
This commit is contained in:
parent
6b88534a5b
commit
02623d7bd5
1 changed files with 19 additions and 23 deletions
42
stt.c
42
stt.c
|
|
@ -103,15 +103,14 @@ loadtimes(FILE * fp, struct timesnode * p)
|
||||||
linesize = 0;
|
linesize = 0;
|
||||||
while ((linelen = getline(&readline, &linesize, fp)) != -1) {
|
while ((linelen = getline(&readline, &linesize, fp)) != -1) {
|
||||||
line = strdup(readline);
|
line = strdup(readline);
|
||||||
tmpline = line; /* Stores the pointer to allow buffer free */
|
tmpline = line; /* Stores the pointer to allow buffer free */
|
||||||
tmp = strsep(&line, ";");
|
tmp = strsep(&line, ";");
|
||||||
starttime = atoi(tmp);
|
starttime = atoi(tmp);
|
||||||
|
|
||||||
if (starttime == 0) {
|
if (starttime == 0) {
|
||||||
free_and_null (tmpline);
|
free_and_null(tmpline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = strsep(&line, ";");
|
tmp = strsep(&line, ";");
|
||||||
endtime = atoi(tmp);
|
endtime = atoi(tmp);
|
||||||
|
|
||||||
|
|
@ -120,11 +119,11 @@ loadtimes(FILE * fp, struct timesnode * p)
|
||||||
|
|
||||||
p = timesnode_add(p, task, starttime, endtime);
|
p = timesnode_add(p, task, starttime, endtime);
|
||||||
|
|
||||||
free_and_null (task);
|
free_and_null(task);
|
||||||
free_and_null (tmpline);
|
free_and_null(tmpline);
|
||||||
}
|
}
|
||||||
|
|
||||||
free_and_null (readline);
|
free_and_null(readline);
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
@ -305,20 +304,18 @@ timesnode_print(struct timesnode * p, time_t aftertime)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
timesnode_free (struct timesnode *p)
|
timesnode_free(struct timesnode * p)
|
||||||
{
|
{
|
||||||
if (p->left) {
|
if (p->left) {
|
||||||
timesnode_free (p->left);
|
timesnode_free(p->left);
|
||||||
p->left = NULL;
|
p->left = NULL;
|
||||||
}
|
}
|
||||||
|
if (p->right) {
|
||||||
if (p->right) {
|
timesnode_free(p->right);
|
||||||
timesnode_free (p->right);
|
p->right = NULL;
|
||||||
p->right = NULL;
|
}
|
||||||
}
|
free_and_null(p->task);
|
||||||
|
free_and_null(p);
|
||||||
free_and_null (p->task);
|
|
||||||
free_and_null (p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -392,12 +389,11 @@ default:
|
||||||
|
|
||||||
timesnode_print(timestree, mktime(&today));
|
timesnode_print(timestree, mktime(&today));
|
||||||
}
|
}
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
fclose (fp);
|
timesnode_free(timestree);
|
||||||
|
|
||||||
timesnode_free (timestree);
|
free_and_null(nowtime);
|
||||||
|
|
||||||
free_and_null (nowtime);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue