Debian Codegraph @

texk/xdvipsk/thirdparty/libtiff/doc/functions/TIFFmemory.rst

raw
1 TIFFmemory
2 ==========
3
4 Synopsis
5 --------
6
7 .. highlight:: c
8
9 ::
10
11 #include <tiffio.h>
12
13 .. c:function:: tdata_t _TIFFmalloc(tsize_t size)
14
15 .. c:function:: tdata_t _TIFFrealloc(tdata_t buffer, tsize_t size)
16
17 .. c:function:: void _TIFFfree(tdata_t buffer)
18
19 .. c:function:: void _TIFFmemset(tdata_t s, int c, tsize_t n)
20
21 .. c:function:: void _TIFFmemcpy(tdata_t dest, const tdata_t src, tsize_t n)
22
23 .. c:function:: int _TIFFmemcmp(const tdata_t s1, const tdata_ts2, tsize_t n)
24
25 .. c:function:: void* _TIFFCheckMalloc(TIFF* tif, tmsize_t nmemb, tmsize_t elem_size, const char* what)
26
27 .. c:function:: void* _TIFFCheckRealloc(TIFF* tif, void* buffer, tmsize_t nmemb, tmsize_t elem_size, const char* what)
28
29 Description
30 -----------
31
32 These routines are provided for writing portable software that uses
33 :program:`libtiff`; they hide any memory-management related issues, such as
34 dealing with segmented architectures found on 16-bit machines.
35
36 :c:func:`_TIFFmalloc` and :c:func:`_TIFFrealloc` are used to dynamically
37 allocate and reallocate memory used by :program:`libtiff`; such as memory
38 passed into the I/O routines. Memory allocated through these interfaces is
39 released back to the system using the :c:func:`_TIFFfree` routine.
40
41 Memory allocated through one of the above interfaces can be set to a known
42 value using :c:func:`_TIFFmemset`, copied to another memory location using
43 :c:func:`_TIFFmemcpy`, or compared for equality using :c:func:`_TIFFmemcmp`.
44 These routines conform to the equivalent C routines:
45 :c:func:`memset`, :c:func:`memcpy`, :c:func:`memcmp`, respectively.
46
47 :c:func:`_TIFFCheckMalloc` and :c:func:`_TIFFCheckRealloc` are checking for
48 integer overflow before calling :c:func:`_TIFFmalloc` and :c:func:`_TIFFrealloc`,
49 respectively.
50
51 Diagnostics
52 -----------
53
54 None.
55
56 See also
57 --------
58
59 malloc (3),
60 memory (3),
61 :doc:`libtiff` (3tiff)