Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h memory.c misc.c 


Log Message:
Use libc setenv when available.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.227
retrieving revision 1.228
diff -u -3 -r1.227 -r1.228
--- E.h 20 Mar 2004 15:20:40 -0000      1.227
+++ E.h 20 Mar 2004 15:28:04 -0000      1.228
@@ -26,8 +26,15 @@
 #define _GNU_SOURCE
 #include "config.h"
 
-#define USE_STRDUP  1          /* Use libc strdup if present */
-#define USE_STRNDUP 1          /* Use libc strndup if present */
+#if HAVE_STRDUP
+#define USE_LIBC_STRDUP  1     /* Use libc strdup if present */
+#endif
+#if HAVE_STRNDUP
+#define USE_LIBC_STRNDUP 1     /* Use libc strndup if present */
+#endif
+#if HAVE_SETENV
+#define USE_LIBC_SETENV  1     /* Use libc setenv  if present */
+#endif
 #define DEBUG_EWMH  0
 
 #include <X11/Xlib.h>
@@ -274,13 +281,6 @@
 #endif
 #endif /* HAVE_SNPRINTF */
 
-#define Esetenv(var, val, overwrite) \
-{ \
-  static char envvar[FILEPATH_LEN_MAX]; \
-  Esnprintf(envvar, FILEPATH_LEN_MAX, "%s=%s", var, val);\
-  putenv(envvar);\
-}
-
 /* This is a start to providing internationalization by means */
 /* of gettext */
 
@@ -2348,6 +2348,11 @@
 void                EdgeHandleMotion(XEvent * ev);
 void                Quicksort(void **a, int l, int r,
                              int (*CompareFunc) (void *d1, void *d2));
+#if USE_LIBC_SETENV
+#define Esetenv setenv
+#else
+int                 Esetenv(const char *name, const char *value, int overwrite);
+#endif
 
 /* moveresize.c */
 int                 ActionMoveStart(EWin * ewin, void *params, char constrained,
@@ -2711,12 +2716,12 @@
 __Erealloc(x, y, "<unknown>", 0)
 #endif
 
-#if defined(USE_STRDUP) && defined(HAVE_STRDUP)
+#if USE_LIBC_STRDUP
 #define Estrdup(s) ((s) ? strdup(s) : NULL)
 #else
 char               *Estrdup(const char *s);
 #endif
-#if defined(USE_STRNDUP) && defined(HAVE_STRNDUP)
+#if USE_LIBC_STRNDUP
 #define Estrndup(s,n) ((s) ? strndup(s,n) : NULL)
 #else
 char               *Estrndup(const char *s, int n);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/memory.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- memory.c    11 Mar 2004 16:58:14 -0000      1.34
+++ memory.c    20 Mar 2004 15:28:04 -0000      1.35
@@ -391,7 +391,7 @@
 }
 #endif
 
-#if !(defined(USE_STRDUP) && defined(HAVE_STRDUP))
+#if !USE_LIBC_STRDUP
 char               *
 Estrdup(const char *s)
 {
@@ -408,7 +408,7 @@
 }
 #endif
 
-#if !(defined(USE_STRDUP) && defined(HAVE_STRNDUP))
+#if !USE_LIBC_STRNDUP
 char               *
 Estrndup(const char *s, int n)
 {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/misc.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -3 -r1.48 -r1.49
--- misc.c      18 Mar 2004 17:03:49 -0000      1.48
+++ misc.c      20 Mar 2004 15:28:04 -0000      1.49
@@ -437,3 +437,14 @@
        Quicksort(a, i + 1, r, CompareFunc);
      }
 }
+
+#if !USE_LIBC_SETENV
+int
+Esetenv(const char *name, const char *value, int overwrite __UNUSED__)
+{
+   char                envvar[FILEPATH_LEN_MAX];
+
+   Esnprintf(envvar, FILEPATH_LEN_MAX, "%s=%s", name, value);
+   return putenv(Estrdup(envvar));
+}
+#endif




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to