egl: added eglstring.[ch]
This commit is contained in:
@@ -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
24
src/egl/main/eglstring.c
Normal 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
9
src/egl/main/eglstring.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef EGLSTRING_INCLUDED
|
||||
#define EGLSTRING_INCLUDED
|
||||
|
||||
|
||||
extern char *
|
||||
_eglstrdup(const char *s);
|
||||
|
||||
|
||||
#endif /* EGLSTRING_INCLUDED */
|
Reference in New Issue
Block a user