Re: gtk_widget_get_allocation

On 04/17/2009 09:38 PM, Brian J. Tarricone wrote:
gtk_widget_get_allocation (GtkWidget     *widget,
                            GtkAllocation *allocation)
     g_return_if_fail (GTK_IS_WIDGET (widget) && allocation);

     memcpy (allocation, &widget->allocation, sizeof(*allocation));

(Could also have it return gboolean, but I tend to think it's
unnecessary to have a success/fail return value when the only reason it
would fail is if the programmer is using the function incorrectly.)

I don't think it needs a boolean given the condition. Previously it was being accessed by dereferencing the struct field.

So as you say the only it would fail it because it is used incorrectly. In that case, it wouldn't crash, unlike before when accessing the struct fields.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]