Modified structure.c
This commit is contained in:
parent
8fbb799a3f
commit
d70229dcb3
@ -158,24 +158,25 @@ int burn_session_remove_track(struct burn_session *s, struct burn_track *t)
|
|||||||
|
|
||||||
/* Find the position */
|
/* Find the position */
|
||||||
for (i = 0; i < s->tracks; i++) {
|
for (i = 0; i < s->tracks; i++) {
|
||||||
if (t == s->track[i])
|
if (t == s->track[i]) {
|
||||||
pos = i;
|
pos = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos == -1)
|
if (pos == -1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Is it the last track? */
|
/* Is it the last track? */
|
||||||
if (pos != s->tracks) {
|
if (pos != s->tracks - 1) {
|
||||||
memmove(s->track[pos], s->track[pos + 1],
|
memmove(&s->track[pos], &s->track[pos + 1],
|
||||||
sizeof(struct burn_track *) * (s->tracks - (pos + 1)));
|
sizeof(struct burn_track *) * (s->tracks - (pos + 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
s->tracks--;
|
s->tracks--;
|
||||||
tmp = realloc(s->track, sizeof(struct burn_track *) * s->tracks);
|
tmp = realloc(s->track, sizeof(struct burn_track *) * s->tracks);
|
||||||
if (!tmp)
|
if (tmp)
|
||||||
return 0;
|
s->track = tmp;
|
||||||
s->track = tmp;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user