You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
750 B
31 lines
750 B
6 years ago
|
/* Simple extendable string.
|
||
|
* I think this doesn't leak?
|
||
|
*/
|
||
|
#ifndef _EXSTRING_H
|
||
|
#define _EXSTRING_H
|
||
|
#include <stddef.h>
|
||
|
|
||
|
typedef struct {
|
||
|
size_t currentSize;
|
||
|
|
||
|
char cstr[];
|
||
|
} exStringOpt;
|
||
|
|
||
|
typedef char* exString;
|
||
|
|
||
|
#define EXS(s) (* (char**)(s))
|
||
|
|
||
|
exString* exs_new(const char* from);
|
||
|
exString* exs_clone(exString* from);
|
||
|
void exs_free(exString* str);
|
||
|
void exs_nappend(exString* str, const char* from, size_t length);
|
||
|
void exs_append(exString* str, const char* from);
|
||
|
void exs_appendf(exString* str, const char* fmt, ...);
|
||
|
size_t exs_realsize(exString* str);
|
||
|
void exs_reduce(exString* str, size_t by);
|
||
|
void exs_appendtimes(exString* str, char c, int times);
|
||
|
void exs_recalc(exString* str);
|
||
|
void exs_reset(exString * str);
|
||
|
|
||
|
#endif /* _EXSTRING_H */
|