From e94d383b9ba7964da9fefac2a55e10c00ee72392 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 May 2008 12:54:33 -0600 Subject: egl: added eglstring.[ch] --- src/egl/main/Makefile | 6 ++++-- src/egl/main/eglstring.c | 24 ++++++++++++++++++++++++ src/egl/main/eglstring.h | 9 +++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 src/egl/main/eglstring.c create mode 100644 src/egl/main/eglstring.h (limited to 'src/egl') diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile index 5f3d65f72a..eabfb41450 100644 --- a/src/egl/main/Makefile +++ b/src/egl/main/Makefile @@ -17,8 +17,9 @@ HEADERS = \ eglhash.h \ eglmode.h \ eglscreen.h \ + eglstring.h \ eglsurface.h \ -# eglx.h + eglx.h SOURCES = \ eglapi.c \ @@ -32,8 +33,9 @@ SOURCES = \ eglhash.c \ eglmode.c \ eglscreen.c \ + eglstring.c \ eglsurface.c \ -# eglx.c + eglx.c OBJECTS = $(SOURCES:.c=.o) diff --git a/src/egl/main/eglstring.c b/src/egl/main/eglstring.c new file mode 100644 index 0000000000..ba7406158c --- /dev/null +++ b/src/egl/main/eglstring.c @@ -0,0 +1,24 @@ +/** + * String utils. + */ + +#include +#include +#include "eglstring.h" + + +char * +_eglstrdup(const char *s) +{ + if (s) { + int l = strlen(s); + char *s2 = malloc(l + 1); + if (s2) + strcpy(s2, s); + return s2; + } + return NULL; +} + + + diff --git a/src/egl/main/eglstring.h b/src/egl/main/eglstring.h new file mode 100644 index 0000000000..10468636e8 --- /dev/null +++ b/src/egl/main/eglstring.h @@ -0,0 +1,9 @@ +#ifndef EGLSTRING_INCLUDED +#define EGLSTRING_INCLUDED + + +extern char * +_eglstrdup(const char *s); + + +#endif /* EGLSTRING_INCLUDED */ -- cgit v1.2.3