Blender V2.61 - r43446
Classes | Defines | Typedefs | Functions

BLI_dynstr.c File Reference

#include <stdarg.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"

Go to the source code of this file.

Classes

struct  DynStrElem
struct  DynStr

Defines

#define va_copy(a, b)   ((a)=(b))

Typedefs

typedef struct DynStrElem DynStrElem

Functions

DynStrBLI_dynstr_new (void)
void BLI_dynstr_append (DynStr *ds, const char *cstr)
void BLI_dynstr_nappend (DynStr *ds, const char *cstr, int len)
void BLI_dynstr_vappendf (DynStr *ds, const char *format, va_list args)
void BLI_dynstr_appendf (DynStr *ds, const char *format,...)
int BLI_dynstr_get_len (DynStr *ds)
void BLI_dynstr_get_cstring_ex (DynStr *ds, char *rets)
char * BLI_dynstr_get_cstring (DynStr *ds)
void BLI_dynstr_free (DynStr *ds)

Detailed Description

Definition in file BLI_dynstr.c.


Define Documentation

#define va_copy (   a,
 
)    ((a)=(b))

Definition at line 51 of file BLI_dynstr.c.

Referenced by BLI_dynstr_vappendf().


Typedef Documentation

typedef struct DynStrElem DynStrElem

Definition at line 57 of file BLI_dynstr.c.


Function Documentation

void BLI_dynstr_append ( DynStr ds,
const char *  cstr 
)
void BLI_dynstr_appendf ( DynStr ds,
const char *  format,
  ... 
)
void BLI_dynstr_free ( DynStr ds)
char* BLI_dynstr_get_cstring ( DynStr ds)
void BLI_dynstr_get_cstring_ex ( DynStr ds,
char *  str 
)

Get a DynStr's contents as a c-string. The str argument must be allocated to be at least the size of BLI_dynstr_get_len(ds) + 1.

Parameters:
dsThe DynStr of interest.
strThe string to fill.
Returns:
The contents of ds as a c-string.

Definition at line 229 of file BLI_dynstr.c.

References DynStr::curlen, DynStr::elems, DynStrElem::next, DynStrElem::str, and strlen().

Referenced by BLI_dynstr_get_cstring(), and mathutils_dynstr_to_py().

int BLI_dynstr_get_len ( DynStr ds)

Find the length of a DynStr.

Parameters:
dsThe DynStr of interest.
Returns:
The length of ds.

Definition at line 224 of file BLI_dynstr.c.

References DynStr::curlen.

Referenced by BKE_reportf(), BKE_reports_prepend(), BKE_reports_prependf(), BKE_reports_string(), console_copy_exec(), IDnames_to_pupstring(), IMAnames_to_pupstring(), and mathutils_dynstr_to_py().

void BLI_dynstr_nappend ( DynStr ds,
const char *  cstr,
int  len 
)

Append a length clamped c-string to a DynStr.

Parameters:
dsThe DynStr to append to.
cstrThe c-string to append.
lenThe maximum length of the c-string to copy.

Definition at line 97 of file BLI_dynstr.c.

References BLI_strnlen(), DynStr::curlen, DynStr::elems, DynStr::last, DynStrElem::next, NULL, and DynStrElem::str.

Referenced by console_copy_exec().

DynStr* BLI_dynstr_new ( void  )
void BLI_dynstr_vappendf ( DynStr ds,
const char *  format,
va_list  args 
)

Definition at line 115 of file BLI_dynstr.c.

References BLI_dynstr_append(), len(), MEM_callocN(), MEM_freeN(), NULL, and va_copy.

Referenced by BKE_reportf(), BKE_reports_prependf(), and BLI_sprintfN().