Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
memory.c util.h
Log Message:
Change some macros to functions to avoid multiple argument evaluation.
===================================================================
RCS file: /cvs/e/e16/e/src/memory.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -3 -r1.50 -r1.51
--- memory.c 21 Apr 2006 15:51:46 -0000 1.50
+++ memory.c 13 May 2006 10:28:11 -0000 1.51
@@ -42,11 +42,14 @@
return s;
}
-#if !USE_LIBC_STRDUP
char *
Estrdup(const char *s)
{
- char *ss;
+#if USE_LIBC_STRDUP
+ if (s)
+ return strdup(s);
+ return NULL;
+#else
int sz;
if (!s)
@@ -55,13 +58,17 @@
ss = Emalloc(sz + 1);
strncpy(ss, s, sz + 1);
return ss;
-}
#endif
+}
-#if !USE_LIBC_STRNDUP
char *
Estrndup(const char *s, int n)
{
+#if USE_LIBC_STRNDUP
+ if (s)
+ return strndup(s, n);
+ return NULL;
+#else
char *ss;
if (!s)
@@ -70,8 +77,8 @@
strncpy(ss, s, n);
ss[n] = '\0';
return ss;
-}
#endif
+}
char *
Estrdupcat2(char *ss, const char *s1, const char *s2)
===================================================================
RCS file: /cvs/e/e16/e/src/util.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- util.h 21 Apr 2006 15:51:46 -0000 1.2
+++ util.h 13 May 2006 10:28:11 -0000 1.3
@@ -52,18 +52,8 @@
char *Estrtrim(char *s);
-#if USE_LIBC_STRDUP
-#define Estrdup(s) ((s) ? strdup(s) : NULL)
-#else
char *Estrdup(const char *s);
-#endif
-
-#if USE_LIBC_STRNDUP
-#define Estrndup(s,n) ((s) ? strndup(s,n) : NULL)
-#else
char *Estrndup(const char *s, int n);
-#endif
-
char *Estrdupcat2(char *ss, const char *s1, const char *s2);
char **StrlistDup(char **lst, int num);
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs