blob: c77c9b754787797a5b2ede624c57ce8d52906a53 [file] [log] [blame]
/******************************************************************************
*(C) Copyright 2008 Marvell International Ltd.
* All Rights Reserved
******************************************************************************/
#ifndef MSTRING_H_
#define MSTRING_H_
#include <stdarg.h>
#include <stddef.h>
#ifdef __GNUC__
#define _GNU_SOURCE
#else
int asprintf(char **ret, const char *format, ...);
int vasprintf(char **ret, const char *format, va_list args);
char *strndup(const char *s, size_t n);
#endif
#ifdef _MSC_VER
#define snprintf _snprintf
#if _MSC_VER < 1800
#define va_copy(d, s) do { (d) = (s); } while (0)
#endif
#endif
typedef struct
{
int size;
int len;
char* str;
}MString;
MString* MStringCreate(void);
void MStringDestroy(void* s);
int MStringAppend(MString* src, char* append, int newline);
int MStringAppendChar(MString* src, char append);
int MStringPrintf (MString *str, const char *format, ...);
#endif /* MSTRING_H_ */