ixmlmembuf.c File Reference
`#include "ixmlmembuf.h"`
`#include "ixml.h"`
`#include <assert.h>`
`#include <stdlib.h>`
`#include <string.h>`
Include dependency graph for ixmlmembuf.c:

## Functions

static int | ixml_membuf_set_size (INOUT ixml_membuf *m, IN size_t new_length)
| Increases or decreases buffer capacity so that at least 'new_length' bytes can be stored. More...
void | ixml_membuf_init (ixml_membuf *m)
| ixml_membuf initialization routine. More...
void | ixml_membuf_destroy (ixml_membuf *m)
| ixml_membuf clearing routine. More...
int | ixml_membuf_assign (ixml_membuf *m, const void *buf, size_t buf_len)
| Copies the contents o a buffer to the designated ixml_membuf. More...
int | ixml_membuf_assign_str (ixml_membuf *m, const char *c_str)
| Copies a NULL terminated string to the ixml_buffer. More...
int | ixml_membuf_append (INOUT ixml_membuf *m, IN const void *buf)
int | ixml_membuf_append_str (INOUT ixml_membuf *m, IN const char *c_str)
int | ixml_membuf_insert (INOUT ixml_membuf *m, IN const void *buf, IN size_t buf_len, int index)

## Function Documentation

int ixml_membuf_assign | ( | ixml_membuf * | m,
|  | const void * | buf,
|  | size_t | buf_len
| ) |  |

Copies the contents o a buffer to the designated ixml_membuf.

The previous contents of the ixml_membuf are destroyed.

Returns
  IXML_SUCCESS if successfull, or the error code returned by ixml_membuf_set_size().

See Also
  ixml_membuf_assign_str().

Parameters

  [in,out] | m | The memory buffer on which to operate.
  [in] | buf | The input buffer to copy from.
  [in] | buf_len | The number of bytes to copy from the input buffer.

References ixml_membuf_destroy(), and ixml_membuf_set_size().

Referenced by ixml_membuf_assign_str().

int ixml_membuf_assign_str | ( | ixml_membuf * | m,
|  | const char * | c_str
| ) |  |

Copies a NULL terminated string to the ixml_buffer.

This is a convenience function that internally uses ixml_membuf_assign().

Returns
  The return value of ixml_membuf_assign().

See Also
  ixml_membuf_assign().

Parameters

  [in,out] | m | The memory buffer on which to operate.
  [in] | c_str | The input string to copy from.

References ixml_membuf_assign().

Referenced by Parser_setLastElem().

void ixml_membuf_destroy | ( | ixml_membuf * | m | ) |

ixml_membuf clearing routine.

The internal buffer is deleted and ixml_membuf_init() is called in the end to reinitialize the buffer.

Parameters

  [in,out] | m | The memory buffer to clear.

References ixml_membuf_init().

Referenced by ixml_membuf_assign(), Parser_clearTokenBuf(), and Parser_free().

void ixml_membuf_init | ( | ixml_membuf * | m | ) |

ixml_membuf initialization routine.

Parameters

  [in,out] | m | The memory buffer to initializa.

Referenced by ixml_membuf_destroy(), ixmlDocumenttoString(), ixmlNodetoString(), ixmlPrintDocument(), ixmlPrintNode(), and Parser_init().

static int ixml_membuf_set_size | ( | INOUT ixml_membuf * | m,
|  | IN size_t | new_length
| ) |  |

static

Increases or decreases buffer capacity so that at least 'new_length' bytes can be stored.

On error, m's fields do not change.

Returns
  - UPNP_E_SUCCESS
  - UPNP_E_OUTOF_MEMORY

Parameters

  [in,out] | m | The memory buffer.
  [in] | new_length | The new lenght.

Referenced by ixml_membuf_assign().