- if (Offs < R->Offs) {
-
- /* Got the insert position */
- if (Offs + Size == R->Offs) {
- /* Merge the two */
- R->Offs = Offs;
- R->Size += Size;
- } else {
- /* Insert a new entry */
- CollInsert (CodeRanges, NewCodeRange (Offs, Size), I);
- }
-
- /* Done */
- return;
-
- } else if (R->Offs + R->Size == Offs) {
-
- /* This is the regular case. Merge the two. */
- R->Size += Size;
-
- /* Done */
- return;
-
- }
+ /* Must be same segment */
+ if (R->Seg == Seg) {
+ if (Offs < R->Offs) {
+
+ /* Got the insert position */
+ if (Offs + Size == R->Offs) {
+ /* Merge the two */
+ R->Offs = Offs;
+ R->Size += Size;
+ } else {
+ /* Insert a new entry */
+ CollInsert (CodeRanges, NewCodeRange (Seg, Offs, Size), I);
+ }
+
+ /* Done */
+ return;
+
+ } else if (R->Offs + R->Size == Offs) {
+ /* This is the regular case. Merge the two. */
+ R->Size += Size;
+
+ /* Done */
+ return;
+ }
+ }