Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CGRectDivide with NULL pointer

In the following code, is it possible to get rid of nothing variable?

CGRect startTableViewFrame;
CGRect nothing;
CGRectDivide(tableViewFrame,
             &nothing,
             &startTableViewFrame,
             searchBarHeight - contentOffset,
             CGRectMinYEdge);

NULL doesn't seem to work. Any tips?

Thanks!

like image 435
Rudolf Adamkovič Avatar asked Jul 12 '12 08:07

Rudolf Adamkovič


1 Answers

Well, you could do this

CGRectDivide(tableViewFrame,
             &(CGRect){},
             &startTableViewFrame,
             searchBarHeight - contentOffset,
             CGRectMinYEdge);

or even this:

MyCGRectDivide( CGRect r, CGRect * slice, CGRect * remainder, CGFloat d, CGRectEdge edge )
{
    slice = slice ? slice : &(CGRect){} ;
    remainder = remainder ? remainder : &(CGRect){} ;

    CGRectDivide( r, slice, remainder, d, edge ) ;
}
like image 117
nielsbot Avatar answered Oct 23 '22 23:10

nielsbot