1XtMalloc(3x)                     XT FUNCTIONS                     XtMalloc(3x)
2
3
4

NAME

6       XtMalloc, XtCalloc, XtRealloc, XtFree, XtNew, XtNewString - memory man‐
7       agement functions
8

SYNTAX

10       char *XtMalloc(Cardinal size);
11
12       char *XtCalloc(Cardinal num, Cardinal size);
13
14       char *XtRealloc(char *ptr, Cardinal num);
15
16       void XtFree(char *ptr);
17
18       type *XtNew(type);
19
20       String XtNewString(String string);
21

ARGUMENTS

23       num       Specifies the number of bytes or array elements.
24
25       ptr       Specifies a pointer to the old storage or to the block of
26                 storage that is to be freed.
27
28       size      Specifies the size of an array element (in bytes) or the num‐
29                 ber of bytes desired.
30
31       string    Specifies a previously declared string.
32
33       type      Specifies a previously declared data type.
34

DESCRIPTION

36       The XtMalloc functions returns a pointer to a block of storage of at
37       least the specified size bytes.  If there is insufficient memory to
38       allocate the new block, XtMalloc calls XtErrorMsg.
39
40       The XtCalloc function allocates space for the specified number of array
41       elements of the specified size and initializes the space to zero.  If
42       there is insufficient memory to allocate the new block, XtCalloc calls
43       XtErrorMsg.
44
45       The XtRealloc function changes the size of a block of storage (possibly
46       moving it).  Then, it copies the old contents (or as much as will fit)
47       into the new block and frees the old block.  If there is insufficient
48       memory to allocate the new block, XtRealloc calls XtErrorMsg.  If ptr
49       is NULL, XtRealloc allocates the new storage without copying the old
50       contents; that is, it simply calls XtMalloc.
51
52       The XtFree function returns storage and allows it to be reused.  If ptr
53       is NULL, XtFree returns immediately.
54
55       XtNew returns a pointer to the allocated storage.  If there is insuffi‐
56       cient memory to allocate the new block, XtNew calls XtErrorMsg.  XtNew
57       is a convenience macro that calls XtMalloc with the following arguments
58       specified:
59
60       ((type *) XtMalloc((unsigned) sizeof(type))
61
62       XtNewString returns a pointer to the allocated storage.  If there is
63       insufficient memory to allocate the new block, XtNewString calls XtEr‐
64       rorMsg.  XtNewString is a convenience macro that calls XtMalloc with
65       the following arguments specified:
66
67       (strcpy(XtMalloc((unsigned) strlen(str) + 1), str))
68

SEE ALSO

70       X Toolkit Intrinsics - C Language Interface
71       Xlib - C Language X Interface
72
73
74
75X Version 11                      libXt 1.0.4                     XtMalloc(3x)
Impressum