summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/egl/main/Makefile6
-rw-r--r--src/egl/main/eglstring.c24
-rw-r--r--src/egl/main/eglstring.h9
3 files changed, 37 insertions, 2 deletions
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 <stdlib.h>
+#include <string.h>
+#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 */