rpm  4.16.1.2
Macros | Typedefs | Functions
rpmutil.h File Reference

Miscellaneous utility macros: More...

#include <unistd.h>
Include dependency graph for rpmutil.h:

Go to the source code of this file.

Macros

#define RPM_GNUC_EXTENSION
 
#define RPM_GNUC_PURE
 
#define RPM_GNUC_MALLOC
 
#define RPM_GNUC_ALLOC_SIZE(x)
 
#define RPM_GNUC_ALLOC_SIZE2(x, y)
 
#define RPM_GNUC_NULL_TERMINATED
 
#define RPM_GNUC_PRINTF(format_idx, arg_idx)
 
#define RPM_GNUC_SCANF(format_idx, arg_idx)
 
#define RPM_GNUC_FORMAT(arg_idx)
 
#define RPM_GNUC_NORETURN
 
#define RPM_GNUC_CONST
 
#define RPM_GNUC_UNUSED
 
#define RPM_GNUC_NO_INSTRUMENT
 
#define RPM_GNUC_DEPRECATED
 
#define RPM_GNUC_MAY_ALIAS
 
#define RPM_GNUC_NONNULL(...)
 
#define RPM_GNUC_WARN_UNUSED_RESULT
 
#define RPM_GNUC_INTERNAL
 
#define RPM_BEGIN_DECLS
 
#define RPM_END_DECLS
 

Typedefs

typedef void *(* rpmMemFailFunc) (size_t size, void *data)
 Memory allocation failure callback prototype. More...
 

Functions

void * rmalloc (size_t size)
 
void * rcalloc (size_t nmemb, size_t size)
 
void * rrealloc (void *ptr, size_t size)
 
char * rstrdup (const char *str)
 
void * rfree (void *ptr)
 
rpmMemFailFunc rpmSetMemFail (rpmMemFailFunc func, void *data)
 Set memory allocation failure callback. More...
 

Detailed Description

Miscellaneous utility macros:

Copied from glib, names replaced to avoid clashing with glib.

Definition in file rpmutil.h.

Macro Definition Documentation

◆ RPM_BEGIN_DECLS

#define RPM_BEGIN_DECLS

Definition at line 112 of file rpmutil.h.

◆ RPM_END_DECLS

#define RPM_END_DECLS

Definition at line 113 of file rpmutil.h.

◆ RPM_GNUC_ALLOC_SIZE

#define RPM_GNUC_ALLOC_SIZE (   x)

Definition at line 42 of file rpmutil.h.

◆ RPM_GNUC_ALLOC_SIZE2

#define RPM_GNUC_ALLOC_SIZE2 (   x,
 
)

Definition at line 43 of file rpmutil.h.

◆ RPM_GNUC_CONST

#define RPM_GNUC_CONST

Definition at line 72 of file rpmutil.h.

◆ RPM_GNUC_DEPRECATED

#define RPM_GNUC_DEPRECATED

Definition at line 81 of file rpmutil.h.

◆ RPM_GNUC_EXTENSION

#define RPM_GNUC_EXTENSION

Definition at line 23 of file rpmutil.h.

◆ RPM_GNUC_FORMAT

#define RPM_GNUC_FORMAT (   arg_idx)

Definition at line 70 of file rpmutil.h.

◆ RPM_GNUC_INTERNAL

#define RPM_GNUC_INTERNAL

Definition at line 103 of file rpmutil.h.

◆ RPM_GNUC_MALLOC

#define RPM_GNUC_MALLOC

Definition at line 35 of file rpmutil.h.

◆ RPM_GNUC_MAY_ALIAS

#define RPM_GNUC_MAY_ALIAS

Definition at line 89 of file rpmutil.h.

◆ RPM_GNUC_NO_INSTRUMENT

#define RPM_GNUC_NO_INSTRUMENT

Definition at line 74 of file rpmutil.h.

◆ RPM_GNUC_NONNULL

#define RPM_GNUC_NONNULL (   ...)

Definition at line 90 of file rpmutil.h.

◆ RPM_GNUC_NORETURN

#define RPM_GNUC_NORETURN

Definition at line 71 of file rpmutil.h.

◆ RPM_GNUC_NULL_TERMINATED

#define RPM_GNUC_NULL_TERMINATED

Definition at line 49 of file rpmutil.h.

◆ RPM_GNUC_PRINTF

#define RPM_GNUC_PRINTF (   format_idx,
  arg_idx 
)

Definition at line 68 of file rpmutil.h.

◆ RPM_GNUC_PURE

#define RPM_GNUC_PURE

Definition at line 34 of file rpmutil.h.

◆ RPM_GNUC_SCANF

#define RPM_GNUC_SCANF (   format_idx,
  arg_idx 
)

Definition at line 69 of file rpmutil.h.

◆ RPM_GNUC_UNUSED

#define RPM_GNUC_UNUSED

Definition at line 73 of file rpmutil.h.

◆ RPM_GNUC_WARN_UNUSED_RESULT

#define RPM_GNUC_WARN_UNUSED_RESULT

Definition at line 97 of file rpmutil.h.

Typedef Documentation

◆ rpmMemFailFunc

typedef void*(* rpmMemFailFunc) (size_t size, void *data)

Memory allocation failure callback prototype.

When registered through rpmSetMemFail(), this gets called if memory allocation through rmalloc() and friends fails. If the application can somehow recover memory here, it can return a newly allocated memory block of requested size, otherwise it must return NULL after performing it's own shutdown deeds or terminate itself.

Parameters
sizeSize of allocation request in bytes
dataUser data (or NULL)
Returns
Allocated memory block of requested size or NULL

Definition at line 146 of file rpmutil.h.

Function Documentation

◆ rcalloc()

void* rcalloc ( size_t  nmemb,
size_t  size 
)

◆ rfree()

void* rfree ( void *  ptr)

◆ rmalloc()

void* rmalloc ( size_t  size)

◆ rpmSetMemFail()

rpmMemFailFunc rpmSetMemFail ( rpmMemFailFunc  func,
void *  data 
)

Set memory allocation failure callback.

Parameters
funcAllocation failure callback function
dataUser data (or NULL)
Returns
Previous callback function

◆ rrealloc()

void* rrealloc ( void *  ptr,
size_t  size 
)

◆ rstrdup()

char* rstrdup ( const char *  str)