double bOnA = ep->b / ep->a;
double etaXMin, etaXMax, etaYMin, etaYMax;
- if (abs(ep->sinTheta) < 0.1) {
+ if (fabs(ep->sinTheta) < 0.1) {
double tanTheta = ep->sinTheta / ep->cosTheta;
if (ep->cosTheta < 0) {
etaXMin = -atan(tanTheta * bOnA);
double dx = xB - xA;
double dy = yB - yA;
- return abs(x * dy - y * dx + xB * yA - xA * yB)
+ return fabs(x * dy - y * dx + xB * yA - xA * yB)
/ sqrt(dx * dx + dy * dy);
} else {
* 3 => warning message
* There is a last sentinel segment with color == NULL; it will always follow
* the last segment with t > 0.
+ *
+ * Note that psegs is only assigned to if the return value is 0 or 3.
+ * Otherwise, psegs is left unchanged and the allocated memory is
+ * freed before returning.
*/
static int
parseSegs (char* clrs, int nseg, colorsegs_t** psegs)
if ((ED_spl(e)->size>1) && (bz.sflag||bz.eflag) && styles)
gvrender_set_style(job, styles);
}
- free (segs);
+ freeSegs (segs);
return 0;
}
*/
boolean findStopColor (char* colorlist, char* clrs[2], float* frac)
{
- colorsegs_t* segs;
+ colorsegs_t* segs = NULL;
int rv;
rv = parseSegs (colorlist, 0, &segs);
if (rv || (segs->numc < 2) || (segs->segs[0].color == NULL)) {
clrs[0] = NULL;
+ freeSegs (segs);
return FALSE;
}
dimen = ND_label(n)->dimen;
/* minimal whitespace around label */
- if (ROUND(abs(dimen.x)) || ROUND(abs(dimen.y))) {
+ if ((dimen.x > 0) || (dimen.y > 0)) {
/* padding */
if ((p = agget(n, "margin"))) {
marginx = marginy = 0;
static PostscriptAlias *result;
if (key.name == NULL || strcasecmp(key.name, fontname)) {
- key.name = fontname;
+ free(key.name);
+ key.name = strdup(fontname);
result = (PostscriptAlias *) bsearch((void *) &key,
(void *) postscript_alias,
sizeof(postscript_alias) / sizeof(PostscriptAlias),
double dx = (pointer.x - job->oldpointer.x) / job->devscale.x;
double dy = (pointer.y - job->oldpointer.y) / job->devscale.y;
- if (abs(dx) < EPSILON && abs(dy) < EPSILON) /* ignore motion events with no motion */
+ if (fabs(dx) < EPSILON && fabs(dy) < EPSILON) /* ignore motion events with no motion */
return;
switch (job->button) {
/* compute_bb(g); */
if (GD_drawing(g)->ratio_kind) {
- if ((abs(GD_bb(g).LL.x)) || (abs(GD_bb(g).LL.y))) {
+ if (GD_bb(g).LL.x || GD_bb(g).LL.y) {
translated = TRUE;
neato_translate (g);
}
j = graph[i].edges[e];
if (j < i)
continue;
- delta += abs(Dij[i * nG + j - shift] - graph[i].ewgts[e]);
+ delta += fabsf(Dij[i * nG + j - shift] - graph[i].ewgts[e]);
Dij[i * nG + j - shift] = graph[i].ewgts[e];
}
}
x = job->view.x / 2.0 * job->scale.x;
y = job->view.y / 2.0 * job->scale.y;
d = -500;
- px = atanf(x / abs(d)) * 180 / M_PI * 2;
- py = atanf(y / abs(d)) * 180 / M_PI * 2;
+ px = atanf(x / fabsf(d)) * 180 / M_PI * 2;
+ py = atanf(y / fabsf(d)) * 180 / M_PI * 2;
gvprintf(job, POV_CAMERA, x, y, d, x, y, 0.0,
(px > py ? px : py) * 1.2);
gvputs(job, POV_SKY_AND_GND);