1
/* $Xorg: jmemsys.c,v 1.4 2001/02/09 02:04:29 xorgcvs Exp $ */
4
/****************************************************************************
6
Copyright 1993, 1994, 1998 The Open Group
8
Permission to use, copy, modify, distribute, and sell this software and its
9
documentation for any purpose is hereby granted without fee, provided that
10
the above copyright notice appear in all copies and that both that
11
copyright notice and this permission notice appear in supporting
14
The above copyright notice and this permission notice shall be included in
15
all copies or substantial portions of the Software.
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
Except as contained in this notice, the name of The Open Group shall not be
25
used in advertising or otherwise to promote the sale, use or other dealings
26
in this Software without prior written authorization from The Open Group.
31
This software is being provided by AGE Logic, Inc. under the
32
following license. By obtaining, using and/or copying this software,
33
you agree that you have read, understood, and will comply with these
36
Permission to use, copy, modify, distribute and sell this
37
software and its documentation for any purpose and without
38
fee or royalty and to grant others any or all rights granted
39
herein is hereby granted, provided that you agree to comply
40
with the following copyright notice and statements, including
41
the disclaimer, and that the same appears on all copies and
42
derivative works of the software and documentation you make.
44
"Copyright 1993, 1994 by AGE Logic, Inc."
46
THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
47
REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
48
example, but not limitation, AGE LOGIC MAKE NO
49
REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
50
FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
51
INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
52
SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
53
EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
54
INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
55
OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
56
ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
57
BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
58
HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
61
The name of AGE Logic, Inc. may not be used in
62
advertising or publicity pertaining to this software without
63
specific, written prior permission from AGE Logic.
65
Title to this software shall at all times remain with AGE
67
*****************************************************************************
69
Gary Rogers, AGE Logic, Inc., October 1993
70
Gary Rogers, AGE Logic, Inc., January 1994
72
****************************************************************************/
73
/* $XFree86: xc/programs/Xserver/XIE/mixie/jpeg/jmemsys.c,v 3.4 2001/12/14 19:58:39 dawes Exp $ */
76
* jmemnobs.c (jmemsys.c)
78
* Copyright (C) 1992, Thomas G. Lane.
79
* This file is part of the Independent JPEG Group's software.
80
* For conditions of distribution and use, see the accompanying README file.
82
* This file provides a really simple implementation of the system-
83
* dependent portion of the JPEG memory manager. This implementation
84
* assumes that no backing-store files are needed: all required space
85
* can be obtained from malloc().
86
* This is very portable in the sense that it'll compile on almost anything,
87
* but you'd better have lots of main memory (or virtual memory) if you want
88
* to process big images.
89
* Note that the max_memory_to_use option is ignored by this implementation.
103
#define malloc(size) XieMalloc(size)
104
#define free(ptr) XieFree(ptr)
106
#ifdef INCLUDES_ARE_ANSI
107
#include <stdlib.h> /* to declare malloc(), free() */
109
extern pointer malloc PP((size_t size));
110
extern void free PP(pointer ptr));
112
#endif /* _XIEC_MEMORY */
115
#ifndef XIE_SUPPORTED
116
static external_methods_ptr methods; /* saved for access to error_exit */
117
#endif /* XIE_SUPPORTED */
120
* Memory allocation and freeing are controlled by the regular library
121
* routines malloc() and free().
126
#if NeedFunctionPrototypes
127
jget_small (size_t sizeofobject)
129
jget_small (sizeofobject)
131
#endif /* NeedFunctionPrototypes */
133
jget_small (size_t sizeofobject)
134
#endif /* XIE_SUPPORTED */
136
return (pointer) malloc(sizeofobject);
141
#if NeedFunctionPrototypes
142
jfree_small (pointer object)
146
#endif /* NeedFunctionPrototypes */
148
jfree_small (pointer object)
149
#endif /* XIE_SUPPORTED */
155
* We assume NEED_FAR_POINTERS is not defined and so the separate entry points
156
* jget_large, jfree_large are not needed.
161
* This routine computes the total memory space available for allocation.
162
* Here we always say, "we got all you want bud!"
165
#ifndef XIE_SUPPORTED
168
#if NeedFunctionPrototypes
169
jmem_available (long min_bytes_needed, long max_bytes_needed)
171
jmem_available (min_bytes_needed, max_bytes_needed)
172
long min_bytes_needed;
173
long max_bytes_needed;
174
#endif /* NeedFunctionPrototypes */
176
jmem_available (long min_bytes_needed, long max_bytes_needed)
177
#endif /* XIE_SUPPORTED */
179
return max_bytes_needed;
184
* Backing store (temporary file) management.
185
* This should never be called and we just error out.
190
#if NeedFunctionPrototypes
191
jopen_backing_store (backing_store_ptr info, long total_bytes_needed)
193
jopen_backing_store (info, total_bytes_needed)
194
backing_store_ptr info;
195
long total_bytes_needed;
196
#endif /* NeedFunctionPrototypes */
198
jopen_backing_store (backing_store_ptr info, long total_bytes_needed)
199
#endif /* XIE_SUPPORTED */
201
ERREXIT(methods, "Backing store not supported");
203
#endif /* XIE_SUPPORTED */
207
* These routines take care of any system-dependent initialization and
208
* cleanup required. Keep in mind that jmem_term may be called more than
212
#ifndef XIE_SUPPORTED
214
jmem_init (external_methods_ptr emethods)
216
methods = emethods; /* save struct addr for error exit access */
217
emethods->max_memory_to_use = 0;
219
#endif /* XIE_SUPPORTED */
223
#if NeedFunctionPrototypes
227
#endif /* NeedFunctionPrototypes */
230
#endif /* XIE_SUPPORTED */