2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: jmemnobs.c /main/2 1996/05/09 03:52:28 drk $ */
27 * Copyright (C) 1992-1996, Thomas G. Lane.
28 * This file is part of the Independent JPEG Group's software.
29 * For conditions of distribution and use, see the accompanying README file.
31 * This file provides a really simple implementation of the system-
32 * dependent portion of the JPEG memory manager. This implementation
33 * assumes that no backing-store files are needed: all required space
34 * can be obtained from malloc().
35 * This is very portable in the sense that it'll compile on almost anything,
36 * but you'd better have lots of main memory (or virtual memory) if you want
37 * to process big images.
38 * Note that the max_memory_to_use option is ignored by this implementation.
41 #define JPEG_INTERNALS
44 #include "jmemsys.h" /* import the system-dependent declarations */
46 #ifndef HAVE_STDLIB_H /* <stdlib.h> should declare malloc(),free() */
47 extern void * malloc JPP((size_t size));
48 extern void free JPP((void *ptr));
53 * Memory allocation and freeing are controlled by the regular library
54 * routines malloc() and free().
58 jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject)
60 return (void *) malloc(sizeofobject);
64 jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject)
71 * "Large" objects are treated the same as "small" ones.
72 * NB: although we include FAR keywords in the routine declarations,
73 * this file won't actually work in 80x86 small/medium model; at least,
74 * you probably won't be able to process useful-size images in only 64KB.
78 jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject)
80 return (void FAR *) malloc(sizeofobject);
84 jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject)
91 * This routine computes the total memory space available for allocation.
92 * Here we always say, "we got all you want bud!"
96 jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
97 long max_bytes_needed, long already_allocated)
99 return max_bytes_needed;
104 * Backing store (temporary file) management.
105 * Since jpeg_mem_available always promised the moon,
106 * this should never be called and we can just error out.
110 jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,
111 long total_bytes_needed)
113 ERREXIT(cinfo, JERR_NO_BACKING_STORE);
118 * These routines take care of any system-dependent initialization and
119 * cleanup required. Here, there isn't any.
123 jpeg_mem_init (j_common_ptr cinfo)
125 return 0; /* just set max_memory_to_use to 0 */
129 jpeg_mem_term (j_common_ptr cinfo)