equal
deleted
inserted
replaced
1 # HG changeset patch |
|
2 # Parent 26edaf6ea10b8db2ed07da3e4ad9bee03077de84 |
|
3 Fix endless loop on exhaustion of completion category pool |
|
4 |
|
5 diff -r 26edaf6ea10b mcabber/mcabber/compl.c |
|
6 --- a/mcabber/mcabber/compl.c Mon Jul 30 22:39:17 2012 +0200 |
|
7 +++ b/mcabber/mcabber/compl.c Wed Aug 08 12:15:20 2012 +0300 |
|
8 @@ -97,10 +97,11 @@ |
|
9 // as it is likely to change in future. |
|
10 guint compl_new_category(void) |
|
11 { |
|
12 + const guint maxcat = 8 * sizeof (registered_cats); |
|
13 guint i = 0; |
|
14 - while ((registered_cats >> i) & 1) |
|
15 + while ((registered_cats >> i) & 1 && i < maxcat) |
|
16 i++; |
|
17 - if (i >= 8 * sizeof (registered_cats)) |
|
18 + if (i >= maxcat) |
|
19 return 0; |
|
20 else { |
|
21 guint64 id = 1 << i; |
|