Mercurial > hg
comparison mcabber/src/hbuf.c @ 1241:3a4018f18bdf
Cosmetics
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 16 Jun 2007 19:41:09 +0200 |
parents | 79c396678f1b |
children | dbc907b2d92f |
comparison
equal
deleted
inserted
replaced
1240:a54645448e00 | 1241:3a4018f18bdf |
---|---|
173 hbuf_block_elt->ptr = g_new0(char, HBB_BLOCKSIZE); | 173 hbuf_block_elt->ptr = g_new0(char, HBB_BLOCKSIZE); |
174 } else { | 174 } else { |
175 // Let's use an old block, and free the extra blocks if needed | 175 // Let's use an old block, and free the extra blocks if needed |
176 char *allocated_block = NULL; | 176 char *allocated_block = NULL; |
177 while (n >= maxhbufblocks) { | 177 while (n >= maxhbufblocks) { |
178 /* --- */ | |
179 int start_of_block = 1; | 178 int start_of_block = 1; |
180 for (hbuf_elt = hbuf_head; hbuf_elt; hbuf_elt = hbuf_head) { | 179 for (hbuf_elt = hbuf_head; hbuf_elt; hbuf_elt = hbuf_head) { |
181 hbuf_b_elt = (hbuf_block*)(hbuf_elt->data); | 180 hbuf_b_elt = (hbuf_block*)(hbuf_elt->data); |
182 if (hbuf_b_elt->flags & HBB_FLAG_ALLOC) { | 181 if (hbuf_b_elt->flags & HBB_FLAG_ALLOC) { |
183 if (start_of_block-- == 0) | 182 if (start_of_block-- == 0) |
189 } | 188 } |
190 g_free(hbuf_b_elt); | 189 g_free(hbuf_b_elt); |
191 hbuf_head = *p_hbuf = g_list_delete_link(hbuf_head, hbuf_elt); | 190 hbuf_head = *p_hbuf = g_list_delete_link(hbuf_head, hbuf_elt); |
192 } | 191 } |
193 n--; | 192 n--; |
194 /* --- */ | |
195 } | 193 } |
196 memset(allocated_block, 0, HBB_BLOCKSIZE); | 194 memset(allocated_block, 0, HBB_BLOCKSIZE); |
197 hbuf_block_elt->ptr = allocated_block; | 195 hbuf_block_elt->ptr = allocated_block; |
198 } | 196 } |
199 } | 197 } |