Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | /* |
2 | * src/rects.c |
||
3 | * |
||
4 | * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). All rights reserved. |
||
5 | * |
||
6 | * The use and distribution terms for this software are contained in the file |
||
7 | * named README, which can be found in the root of this distribution. By |
||
8 | * using this software in any fashion, you are agreeing to be bound by the |
||
9 | * terms of this license. |
||
10 | * |
||
11 | * You must not remove this notice, or any other, from this software. |
||
12 | */ |
||
13 | |||
14 | #include <stdlib.h> /* malloc */ |
||
15 | |||
16 | #include "system.h" |
||
17 | #include "rects.h" |
||
18 | |||
19 | |||
20 | /* |
||
21 | * Free a list of rectangles and set the pointer to NULL. |
||
22 | * |
||
23 | * p: rectangle list CHANGED to NULL |
||
24 | */ |
||
25 | void rects_free (rect_t *r) |
||
26 | { |
||
27 | if (r) |
||
28 | { |
||
29 | rects_free (r->next); |
||
30 | free (r); |
||
31 | } |
||
32 | } |
||
33 | |||
34 | |||
35 | /* |
||
36 | * Add a rectangle to a list of rectangles |
||
37 | */ |
||
38 | rect_t *rects_new (U16 x, U16 y, U16 width, U16 height, rect_t *next) |
||
39 | { |
||
40 | rect_t *r; |
||
41 | |||
42 | r = malloc (sizeof *r); |
||
43 | r->x = x; |
||
44 | r->y = y; |
||
45 | r->width = width; |
||
46 | r->height = height; |
||
47 | r->next = next; |
||
48 | return r; |
||
49 | } |