egl: added eglstring.[ch]

This commit is contained in:
Brian Paul
2008-05-28 12:54:33 -06:00
parent 17ec3b3cc5
commit e94d383b9b
3 changed files with 37 additions and 2 deletions

View 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)

24
src/egl/main/eglstring.c Normal file
View File

@@ -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;
}

9
src/egl/main/eglstring.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef EGLSTRING_INCLUDED
#define EGLSTRING_INCLUDED
extern char *
_eglstrdup(const char *s);
#endif /* EGLSTRING_INCLUDED */