From e94d383b9ba7964da9fefac2a55e10c00ee72392 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 May 2008 12:54:33 -0600 Subject: [PATCH] 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 diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile index 5f3d65f72a8..eabfb414501 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 00000000000..ba7406158c4 --- /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 00000000000..10468636e87 --- /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 */ -- 2.30.2