aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorPaul Eggert2011-06-17 00:52:35 -0700
committerPaul Eggert2011-06-17 00:52:35 -0700
commitc20998a717f64aa6ab563f727f9eca52ab969624 (patch)
treecb0bfa2ca6511649fbd8d85d4890a13ae2cbb2b8 /src/buffer.c
parent8961a454e148b61750f5ef38f8047fa660941888 (diff)
downloademacs-c20998a717f64aa6ab563f727f9eca52ab969624.tar.gz
emacs-c20998a717f64aa6ab563f727f9eca52ab969624.zip
* buffer.c (compare_overlays, cmp_for_strings): Avoid subtraction overflow.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 898b4572450..4487de1450d 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2858,11 +2858,11 @@ compare_overlays (const void *v1, const void *v2)
2858 const struct sortvec *s1 = (const struct sortvec *) v1; 2858 const struct sortvec *s1 = (const struct sortvec *) v1;
2859 const struct sortvec *s2 = (const struct sortvec *) v2; 2859 const struct sortvec *s2 = (const struct sortvec *) v2;
2860 if (s1->priority != s2->priority) 2860 if (s1->priority != s2->priority)
2861 return s1->priority - s2->priority; 2861 return s1->priority < s2->priority ? -1 : 1;
2862 if (s1->beg != s2->beg) 2862 if (s1->beg != s2->beg)
2863 return s1->beg - s2->beg; 2863 return s1->beg < s2->beg ? -1 : 1;
2864 if (s1->end != s2->end) 2864 if (s1->end != s2->end)
2865 return s2->end - s1->end; 2865 return s2->end < s1->end ? -1 : 1;
2866 return 0; 2866 return 0;
2867} 2867}
2868 2868
@@ -2955,9 +2955,9 @@ cmp_for_strings (const void *as1, const void *as2)
2955 struct sortstr *s1 = (struct sortstr *)as1; 2955 struct sortstr *s1 = (struct sortstr *)as1;
2956 struct sortstr *s2 = (struct sortstr *)as2; 2956 struct sortstr *s2 = (struct sortstr *)as2;
2957 if (s1->size != s2->size) 2957 if (s1->size != s2->size)
2958 return s2->size - s1->size; 2958 return s2->size < s1->size ? -1 : 1;
2959 if (s1->priority != s2->priority) 2959 if (s1->priority != s2->priority)
2960 return s1->priority - s2->priority; 2960 return s1->priority < s2->priority ? -1 : 1;
2961 return 0; 2961 return 0;
2962} 2962}
2963 2963