mirror of
https://github.com/dborth/fceugx.git
synced 2024-12-27 09:01:56 +01:00
28 lines
413 B
C
28 lines
413 B
C
#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);
|
|
strcpy((char *)ret->data,str);
|
|
|
|
ret->len=strlen(str);
|
|
|
|
return(ret);
|
|
}
|
|
|
|
void fceustr_destroy(fceustr *str)
|
|
{
|
|
if(str->data) free(str->data);
|
|
free(str);
|
|
}
|