OSDN Git Service

egl: added eglstring.[ch]
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 28 May 2008 18:54:33 +0000 (12:54 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 28 May 2008 18:54:33 +0000 (12:54 -0600)
src/egl/main/Makefile
src/egl/main/eglstring.c [new file with mode: 0644]
src/egl/main/eglstring.h [new file with mode: 0644]

index 5f3d65f..eabfb41 100644 (file)
@@ -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 (file)
index 0000000..ba74061
--- /dev/null
@@ -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 (file)
index 0000000..1046863
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef EGLSTRING_INCLUDED
+#define EGLSTRING_INCLUDED
+
+
+extern char *
+_eglstrdup(const char *s);
+
+
+#endif /* EGLSTRING_INCLUDED */