Manual Page Result
0
Command: XpmMisc | Section: 3 | Source: OpenBSD | File: XpmMisc.3
XpmMisc(3) libXpm functions XpmMisc(3)
NAME
XpmMisc - xpm misc functions to free used memory and handle errors
SYNOPSIS
int XpmFreeXpmImage(XpmImage *image);
int XpmFreeXpmInfo(XpmInfo *info);
int XpmFreeAttributes(XpmAttributes *attributes);
int XpmAttributesSize(void);
int XpmFreeExtensions(XpmExtension *extensions, int nextensions);
int XpmFree(char *ptr);
char *XpmGetErrorString(int errorcode);
int XpmLibraryVersion(void);
ARGUMENTS
image Specifies the structure to free
info Specifies the structure to free
ptr Specifies the data to free
errorcode
Specifies the XPM error
extensions
Specifies the array to free
nextensions
Specifies the number of extensions
attributes
Specifies the structure to free
DESCRIPTION
To free possible data stored into an XpmImage structure use XpmFreeXp-
mImage(). The XpmFreeXpmImage() function frees the structure members
which are not NULL, but not the structure itself.
To free possible data stored into an XpmInfo structure use XpmFreeXp-
mInfo().
To free data possibly stored into an array of XpmExtension use XpmFree-
Extensions().
To free any data allocated by an XPM function use the XpmFree() func-
tion. The current distribution of the XPM library uses the standard
memory allocation functions and thus XpmFree() is nothing else than a
define to the standard free(3). However since these functions may be
redefined in specific environments it is wise to use XpmFree()
To free possible data stored into an XpmAttributes structure use Xpm-
FreeAttributes(). The XpmFreeAttributes() function frees the structure
members which have been malloced such as the pixels list.
To dynamically allocate an XpmAttributes structure use the XpmAttrib-
utesSize() function. The XpmAttributesSize() function provides appli-
cations using dynamic libraries with a safe way to allocate and then
refer to an XpmAttributes structure, disregarding whether the XpmAt-
tributes structure size has changed or not since compiled.
To get data when building an error message, one can use XpmGetEr-
rorString(). XpmGetErrorString() returns a string related to the given
XPM error code.
The XpmLibraryVersion() function can be used when one needs to figure
out which version of the library is in use. The value returned by Xpm-
LibraryVersion() can be compared to the value of XpmIncludeVersion
which is defined in the header file "xpm.h". These numbers are com-
puted with the following formula:
(XpmFormat * 100 + XpmVersion) * 100 + XpmRevision
where XpmFormat is the version number of the format, XpmVersion is the
library version number (which changes only if the API changes), and
XpmRevision is the library minor version number.
The XpmFreeExtensions() function frees all data stored in every exten-
sion and the array itself. Note that XpmFreeAttributes() calls this
function and thus most of the time it should not need to be explicitly
called.
SEE ALSO
XpmCreateBuffer(3), XpmCreateData(3), XpmCreateImage(3),
XpmCreatePixmap(3), XpmCreateXpmImage(3), XpmRead(3), XpmWrite(3)
X Version 11 libXpm 3.5.16 XpmMisc(3)