1
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/xf86_Util.c,v 3.7 1999/01/14 13:05:05 dawes Exp $ */
3
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
5
* Permission to use, copy, modify, distribute, and sell this software and its
6
* documentation for any purpose is hereby granted without fee, provided that
7
* the above copyright notice appear in all copies and that both that
8
* copyright notice and this permission notice appear in supporting
9
* documentation, and that the name of David Wexelblat not be used in
10
* advertising or publicity pertaining to distribution of the software without
11
* specific, written prior permission. David Wexelblat makes no representations
12
* about the suitability of this software for any purpose. It is provided
13
* "as is" without express or implied warranty.
15
* DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17
* EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21
* PERFORMANCE OF THIS SOFTWARE.
24
/* $XConsortium: xf86_Util.c /main/5 1996/10/23 13:13:10 kaleb $ */
27
* This file is for utility functions that will be shared by other pieces
28
* of the system. Putting things here ensure that all the linking order
29
* dependencies are dealt with, as this library will be linked in last.
32
#ifdef HAVE_XORG_CONFIG_H
33
#include <xorg-config.h>
38
/* To prevent empty source file warnings */
42
/* For use only with gcc */
48
debug_alloca(char *file, int line, int size)
53
ErrorF("Alloc: %s line %d; ptr = 0x%x, length = %d\n", file, line,
59
debug_dealloca(char *file, int line, char *ptr)
61
ErrorF("Dealloc: %s line %d; ptr = 0x%x\n", file, line, ptr);
67
#if defined(ISC) || defined(Lynx)
71
/* Needed for apm_driver.c */
72
/* These functions are modeled after the functions inside gnu's libc */
75
copysign(double x, double y)
78
return y < 0 ? - x : x;
85
const double one = 1.0;
86
const static double L = 4503599627370496.0E0;
90
if (copysign(x,one) >= L)