/* default growth - this helps reducing the number of realloc() calls */
#define PATHGROW_GROW 256

typedef struct pathgrow_s {
	char *path;
	int alloced, used;
	char separator;
} pathgrow_t;

/* allocate an empty pathgrow */
pathgrow_t *pathgrow_alloc(char sep);

/* free all memory of a pathgrow, including p */
void pathgrow_free(pathgrow_t *p);

/* append a separator and a path item to the pathgrow */
void pathgrow_append(pathgrow_t *p, const char *item);

/* truncate last path item and a separator from the end of a pathgrow
   NOTE: does not shrink allocation! */
void pathgrow_truncate(pathgrow_t *p);
