rpmmg.h File Reference
RPMIO.
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Macros

#define | rpmmgUnlink(_ds) ((rpmmg)rpmioUnlinkPoolItem((rpmioItem)(_mg), __FUNCTION__, __FILE__, __LINE__))
#define | rpmmgLink(_mg) ((rpmmg)rpmioLinkPoolItem((rpmioItem)(_mg), __FUNCTION__, __FILE__, __LINE__))
#define | rpmmgFree(_mg) ((rpmmg)rpmioFreePoolItem((rpmioItem)(_mg), __FUNCTION__, __FILE__, __LINE__))

## Typedefs

typedef struct rpmmg_s * | rpmmg

## Functions

rpmmg | rpmmgUnlink (rpmmg mg)
| Unreference a magic wrapper instance. More...
rpmmg | rpmmgLink (rpmmg mg)
| Reference a magic wrapper instance. More...
rpmmg | rpmmgFree (rpmmg mg)
| Destroy a magic wrapper. More...
rpmmg | rpmmgNew (const char *fn, int flags)
| Create and load a magic wrapper. More...
const char * | rpmmgFile (rpmmg mg, const char *fn)
| Return magic string for a file. More...
const char * | rpmmgBuffer (rpmmg mg, const char *b, size_t nb)
| Return magic string for a buffer. More...

## Variables

int | _rpmmg_debug

## Macro Definition Documentation

#define rpmmgFree | ( |  | _mg | ) | ((rpmmg)rpmioFreePoolItem((rpmioItem)(_mg), __FUNCTION__, __FILE__, __LINE__))

Definition at line 68 of file rpmmg.h.

#define rpmmgLink | ( |  | _mg | ) | ((rpmmg)rpmioLinkPoolItem((rpmioItem)(_mg), __FUNCTION__, __FILE__, __LINE__))

Definition at line 56 of file rpmmg.h.

#define rpmmgUnlink | ( |  | _ds | ) | ((rpmmg)rpmioUnlinkPoolItem((rpmioItem)(_mg), __FUNCTION__, __FILE__, __LINE__))

Definition at line 45 of file rpmmg.h.

## Function Documentation

const char* rpmmgBuffer | ( | rpmmg | mg,
|  | const char * | b,
|  | size_t | nb
| ) |  |

Return magic string for a buffer.

Parameters

  mg | magic wrapper
  b | buffer
  nb | no. bytes in buffer

Returns
  buffer magic string

Definition at line 107 of file rpmmg.c.

References _, _rpmmg_debug, rpmlog(), RPMLOG_ERR, and xstrdup().

const char* rpmmgFile | ( | rpmmg | mg,
|  | const char * | fn
| ) |  |

Return magic string for a file.

Parameters

  mg | magic wrapper
  fn | file path

Returns
  file magic string

Definition at line 82 of file rpmmg.c.

References _, _rpmmg_debug, rpmlog(), RPMLOG_ERR, and xstrdup().

Referenced by doUntar(), and rpmfcClassify().

rpmmg rpmmgFree | ( | rpmmg | mg | ) |

Destroy a magic wrapper.

Parameters

  mg | magic wrapper

Returns
  NULL on last dereference

Referenced by doUntar(), rpmfcClassify(), and rpmmgNew().

rpmmg rpmmgLink | ( | rpmmg | mg | ) |

Reference a magic wrapper instance.

Parameters

  mg | magic wrapper

Returns
  new magic wrapper reference

Referenced by rpmmgNew().

rpmmg rpmmgNew | ( | const char * | fn,
|  | int | flags
| ) |  |

Create and load a magic wrapper.

Parameters

  fn | magic file
  flags | magic flags

Returns
  new magic wrapper

Definition at line 56 of file rpmmg.c.

References _, errno, rpmlog(), RPMLOG_ERR, rpmmgFree(), rpmmgGetPool(), rpmmgLink(), and xstrdup().

Referenced by doUntar(), and rpmfcClassify().

rpmmg rpmmgUnlink | ( | rpmmg | mg | ) |

Unreference a magic wrapper instance.

Parameters

  mg | magic wrapper

Returns
  NULL on last dereference