Add schematics with ranges to help reviews.
* lib/subordinateio.c: Add schematics with ranges to help reviews.
This commit is contained in:
parent
b84b918464
commit
cd1bd8bf4c
@ -1,6 +1,7 @@
|
|||||||
2013-08-13 Nicolas François <nicolas.francois@centraliens.net>
|
2013-08-13 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* lib/subordinateio.c: Avoid dead branches.
|
* lib/subordinateio.c: Avoid dead branches.
|
||||||
|
* lib/subordinateio.c: Add schematics with ranges to help reviews.
|
||||||
|
|
||||||
2013-08-13 Nicolas François <nicolas.francois@centraliens.net>
|
2013-08-13 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
@ -311,10 +311,14 @@ static int remove_range(struct commonio_db *db,
|
|||||||
|
|
||||||
if (start <= first) {
|
if (start <= first) {
|
||||||
if (end >= last) {
|
if (end >= last) {
|
||||||
|
/* to be removed: [start, end]
|
||||||
|
* range: [first, last] */
|
||||||
/* entry completely contained in the
|
/* entry completely contained in the
|
||||||
* range to remove */
|
* range to remove */
|
||||||
commonio_del_entry (db, ent);
|
commonio_del_entry (db, ent);
|
||||||
} else {
|
} else {
|
||||||
|
/* to be removed: [start, end]
|
||||||
|
* range: [first, last] */
|
||||||
/* Remove only the start of the entry */
|
/* Remove only the start of the entry */
|
||||||
range->start = end + 1;
|
range->start = end + 1;
|
||||||
range->count = (last - range->start) + 1;
|
range->count = (last - range->start) + 1;
|
||||||
@ -324,12 +328,16 @@ static int remove_range(struct commonio_db *db,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (end >= last) {
|
if (end >= last) {
|
||||||
|
/* to be removed: [start, end]
|
||||||
|
* range: [first, last] */
|
||||||
/* Remove only the end of the entry */
|
/* Remove only the end of the entry */
|
||||||
range->count = start - range->start;
|
range->count = start - range->start;
|
||||||
|
|
||||||
ent->changed = true;
|
ent->changed = true;
|
||||||
db->changed = true;
|
db->changed = true;
|
||||||
} else {
|
} else {
|
||||||
|
/* to be removed: [start, end]
|
||||||
|
* range: [first, last] */
|
||||||
/* Remove the middle of the range
|
/* Remove the middle of the range
|
||||||
* This requires to create a new range */
|
* This requires to create a new range */
|
||||||
struct subordinate_range tail;
|
struct subordinate_range tail;
|
||||||
|
Loading…
Reference in New Issue
Block a user