Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/compl.c @ 1828:8f7d7c05f275
Small coding style update
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 27 Mar 2010 11:56:49 +0100 |
parents | e6d355e50d7a |
children | 8d7810f529db |
comparison
equal
deleted
inserted
replaced
1827:a2642e56e0de | 1828:8f7d7c05f275 |
---|---|
1 /* | 1 /* |
2 * compl.c -- Completion system | 2 * compl.c -- Completion system |
3 * | 3 * |
4 * Copyright (C) 2005-2010 Mikael Berthe <mikael@lilotux.net> | 4 * Copyright (C) 2005-2010 Mikael Berthe <mikael@lilotux.net> |
5 * Copyright (C) 2009,2010 Myhailo Danylenko <isbear@ukrpost.net> | |
5 * | 6 * |
6 * This program is free software; you can redistribute it and/or modify | 7 * This program is free software; you can redistribute it and/or modify |
7 * it under the terms of the GNU General Public License as published by | 8 * it under the terms of the GNU General Public License as published by |
8 * the Free Software Foundation; either version 2 of the License, or (at | 9 * the Free Software Foundation; either version 2 of the License, or (at |
9 * your option) any later version. | 10 * your option) any later version. |
65 // compl_new_category() | 66 // compl_new_category() |
66 // Reserves id for new completion category. | 67 // Reserves id for new completion category. |
67 // Returns 0, if no more categories can be allocated. | 68 // Returns 0, if no more categories can be allocated. |
68 // Note, that user should not make any assumptions about id nature, | 69 // Note, that user should not make any assumptions about id nature, |
69 // as it is likely to change in future. | 70 // as it is likely to change in future. |
70 guint compl_new_category (void) | 71 guint compl_new_category(void) |
71 { | 72 { |
72 guint i = 0; | 73 guint i = 0; |
73 while ((registered_cats >> i) & 1) | 74 while ((registered_cats >> i) & 1) |
74 i++; | 75 i++; |
75 if (i >= sizeof (guint)*8) | 76 if (i >= 8 * sizeof (guint)) |
76 return 0; | 77 return 0; |
77 else { | 78 else { |
78 guint id = 1 << i; | 79 guint id = 1 << i; |
79 registered_cats |= id; | 80 registered_cats |= id; |
80 return id; | 81 return id; |
81 } | 82 } |
82 } | 83 } |
83 | 84 |
84 // compl_del_category (id) | 85 // compl_del_category(id) |
85 // Frees reserved id for category. | 86 // Frees reserved id for category. |
86 // Note, that for now it not validates its input, so, be careful | 87 // Note, that for now it not validates its input, so, be careful |
87 // and specify exactly what you get from compl_new_category. | 88 // and specify exactly what you get from compl_new_category. |
88 void compl_del_category (guint id) | 89 void compl_del_category(guint id) |
89 { | 90 { |
90 registered_cats &= ~id; | 91 registered_cats &= ~id; |
91 } | 92 } |
92 #endif | 93 #endif |
93 | 94 |