[qwaq] Give up on pass-by-reference for now

It's too much hassle to ensure the passed variable isn't a local. It's
just not worth the grief right now.
This commit is contained in:
Bill Currie 2020-03-19 15:53:20 +09:00
parent db39f7ed3e
commit 3e9977c272
2 changed files with 2 additions and 3 deletions

View file

@ -21,8 +21,7 @@ typedef struct Rect_s {
@extern Point makePoint (int x, int y); @extern Point makePoint (int x, int y);
@extern Extent makeExtent (int width, int height); @extern Extent makeExtent (int width, int height);
@extern Extent mergeExtents (Extent a, Extent b); @extern Extent mergeExtents (Extent a, Extent b);
//XXX will not work if point or rect point to a local variabl @extern int rectContainsPoint (Rect rect, Point point);
@extern int rectContainsPoint (Rect *rect, Point *point);
@extern Rect clipRect (Rect clipRect, Rect rect); @extern Rect clipRect (Rect clipRect, Rect rect);
#endif #endif

View file

@ -46,7 +46,7 @@ Extent mergeExtents (Extent a, Extent b)
} }
int int
rectContainsPoint (Rect *rect, Point *point) rectContainsPoint (Rect rect, Point point)
{ {
return ((point.x >= rect.offset.x return ((point.x >= rect.offset.x
&& point.x < rect.offset.x + rect.extent.width) && point.x < rect.offset.x + rect.extent.width)