File: | ctk/ctkcellareaboxcontext.c |
Warning: | line 694, column 3 Value stored to 'priv' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* ctkcellareaboxcontext.c |
2 | * |
3 | * Copyright (C) 2010 Openismus GmbH |
4 | * |
5 | * Authors: |
6 | * Tristan Van Berkom <tristanvb@openismus.com> |
7 | * |
8 | * This library is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU Library General Public |
10 | * License as published by the Free Software Foundation; either |
11 | * version 2 of the License, or (at your option) any later version. |
12 | * |
13 | * This library is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | * Library General Public License for more details. |
17 | * |
18 | * You should have received a copy of the GNU Library General Public |
19 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
20 | */ |
21 | |
22 | #include "config.h" |
23 | #include "ctkintl.h" |
24 | #include "ctkcellareabox.h" |
25 | #include "ctkcellareaboxcontextprivate.h" |
26 | #include "ctkorientable.h" |
27 | |
28 | /* GObjectClass */ |
29 | static void _ctk_cell_area_box_context_finalize (GObject *object); |
30 | |
31 | /* CtkCellAreaContextClass */ |
32 | static void _ctk_cell_area_box_context_reset (CtkCellAreaContext *context); |
33 | static void _ctk_cell_area_box_context_get_preferred_height_for_width (CtkCellAreaContext *context, |
34 | gint width, |
35 | gint *minimum_height, |
36 | gint *natural_height); |
37 | static void _ctk_cell_area_box_context_get_preferred_width_for_height (CtkCellAreaContext *context, |
38 | gint height, |
39 | gint *minimum_width, |
40 | gint *natural_width); |
41 | |
42 | |
43 | |
44 | /* Internal functions */ |
45 | static void _ctk_cell_area_box_context_sum (CtkCellAreaBoxContext *context, |
46 | CtkOrientation orientation, |
47 | gint for_size, |
48 | gint *minimum_size, |
49 | gint *natural_size); |
50 | static void free_cache_array (GArray *array); |
51 | static GArray *group_array_new (CtkCellAreaBoxContext *context); |
52 | static GArray *get_array (CtkCellAreaBoxContext *context, |
53 | CtkOrientation orientation, |
54 | gint for_size); |
55 | static gboolean group_expands (CtkCellAreaBoxContext *context, |
56 | gint group_idx); |
57 | static gint count_expand_groups (CtkCellAreaBoxContext *context); |
58 | |
59 | |
60 | /* CachedSize management */ |
61 | typedef struct { |
62 | gint min_size; |
63 | gint nat_size; |
64 | } CachedSize; |
65 | |
66 | struct _CtkCellAreaBoxContextPrivate |
67 | { |
68 | /* Table of per renderer CachedSizes */ |
69 | GArray *base_widths; |
70 | GArray *base_heights; |
71 | |
72 | /* Table of per height/width hash tables of per renderer CachedSizes */ |
73 | GHashTable *widths; |
74 | GHashTable *heights; |
75 | |
76 | /* Whether each group expands */ |
77 | gboolean *expand; |
78 | |
79 | /* Whether each group is aligned */ |
80 | gboolean *align; |
81 | }; |
82 | |
83 | G_DEFINE_TYPE_WITH_PRIVATE (CtkCellAreaBoxContext, _ctk_cell_area_box_context, CTK_TYPE_CELL_AREA_CONTEXT)static void _ctk_cell_area_box_context_init (CtkCellAreaBoxContext *self); static void _ctk_cell_area_box_context_class_init (CtkCellAreaBoxContextClass *klass); static GType _ctk_cell_area_box_context_get_type_once (void); static gpointer _ctk_cell_area_box_context_parent_class = ((void*)0); static gint CtkCellAreaBoxContext_private_offset ; static void _ctk_cell_area_box_context_class_intern_init (gpointer klass) { _ctk_cell_area_box_context_parent_class = g_type_class_peek_parent (klass); if (CtkCellAreaBoxContext_private_offset != 0) g_type_class_adjust_private_offset (klass, &CtkCellAreaBoxContext_private_offset); _ctk_cell_area_box_context_class_init ((CtkCellAreaBoxContextClass*) klass); } __attribute__ ((__unused__ )) static inline gpointer _ctk_cell_area_box_context_get_instance_private (CtkCellAreaBoxContext *self) { return (((gpointer) ((guint8 *) (self) + (glong) (CtkCellAreaBoxContext_private_offset)))) ; } GType _ctk_cell_area_box_context_get_type (void) { static GType static_g_define_type_id = 0; if ((__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer) , "Expression evaluates to false"); (void) (0 ? (gpointer) * ( &static_g_define_type_id) : ((void*)0)); (!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer), "Expression evaluates to false"); __typeof__ (*(&static_g_define_type_id)) gapg_temp_newval; __typeof__ ((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id ); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5) ; gapg_temp_newval; })) && g_once_init_enter_pointer ( &static_g_define_type_id)); })) ) { GType g_define_type_id = _ctk_cell_area_box_context_get_type_once (); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer), "Expression evaluates to false"); 0 ? (void ) (*(&static_g_define_type_id) = (g_define_type_id)) : (void ) 0; g_once_init_leave_pointer ((&static_g_define_type_id ), (gpointer) (guintptr) (g_define_type_id)); })) ; } return static_g_define_type_id ; } __attribute__ ((__noinline__)) static GType _ctk_cell_area_box_context_get_type_once (void) { GType g_define_type_id = g_type_register_static_simple ((ctk_cell_area_context_get_type ()), g_intern_static_string ("CtkCellAreaBoxContext"), sizeof (CtkCellAreaBoxContextClass ), (GClassInitFunc)(void (*)(void)) _ctk_cell_area_box_context_class_intern_init , sizeof (CtkCellAreaBoxContext), (GInstanceInitFunc)(void (* )(void)) _ctk_cell_area_box_context_init, (GTypeFlags) 0); { { { CtkCellAreaBoxContext_private_offset = g_type_add_instance_private (g_define_type_id, sizeof (CtkCellAreaBoxContextPrivate)); } ;} } return g_define_type_id; } |
84 | |
85 | static void |
86 | free_cache_array (GArray *array) |
87 | { |
88 | g_array_free (array, TRUE(!(0))); |
89 | } |
90 | |
91 | static GArray * |
92 | group_array_new (CtkCellAreaBoxContext *context) |
93 | { |
94 | CtkCellAreaBoxContextPrivate *priv = context->priv; |
95 | GArray *group_array; |
96 | |
97 | group_array = g_array_new (FALSE(0), TRUE(!(0)), sizeof (CachedSize)); |
98 | g_array_set_size (group_array, priv->base_widths->len); |
99 | |
100 | return group_array; |
101 | } |
102 | |
103 | static GArray * |
104 | get_array (CtkCellAreaBoxContext *context, |
105 | CtkOrientation orientation, |
106 | gint for_size) |
107 | { |
108 | CtkCellAreaBoxContextPrivate *priv = context->priv; |
109 | GArray *array; |
110 | |
111 | if (for_size < 0) |
112 | { |
113 | if (orientation == CTK_ORIENTATION_HORIZONTAL) |
114 | array = priv->base_widths; |
115 | else |
116 | array = priv->base_heights; |
117 | } |
118 | else |
119 | { |
120 | if (orientation == CTK_ORIENTATION_HORIZONTAL) |
121 | { |
122 | array = g_hash_table_lookup (priv->widths, GINT_TO_POINTER (for_size)((gpointer) (glong) (for_size))); |
123 | |
124 | if (!array) |
125 | array = priv->base_widths; |
126 | } |
127 | else |
128 | { |
129 | array = g_hash_table_lookup (priv->heights, GINT_TO_POINTER (for_size)((gpointer) (glong) (for_size))); |
130 | |
131 | if (!array) |
132 | array = priv->base_heights; |
133 | } |
134 | } |
135 | |
136 | return array; |
137 | } |
138 | |
139 | static gboolean |
140 | group_expands (CtkCellAreaBoxContext *context, |
141 | gint group_idx) |
142 | { |
143 | CtkCellAreaBoxContextPrivate *priv = context->priv; |
144 | |
145 | g_assert (group_idx >= 0 && group_idx < priv->base_widths->len)do { if (group_idx >= 0 && group_idx < priv-> base_widths->len) ; else g_assertion_message_expr ("Ctk", "ctkcellareaboxcontext.c" , 145, ((const char*) (__func__)), "group_idx >= 0 && group_idx < priv->base_widths->len" ); } while (0); |
146 | |
147 | return priv->expand[group_idx]; |
148 | } |
149 | |
150 | static gint |
151 | count_expand_groups (CtkCellAreaBoxContext *context) |
152 | { |
153 | CtkCellAreaBoxContextPrivate *priv = context->priv; |
154 | gint i, expand = 0; |
155 | |
156 | for (i = 0; i < priv->base_widths->len; i++) |
157 | { |
158 | if (priv->expand[i]) |
159 | expand++; |
160 | } |
161 | |
162 | return expand; |
163 | } |
164 | |
165 | static void |
166 | _ctk_cell_area_box_context_init (CtkCellAreaBoxContext *box_context) |
167 | { |
168 | CtkCellAreaBoxContextPrivate *priv; |
169 | |
170 | box_context->priv = _ctk_cell_area_box_context_get_instance_private (box_context); |
171 | priv = box_context->priv; |
172 | |
173 | priv->base_widths = g_array_new (FALSE(0), TRUE(!(0)), sizeof (CachedSize)); |
174 | priv->base_heights = g_array_new (FALSE(0), TRUE(!(0)), sizeof (CachedSize)); |
175 | |
176 | priv->widths = g_hash_table_new_full (g_direct_hash, g_direct_equal, |
177 | NULL((void*)0), (GDestroyNotify)free_cache_array); |
178 | priv->heights = g_hash_table_new_full (g_direct_hash, g_direct_equal, |
179 | NULL((void*)0), (GDestroyNotify)free_cache_array); |
180 | } |
181 | |
182 | static void |
183 | _ctk_cell_area_box_context_class_init (CtkCellAreaBoxContextClass *class) |
184 | { |
185 | GObjectClass *object_class = G_OBJECT_CLASS (class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((class)), (((GType) ((20) << (2)))))))); |
186 | CtkCellAreaContextClass *context_class = CTK_CELL_AREA_CONTEXT_CLASS (class)((((CtkCellAreaContextClass*) (void *) g_type_check_class_cast ((GTypeClass*) ((class)), ((ctk_cell_area_context_get_type ( ))))))); |
187 | |
188 | /* GObjectClass */ |
189 | object_class->finalize = _ctk_cell_area_box_context_finalize; |
190 | |
191 | context_class->reset = _ctk_cell_area_box_context_reset; |
192 | context_class->get_preferred_height_for_width = _ctk_cell_area_box_context_get_preferred_height_for_width; |
193 | context_class->get_preferred_width_for_height = _ctk_cell_area_box_context_get_preferred_width_for_height; |
194 | } |
195 | |
196 | /************************************************************* |
197 | * GObjectClass * |
198 | *************************************************************/ |
199 | static void |
200 | _ctk_cell_area_box_context_finalize (GObject *object) |
201 | { |
202 | CtkCellAreaBoxContext *box_context = CTK_CELL_AREA_BOX_CONTEXT (object)((((CtkCellAreaBoxContext*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((object)), ((_ctk_cell_area_box_context_get_type ())))))); |
203 | CtkCellAreaBoxContextPrivate *priv = box_context->priv; |
204 | |
205 | g_array_free (priv->base_widths, TRUE(!(0))); |
206 | g_array_free (priv->base_heights, TRUE(!(0))); |
207 | g_hash_table_destroy (priv->widths); |
208 | g_hash_table_destroy (priv->heights); |
209 | |
210 | g_free (priv->expand); |
211 | g_free (priv->align); |
212 | |
213 | G_OBJECT_CLASS (_ctk_cell_area_box_context_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((_ctk_cell_area_box_context_parent_class)), (((GType) ((20 ) << (2))))))))->finalize (object); |
214 | } |
215 | |
216 | /************************************************************* |
217 | * CtkCellAreaContextClass * |
218 | *************************************************************/ |
219 | static void |
220 | _ctk_cell_area_box_context_reset (CtkCellAreaContext *context) |
221 | { |
222 | CtkCellAreaBoxContext *box_context = CTK_CELL_AREA_BOX_CONTEXT (context)((((CtkCellAreaBoxContext*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((context)), ((_ctk_cell_area_box_context_get_type ())))))); |
223 | CtkCellAreaBoxContextPrivate *priv = box_context->priv; |
224 | gint i; |
225 | |
226 | for (i = 0; i < priv->base_widths->len; i++) |
227 | { |
228 | CachedSize *size; |
229 | |
230 | size = &g_array_index (priv->base_widths, CachedSize, i)(((CachedSize*) (void *) (priv->base_widths)->data) [(i )]); |
231 | |
232 | size->min_size = 0; |
233 | size->nat_size = 0; |
234 | |
235 | size = &g_array_index (priv->base_heights, CachedSize, i)(((CachedSize*) (void *) (priv->base_heights)->data) [( i)]); |
236 | |
237 | size->min_size = 0; |
238 | size->nat_size = 0; |
239 | } |
240 | |
241 | /* Reset context sizes as well */ |
242 | g_hash_table_remove_all (priv->widths); |
243 | g_hash_table_remove_all (priv->heights); |
244 | |
245 | CTK_CELL_AREA_CONTEXT_CLASS((((CtkCellAreaContextClass*) (void *) g_type_check_class_cast ((GTypeClass*) ((_ctk_cell_area_box_context_parent_class)), ( (ctk_cell_area_context_get_type ())))))) |
246 | (_ctk_cell_area_box_context_parent_class)((((CtkCellAreaContextClass*) (void *) g_type_check_class_cast ((GTypeClass*) ((_ctk_cell_area_box_context_parent_class)), ( (ctk_cell_area_context_get_type ()))))))->reset (context); |
247 | } |
248 | |
249 | static void |
250 | _ctk_cell_area_box_context_sum (CtkCellAreaBoxContext *context, |
251 | CtkOrientation orientation, |
252 | gint for_size, |
253 | gint *minimum_size, |
254 | gint *natural_size) |
255 | { |
256 | CtkCellAreaBoxContextPrivate *priv = context->priv; |
257 | CtkCellAreaBox *area; |
258 | CtkOrientation box_orientation; |
259 | GArray *array; |
260 | gint spacing, i, last_aligned_group_idx; |
261 | gint min_size = 0, nat_size = 0; |
262 | |
263 | area = (CtkCellAreaBox *)ctk_cell_area_context_get_area (CTK_CELL_AREA_CONTEXT (context)((((CtkCellAreaContext*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((context)), ((ctk_cell_area_context_get_type ()))))))); |
264 | spacing = ctk_cell_area_box_get_spacing (area); |
265 | box_orientation = ctk_orientable_get_orientation (CTK_ORIENTABLE (area)((((CtkOrientable*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((area)), ((ctk_orientable_get_type ()))))))); |
266 | array = get_array (context, orientation, for_size); |
267 | |
268 | /* Get the last visible aligned group |
269 | * (we need to get space at least up till this group) */ |
270 | for (i = array->len - 1; i >= 0; i--) |
271 | { |
272 | if (priv->align[i] && |
273 | _ctk_cell_area_box_group_visible (area, i)) |
274 | break; |
275 | } |
276 | last_aligned_group_idx = i >= 0 ? i : 0; |
277 | |
278 | for (i = 0; i < array->len; i++) |
279 | { |
280 | CachedSize *size = &g_array_index (array, CachedSize, i)(((CachedSize*) (void *) (array)->data) [(i)]); |
281 | |
282 | if (box_orientation == orientation) |
283 | { |
284 | if (i > last_aligned_group_idx && |
285 | !_ctk_cell_area_box_group_visible (area, i)) |
286 | continue; |
287 | |
288 | /* Dont add spacing for 0 size groups, they can be 0 size because |
289 | * they contain only invisible cells for this round of requests |
290 | */ |
291 | if (min_size > 0 && size->nat_size > 0) |
292 | { |
293 | min_size += spacing; |
294 | nat_size += spacing; |
295 | } |
296 | |
297 | min_size += size->min_size; |
298 | nat_size += size->nat_size; |
299 | } |
300 | else |
301 | { |
302 | min_size = MAX (min_size, size->min_size)(((min_size) > (size->min_size)) ? (min_size) : (size-> min_size)); |
303 | nat_size = MAX (nat_size, size->nat_size)(((nat_size) > (size->nat_size)) ? (nat_size) : (size-> nat_size)); |
304 | } |
305 | } |
306 | |
307 | if (for_size < 0) |
308 | { |
309 | if (orientation == CTK_ORIENTATION_HORIZONTAL) |
310 | ctk_cell_area_context_push_preferred_width (CTK_CELL_AREA_CONTEXT (context)((((CtkCellAreaContext*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((context)), ((ctk_cell_area_context_get_type ())))))), min_size, nat_size); |
311 | else |
312 | ctk_cell_area_context_push_preferred_height (CTK_CELL_AREA_CONTEXT (context)((((CtkCellAreaContext*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((context)), ((ctk_cell_area_context_get_type ())))))), min_size, nat_size); |
313 | } |
314 | |
315 | if (minimum_size) |
316 | *minimum_size = min_size; |
317 | if (natural_size) |
318 | *natural_size = nat_size; |
319 | } |
320 | |
321 | static void |
322 | _ctk_cell_area_box_context_get_preferred_height_for_width (CtkCellAreaContext *context, |
323 | gint width, |
324 | gint *minimum_height, |
325 | gint *natural_height) |
326 | { |
327 | _ctk_cell_area_box_context_sum (CTK_CELL_AREA_BOX_CONTEXT (context)((((CtkCellAreaBoxContext*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((context)), ((_ctk_cell_area_box_context_get_type ())))))), CTK_ORIENTATION_VERTICAL, |
328 | width, minimum_height, natural_height); |
329 | } |
330 | |
331 | static void |
332 | _ctk_cell_area_box_context_get_preferred_width_for_height (CtkCellAreaContext *context, |
333 | gint height, |
334 | gint *minimum_width, |
335 | gint *natural_width) |
336 | { |
337 | _ctk_cell_area_box_context_sum (CTK_CELL_AREA_BOX_CONTEXT (context)((((CtkCellAreaBoxContext*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((context)), ((_ctk_cell_area_box_context_get_type ())))))), CTK_ORIENTATION_HORIZONTAL, |
338 | height, minimum_width, natural_width); |
339 | } |
340 | |
341 | /************************************************************* |
342 | * API * |
343 | *************************************************************/ |
344 | static void |
345 | copy_size_array (GArray *src_array, |
346 | GArray *dest_array) |
347 | { |
348 | gint i; |
349 | |
350 | for (i = 0; i < src_array->len; i++) |
351 | { |
352 | CachedSize *src = &g_array_index (src_array, CachedSize, i)(((CachedSize*) (void *) (src_array)->data) [(i)]); |
353 | CachedSize *dest = &g_array_index (dest_array, CachedSize, i)(((CachedSize*) (void *) (dest_array)->data) [(i)]); |
354 | |
355 | memcpy (dest, src, sizeof (CachedSize)); |
356 | } |
357 | } |
358 | |
359 | static void |
360 | for_size_copy (gpointer key, |
361 | GArray *size_array, |
362 | GHashTable *dest_hash) |
363 | { |
364 | GArray *new_array; |
365 | |
366 | new_array = g_array_new (FALSE(0), TRUE(!(0)), sizeof (CachedSize)); |
367 | g_array_set_size (new_array, size_array->len); |
368 | |
369 | copy_size_array (size_array, new_array); |
370 | |
371 | g_hash_table_insert (dest_hash, key, new_array); |
372 | } |
373 | |
374 | CtkCellAreaBoxContext * |
375 | _ctk_cell_area_box_context_copy (CtkCellAreaBox *box, |
376 | CtkCellAreaBoxContext *context) |
377 | { |
378 | CtkCellAreaBoxContext *copy; |
379 | |
380 | copy = g_object_new (CTK_TYPE_CELL_AREA_BOX_CONTEXT(_ctk_cell_area_box_context_get_type ()), |
381 | "area", box, NULL((void*)0)); |
382 | |
383 | _ctk_cell_area_box_init_groups (copy, |
384 | context->priv->base_widths->len, |
385 | context->priv->expand, |
386 | context->priv->align); |
387 | |
388 | /* Copy the base arrays */ |
389 | copy_size_array (context->priv->base_widths, |
390 | copy->priv->base_widths); |
391 | copy_size_array (context->priv->base_heights, |
392 | copy->priv->base_heights); |
393 | |
394 | /* Copy each for size */ |
395 | g_hash_table_foreach (context->priv->heights, |
396 | (GHFunc)for_size_copy, copy->priv->heights); |
397 | g_hash_table_foreach (context->priv->widths, |
398 | (GHFunc)for_size_copy, copy->priv->widths); |
399 | |
400 | |
401 | return copy; |
402 | } |
403 | |
404 | void |
405 | _ctk_cell_area_box_init_groups (CtkCellAreaBoxContext *box_context, |
406 | guint n_groups, |
407 | gboolean *expand_groups, |
408 | gboolean *align_groups) |
409 | { |
410 | CtkCellAreaBoxContextPrivate *priv; |
411 | |
412 | g_return_if_fail (CTK_IS_CELL_AREA_BOX_CONTEXT (box_context))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((box_context)); GType __t = ((_ctk_cell_area_box_context_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__)), "CTK_IS_CELL_AREA_BOX_CONTEXT (box_context)" ); return; } } while (0); |
413 | g_return_if_fail (n_groups == 0 || expand_groups != NULL)do { if ((n_groups == 0 || expand_groups != ((void*)0))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__) ), "n_groups == 0 || expand_groups != NULL"); return; } } while (0); |
414 | |
415 | /* When the group dimensions change, all info must be reset |
416 | * Note this already clears the min/nat values on the CachedSizes |
417 | */ |
418 | ctk_cell_area_context_reset (CTK_CELL_AREA_CONTEXT (box_context)((((CtkCellAreaContext*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((box_context)), ((ctk_cell_area_context_get_type ()))))))); |
419 | |
420 | priv = box_context->priv; |
421 | g_array_set_size (priv->base_widths, n_groups); |
422 | g_array_set_size (priv->base_heights, n_groups); |
423 | |
424 | g_free (priv->expand); |
425 | priv->expand = g_memdup2 (expand_groups, n_groups * sizeof (gboolean)); |
426 | |
427 | g_free (priv->align); |
428 | priv->align = g_memdup2 (align_groups, n_groups * sizeof (gboolean)); |
429 | } |
430 | |
431 | void |
432 | _ctk_cell_area_box_context_push_group_width (CtkCellAreaBoxContext *box_context, |
433 | gint group_idx, |
434 | gint minimum_width, |
435 | gint natural_width) |
436 | { |
437 | CtkCellAreaBoxContextPrivate *priv; |
438 | CachedSize *size; |
439 | gboolean grew = FALSE(0); |
440 | |
441 | g_return_if_fail (CTK_IS_CELL_AREA_BOX_CONTEXT (box_context))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((box_context)); GType __t = ((_ctk_cell_area_box_context_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__)), "CTK_IS_CELL_AREA_BOX_CONTEXT (box_context)" ); return; } } while (0); |
442 | |
443 | priv = box_context->priv; |
444 | g_return_if_fail (group_idx < priv->base_widths->len)do { if ((group_idx < priv->base_widths->len)) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__) ), "group_idx < priv->base_widths->len"); return; } } while (0); |
445 | |
446 | size = &g_array_index (priv->base_widths, CachedSize, group_idx)(((CachedSize*) (void *) (priv->base_widths)->data) [(group_idx )]); |
447 | if (minimum_width > size->min_size) |
448 | { |
449 | size->min_size = minimum_width; |
450 | grew = TRUE(!(0)); |
451 | } |
452 | if (natural_width > size->nat_size) |
453 | { |
454 | size->nat_size = natural_width; |
455 | grew = TRUE(!(0)); |
456 | } |
457 | |
458 | if (grew) |
459 | _ctk_cell_area_box_context_sum (box_context, CTK_ORIENTATION_HORIZONTAL, -1, NULL((void*)0), NULL((void*)0)); |
460 | } |
461 | |
462 | void |
463 | _ctk_cell_area_box_context_push_group_height_for_width (CtkCellAreaBoxContext *box_context, |
464 | gint group_idx, |
465 | gint for_width, |
466 | gint minimum_height, |
467 | gint natural_height) |
468 | { |
469 | CtkCellAreaBoxContextPrivate *priv; |
470 | GArray *group_array; |
471 | CachedSize *size; |
472 | |
473 | g_return_if_fail (CTK_IS_CELL_AREA_BOX_CONTEXT (box_context))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((box_context)); GType __t = ((_ctk_cell_area_box_context_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__)), "CTK_IS_CELL_AREA_BOX_CONTEXT (box_context)" ); return; } } while (0); |
474 | |
475 | priv = box_context->priv; |
476 | g_return_if_fail (group_idx < priv->base_widths->len)do { if ((group_idx < priv->base_widths->len)) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__) ), "group_idx < priv->base_widths->len"); return; } } while (0); |
477 | |
478 | group_array = g_hash_table_lookup (priv->heights, GINT_TO_POINTER (for_width)((gpointer) (glong) (for_width))); |
479 | if (!group_array) |
480 | { |
481 | group_array = group_array_new (box_context); |
482 | g_hash_table_insert (priv->heights, GINT_TO_POINTER (for_width)((gpointer) (glong) (for_width)), group_array); |
483 | } |
484 | |
485 | size = &g_array_index (group_array, CachedSize, group_idx)(((CachedSize*) (void *) (group_array)->data) [(group_idx) ]); |
486 | size->min_size = MAX (size->min_size, minimum_height)(((size->min_size) > (minimum_height)) ? (size->min_size ) : (minimum_height)); |
487 | size->nat_size = MAX (size->nat_size, natural_height)(((size->nat_size) > (natural_height)) ? (size->nat_size ) : (natural_height)); |
488 | } |
489 | |
490 | void |
491 | _ctk_cell_area_box_context_push_group_height (CtkCellAreaBoxContext *box_context, |
492 | gint group_idx, |
493 | gint minimum_height, |
494 | gint natural_height) |
495 | { |
496 | CtkCellAreaBoxContextPrivate *priv; |
497 | CachedSize *size; |
498 | gboolean grew = FALSE(0); |
499 | |
500 | g_return_if_fail (CTK_IS_CELL_AREA_BOX_CONTEXT (box_context))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((box_context)); GType __t = ((_ctk_cell_area_box_context_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__)), "CTK_IS_CELL_AREA_BOX_CONTEXT (box_context)" ); return; } } while (0); |
501 | |
502 | priv = box_context->priv; |
503 | g_return_if_fail (group_idx < priv->base_heights->len)do { if ((group_idx < priv->base_heights->len)) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__) ), "group_idx < priv->base_heights->len"); return; } } while (0); |
504 | |
505 | size = &g_array_index (priv->base_heights, CachedSize, group_idx)(((CachedSize*) (void *) (priv->base_heights)->data) [( group_idx)]); |
506 | if (minimum_height > size->min_size) |
507 | { |
508 | size->min_size = minimum_height; |
509 | grew = TRUE(!(0)); |
510 | } |
511 | if (natural_height > size->nat_size) |
512 | { |
513 | size->nat_size = natural_height; |
514 | grew = TRUE(!(0)); |
515 | } |
516 | |
517 | if (grew) |
518 | _ctk_cell_area_box_context_sum (box_context, CTK_ORIENTATION_VERTICAL, -1, NULL((void*)0), NULL((void*)0)); |
519 | } |
520 | |
521 | void |
522 | _ctk_cell_area_box_context_push_group_width_for_height (CtkCellAreaBoxContext *box_context, |
523 | gint group_idx, |
524 | gint for_height, |
525 | gint minimum_width, |
526 | gint natural_width) |
527 | { |
528 | CtkCellAreaBoxContextPrivate *priv; |
529 | GArray *group_array; |
530 | CachedSize *size; |
531 | |
532 | g_return_if_fail (CTK_IS_CELL_AREA_BOX_CONTEXT (box_context))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((box_context)); GType __t = ((_ctk_cell_area_box_context_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__)), "CTK_IS_CELL_AREA_BOX_CONTEXT (box_context)" ); return; } } while (0); |
533 | |
534 | priv = box_context->priv; |
535 | g_return_if_fail (group_idx < priv->base_widths->len)do { if ((group_idx < priv->base_widths->len)) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__) ), "group_idx < priv->base_widths->len"); return; } } while (0); |
536 | |
537 | group_array = g_hash_table_lookup (priv->widths, GINT_TO_POINTER (for_height)((gpointer) (glong) (for_height))); |
538 | if (!group_array) |
539 | { |
540 | group_array = group_array_new (box_context); |
541 | g_hash_table_insert (priv->widths, GINT_TO_POINTER (for_height)((gpointer) (glong) (for_height)), group_array); |
542 | } |
543 | |
544 | size = &g_array_index (group_array, CachedSize, group_idx)(((CachedSize*) (void *) (group_array)->data) [(group_idx) ]); |
545 | size->min_size = MAX (size->min_size, minimum_width)(((size->min_size) > (minimum_width)) ? (size->min_size ) : (minimum_width)); |
546 | size->nat_size = MAX (size->nat_size, natural_width)(((size->nat_size) > (natural_width)) ? (size->nat_size ) : (natural_width)); |
547 | } |
548 | |
549 | void |
550 | _ctk_cell_area_box_context_get_group_width (CtkCellAreaBoxContext *box_context, |
551 | gint group_idx, |
552 | gint *minimum_width, |
553 | gint *natural_width) |
554 | { |
555 | CtkCellAreaBoxContextPrivate *priv; |
556 | CachedSize *size; |
557 | |
558 | g_return_if_fail (CTK_IS_CELL_AREA_BOX_CONTEXT (box_context))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((box_context)); GType __t = ((_ctk_cell_area_box_context_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__)), "CTK_IS_CELL_AREA_BOX_CONTEXT (box_context)" ); return; } } while (0); |
559 | |
560 | priv = box_context->priv; |
561 | g_return_if_fail (group_idx < priv->base_widths->len)do { if ((group_idx < priv->base_widths->len)) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__) ), "group_idx < priv->base_widths->len"); return; } } while (0); |
562 | |
563 | size = &g_array_index (priv->base_widths, CachedSize, group_idx)(((CachedSize*) (void *) (priv->base_widths)->data) [(group_idx )]); |
564 | |
565 | if (minimum_width) |
566 | *minimum_width = size->min_size; |
567 | |
568 | if (natural_width) |
569 | *natural_width = size->nat_size; |
570 | } |
571 | |
572 | void |
573 | _ctk_cell_area_box_context_get_group_height_for_width (CtkCellAreaBoxContext *box_context, |
574 | gint group_idx, |
575 | gint for_width, |
576 | gint *minimum_height, |
577 | gint *natural_height) |
578 | { |
579 | CtkCellAreaBoxContextPrivate *priv; |
580 | GArray *group_array; |
581 | |
582 | g_return_if_fail (CTK_IS_CELL_AREA_BOX_CONTEXT (box_context))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((box_context)); GType __t = ((_ctk_cell_area_box_context_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__)), "CTK_IS_CELL_AREA_BOX_CONTEXT (box_context)" ); return; } } while (0); |
583 | |
584 | priv = box_context->priv; |
585 | g_return_if_fail (group_idx < priv->base_widths->len)do { if ((group_idx < priv->base_widths->len)) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__) ), "group_idx < priv->base_widths->len"); return; } } while (0); |
586 | |
587 | group_array = g_hash_table_lookup (priv->heights, GINT_TO_POINTER (for_width)((gpointer) (glong) (for_width))); |
588 | |
589 | if (group_array) |
590 | { |
591 | CachedSize *size = &g_array_index (group_array, CachedSize, group_idx)(((CachedSize*) (void *) (group_array)->data) [(group_idx) ]); |
592 | |
593 | if (minimum_height) |
594 | *minimum_height = size->min_size; |
595 | |
596 | if (natural_height) |
597 | *natural_height = size->nat_size; |
598 | } |
599 | else |
600 | { |
601 | if (minimum_height) |
602 | *minimum_height = -1; |
603 | |
604 | if (natural_height) |
605 | *natural_height = -1; |
606 | } |
607 | } |
608 | |
609 | void |
610 | _ctk_cell_area_box_context_get_group_height (CtkCellAreaBoxContext *box_context, |
611 | gint group_idx, |
612 | gint *minimum_height, |
613 | gint *natural_height) |
614 | { |
615 | CtkCellAreaBoxContextPrivate *priv; |
616 | CachedSize *size; |
617 | |
618 | g_return_if_fail (CTK_IS_CELL_AREA_BOX_CONTEXT (box_context))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((box_context)); GType __t = ((_ctk_cell_area_box_context_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__)), "CTK_IS_CELL_AREA_BOX_CONTEXT (box_context)" ); return; } } while (0); |
619 | |
620 | priv = box_context->priv; |
621 | g_return_if_fail (group_idx < priv->base_heights->len)do { if ((group_idx < priv->base_heights->len)) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__) ), "group_idx < priv->base_heights->len"); return; } } while (0); |
622 | |
623 | size = &g_array_index (priv->base_heights, CachedSize, group_idx)(((CachedSize*) (void *) (priv->base_heights)->data) [( group_idx)]); |
624 | |
625 | if (minimum_height) |
626 | *minimum_height = size->min_size; |
627 | |
628 | if (natural_height) |
629 | *natural_height = size->nat_size; |
630 | } |
631 | |
632 | void |
633 | _ctk_cell_area_box_context_get_group_width_for_height (CtkCellAreaBoxContext *box_context, |
634 | gint group_idx, |
635 | gint for_height, |
636 | gint *minimum_width, |
637 | gint *natural_width) |
638 | { |
639 | CtkCellAreaBoxContextPrivate *priv; |
640 | GArray *group_array; |
641 | |
642 | g_return_if_fail (CTK_IS_CELL_AREA_BOX_CONTEXT (box_context))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((box_context)); GType __t = ((_ctk_cell_area_box_context_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__)), "CTK_IS_CELL_AREA_BOX_CONTEXT (box_context)" ); return; } } while (0); |
643 | |
644 | priv = box_context->priv; |
645 | g_return_if_fail (group_idx < priv->base_widths->len)do { if ((group_idx < priv->base_widths->len)) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__) ), "group_idx < priv->base_widths->len"); return; } } while (0); |
646 | |
647 | group_array = g_hash_table_lookup (priv->widths, GINT_TO_POINTER (for_height)((gpointer) (glong) (for_height))); |
648 | |
649 | if (group_array) |
650 | { |
651 | CachedSize *size = &g_array_index (group_array, CachedSize, group_idx)(((CachedSize*) (void *) (group_array)->data) [(group_idx) ]); |
652 | |
653 | if (minimum_width) |
654 | *minimum_width = size->min_size; |
655 | |
656 | if (natural_width) |
657 | *natural_width = size->nat_size; |
658 | } |
659 | else |
660 | { |
661 | if (minimum_width) |
662 | *minimum_width = -1; |
663 | |
664 | if (natural_width) |
665 | *natural_width = -1; |
666 | } |
667 | } |
668 | |
669 | static CtkRequestedSize * |
670 | _ctk_cell_area_box_context_get_requests (CtkCellAreaBoxContext *box_context, |
671 | CtkCellAreaBox *area, |
672 | CtkOrientation orientation, |
673 | gint for_size, |
674 | gint *n_requests) |
675 | { |
676 | CtkCellAreaBoxContextPrivate *priv = box_context->priv; |
677 | CtkRequestedSize *requests; |
678 | GArray *array; |
679 | CachedSize *size; |
680 | gint visible_groups = 0; |
681 | gint last_aligned_group_idx = 0; |
682 | gint i, j; |
683 | |
684 | /* Get the last visible aligned group |
685 | * (we need to get space at least up till this group) */ |
686 | for (i = priv->base_widths->len - 1; i >= 0; i--) |
687 | { |
688 | if (priv->align[i] && |
689 | _ctk_cell_area_box_group_visible (area, i)) |
690 | break; |
691 | } |
692 | last_aligned_group_idx = i >= 0 ? i : 0; |
693 | |
694 | priv = box_context->priv; |
Value stored to 'priv' is never read | |
695 | array = get_array (box_context, orientation, for_size); |
696 | |
697 | for (i = 0; i < array->len; i++) |
698 | { |
699 | size = &g_array_index (array, CachedSize, i)(((CachedSize*) (void *) (array)->data) [(i)]); |
700 | |
701 | if (size->nat_size > 0 && |
702 | (i <= last_aligned_group_idx || |
703 | _ctk_cell_area_box_group_visible (area, i))) |
704 | visible_groups++; |
705 | } |
706 | |
707 | requests = g_new (CtkRequestedSize, visible_groups)((CtkRequestedSize *) g_malloc_n ((visible_groups), sizeof (CtkRequestedSize ))); |
708 | |
709 | for (j = 0, i = 0; i < array->len; i++) |
710 | { |
711 | size = &g_array_index (array, CachedSize, i)(((CachedSize*) (void *) (array)->data) [(i)]); |
712 | |
713 | if (size->nat_size > 0 && |
714 | (i <= last_aligned_group_idx || |
715 | _ctk_cell_area_box_group_visible (area, i))) |
716 | { |
717 | requests[j].data = GINT_TO_POINTER (i)((gpointer) (glong) (i)); |
718 | requests[j].minimum_size = size->min_size; |
719 | requests[j].natural_size = size->nat_size; |
720 | j++; |
721 | } |
722 | } |
723 | |
724 | if (n_requests) |
725 | *n_requests = visible_groups; |
726 | |
727 | return requests; |
728 | } |
729 | |
730 | static CtkCellAreaBoxAllocation * |
731 | allocate_for_orientation (CtkCellAreaBoxContext *context, |
732 | CtkCellAreaBox *area, |
733 | CtkOrientation orientation, |
734 | gint spacing, |
735 | gint size, |
736 | gint for_size, |
737 | gint *n_allocs) |
738 | { |
739 | CtkCellAreaBoxContextPrivate *priv = context->priv; |
740 | CtkCellAreaBoxAllocation *allocs; |
741 | CtkRequestedSize *sizes; |
742 | gint n_expand_groups = 0; |
743 | gint i, n_groups, position, vis_position; |
744 | gint extra_size, extra_extra; |
745 | gint avail_size = size; |
746 | |
747 | sizes = _ctk_cell_area_box_context_get_requests (context, area, orientation, for_size, &n_groups); |
748 | n_expand_groups = count_expand_groups (context); |
749 | |
750 | /* First start by naturally allocating space among groups */ |
751 | avail_size -= (n_groups - 1) * spacing; |
752 | for (i = 0; i < n_groups; i++) |
753 | avail_size -= sizes[i].minimum_size; |
754 | |
755 | if (avail_size > 0) |
756 | avail_size = ctk_distribute_natural_allocation (avail_size, n_groups, sizes); |
757 | else |
758 | avail_size = 0; |
759 | |
760 | /* Calculate/distribute expand for groups */ |
761 | if (n_expand_groups > 0) |
762 | { |
763 | extra_size = avail_size / n_expand_groups; |
764 | extra_extra = avail_size % n_expand_groups; |
765 | } |
766 | else |
767 | extra_size = extra_extra = 0; |
768 | |
769 | allocs = g_new (CtkCellAreaBoxAllocation, n_groups)((CtkCellAreaBoxAllocation *) g_malloc_n ((n_groups), sizeof ( CtkCellAreaBoxAllocation))); |
770 | |
771 | for (vis_position = 0, position = 0, i = 0; i < n_groups; i++) |
772 | { |
773 | allocs[i].group_idx = GPOINTER_TO_INT (sizes[i].data)((gint) (glong) (sizes[i].data)); |
774 | |
775 | if (priv->align[allocs[i].group_idx]) |
776 | vis_position = position; |
777 | |
778 | allocs[i].position = vis_position; |
779 | allocs[i].size = sizes[i].minimum_size; |
780 | |
781 | if (group_expands (context, allocs[i].group_idx)) |
782 | { |
783 | allocs[i].size += extra_size; |
784 | if (extra_extra) |
785 | { |
786 | allocs[i].size++; |
787 | extra_extra--; |
788 | } |
789 | } |
790 | |
791 | position += allocs[i].size; |
792 | position += spacing; |
793 | |
794 | if (_ctk_cell_area_box_group_visible (area, allocs[i].group_idx)) |
795 | { |
796 | vis_position += allocs[i].size; |
797 | vis_position += spacing; |
798 | } |
799 | } |
800 | |
801 | if (n_allocs) |
802 | *n_allocs = n_groups; |
803 | |
804 | g_free (sizes); |
805 | |
806 | return allocs; |
807 | } |
808 | |
809 | CtkRequestedSize * |
810 | _ctk_cell_area_box_context_get_widths (CtkCellAreaBoxContext *box_context, |
811 | gint *n_widths) |
812 | { |
813 | CtkCellAreaBox *area = (CtkCellAreaBox *)ctk_cell_area_context_get_area (CTK_CELL_AREA_CONTEXT (box_context)((((CtkCellAreaContext*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((box_context)), ((ctk_cell_area_context_get_type ()))))))); |
814 | |
815 | return _ctk_cell_area_box_context_get_requests (box_context, area, CTK_ORIENTATION_HORIZONTAL, -1, n_widths); |
816 | } |
817 | |
818 | CtkRequestedSize * |
819 | _ctk_cell_area_box_context_get_heights (CtkCellAreaBoxContext *box_context, |
820 | gint *n_heights) |
821 | { |
822 | CtkCellAreaBox *area = (CtkCellAreaBox *)ctk_cell_area_context_get_area (CTK_CELL_AREA_CONTEXT (box_context)((((CtkCellAreaContext*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((box_context)), ((ctk_cell_area_context_get_type ()))))))); |
823 | |
824 | return _ctk_cell_area_box_context_get_requests (box_context, area, CTK_ORIENTATION_VERTICAL, -1, n_heights); |
825 | } |
826 | |
827 | CtkCellAreaBoxAllocation * |
828 | _ctk_cell_area_box_context_get_orientation_allocs (CtkCellAreaBoxContext *context, |
829 | gint *n_allocs) |
830 | { |
831 | CtkCellAreaContext *ctx = CTK_CELL_AREA_CONTEXT (context)((((CtkCellAreaContext*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((context)), ((ctk_cell_area_context_get_type ())))))); |
832 | CtkCellAreaBox *area; |
833 | CtkOrientation orientation; |
834 | gint spacing, width, height, alloc_count = 0; |
835 | CtkCellAreaBoxAllocation *allocs = NULL((void*)0); |
836 | |
837 | area = (CtkCellAreaBox *)ctk_cell_area_context_get_area (ctx); |
838 | orientation = ctk_orientable_get_orientation (CTK_ORIENTABLE (area)((((CtkOrientable*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((area)), ((ctk_orientable_get_type ()))))))); |
839 | spacing = ctk_cell_area_box_get_spacing (area); |
840 | |
841 | ctk_cell_area_context_get_allocation (ctx, &width, &height); |
842 | |
843 | if (orientation == CTK_ORIENTATION_HORIZONTAL && width > 0) |
844 | allocs = allocate_for_orientation (context, area, orientation, |
845 | spacing, width, height, |
846 | &alloc_count); |
847 | else if (orientation == CTK_ORIENTATION_VERTICAL && height > 0) |
848 | allocs = allocate_for_orientation (context, area, orientation, |
849 | spacing, height, width, |
850 | &alloc_count); |
851 | |
852 | *n_allocs = alloc_count; |
853 | |
854 | return allocs; |
855 | } |