fceugx/source/fceultra/fceustr.c

28 lines
413 B
C
Raw Normal View History

2008-04-03 05:58:35 +02:00
#include <string.h>
#include <stdlib.h>
#include "types.h"
#include "fceustr.h"
/* Creates a fceustr from a C-style string. */
fceustr *fceustr_create(const char *str)
{
fceustr *ret;
ret=malloc(sizeof(fceustr));
ret->data=malloc(strlen(str)+1);
2009-01-26 10:34:07 +01:00
strcpy((char *)ret->data,str);
2008-04-03 05:58:35 +02:00
ret->len=strlen(str);
return(ret);
}
void fceustr_destroy(fceustr *str)
{
if(str->data) free(str->data);
free(str);
}