projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
From http://www.jwz.org/xscreensaver/xscreensaver-5.36.tar.gz
[xscreensaver]
/
utils
/
spline.c
diff --git
a/utils/spline.c
b/utils/spline.c
index 84de1cb47eb7581e56ed834aa77ea415eef9107a..1a73ea61b3edb0df1b526758a9e22123d9b1dc7f 100644
(file)
--- a/
utils/spline.c
+++ b/
utils/spline.c
@@
-29,7
+29,6
@@
#define SMOOTHNESS 1.0
#define SMOOTHNESS 1.0
-static void no_more_memory (void);
static void grow_spline_points (spline* s);
static void mid_point (double x0, double y0, double x1, double y1,
double *mx, double *my);
static void grow_spline_points (spline* s);
static void mid_point (double x0, double y0, double x1, double y1,
double *mx, double *my);
@@
-45,19
+44,11
@@
static void calc_section (spline* s, double cminus1x, double cminus1y,
double cx, double cy, double cplus1x, double cplus1y,
double cplus2x, double cplus2y);
double cx, double cy, double cplus1x, double cplus1y,
double cplus2x, double cplus2y);
-static void
-no_more_memory (void)
-{
- fprintf (stderr, "No more memory\n");
- exit (1);
-}
-
spline*
spline*
-make_spline (u
_
int size)
+make_spline (u
nsigned
int size)
{
spline* s = (spline*)calloc (1, sizeof (spline));
{
spline* s = (spline*)calloc (1, sizeof (spline));
- if (!s)
- no_more_memory ();
+ if (!s) abort();
s->n_controls = size;
s->control_x = (double*)calloc (s->n_controls, sizeof (double));
s->control_y = (double*)calloc (s->n_controls, sizeof (double));
s->n_controls = size;
s->control_x = (double*)calloc (s->n_controls, sizeof (double));
s->control_y = (double*)calloc (s->n_controls, sizeof (double));
@@
-67,7
+58,7
@@
make_spline (u_int size)
s->points = (XPoint*)calloc (s->allocated_points, sizeof (XPoint));
if (!s->control_x || !s->control_y || !s->points)
s->points = (XPoint*)calloc (s->allocated_points, sizeof (XPoint));
if (!s->control_x || !s->control_y || !s->points)
-
no_more_memory
();
+
abort
();
return s;
}
return s;
}
@@
-75,12
+66,10
@@
make_spline (u_int size)
static void
grow_spline_points (spline *s)
{
static void
grow_spline_points (spline *s)
{
- s->allocated_points
*= 2
;
+ s->allocated_points
= 10 + (s->allocated_points * 1.3)
;
s->points =
(XPoint*)realloc (s->points, s->allocated_points * sizeof (XPoint));
s->points =
(XPoint*)realloc (s->points, s->allocated_points * sizeof (XPoint));
-
- if (!s->points)
- no_more_memory ();
+ if (!s->points) abort();
}
static void
}
static void
@@
-319,3
+308,12
@@
spline_bounding_box (spline *s, XRectangle *rectangle_out)
rectangle_out->width = max_x - min_x;
rectangle_out->height = max_y - min_y;
}
rectangle_out->width = max_x - min_x;
rectangle_out->height = max_y - min_y;
}
+
+void
+free_spline(spline * s)
+{
+ free ((void *) s->control_x);
+ free ((void *) s->control_y);
+ free ((void *) s->points);
+ free ((void *) s);
+}