Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/eesh


Modified Files:
        E.h alert.c comms.c file.c lists.c main.c memory.c 


Log Message:
Renamed duplicate to Estrdup, introduced Estrndup.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/eesh/E.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- E.h 13 Feb 2004 18:13:55 -0000      1.13
+++ E.h 28 Feb 2004 15:13:57 -0000      1.14
@@ -48,6 +48,8 @@
 #include <sys/ipc.h>
 #include <sys/shm.h>
 
+#define USE_STRDUP  1
+
 #define LIST_FINDBY_NAME        0
 #define LIST_FINDBY_ID          1
 #define LIST_FINDBY_BOTH        2
@@ -145,10 +147,15 @@
 __Erealloc(x, y)
 #endif
 
+#if defined(USE_STRDUP) && defined(HAVE_STRDUP)
+#define Estrdup(s) ((s) ? strdup(s) : NULL)
+#else
+char               *Estrdup(const char *s);
+#endif
+
 void               *__Emalloc(int size);
 void               *__Erealloc(void *ptr, int size);
 void                __Efree(void *ptr);
-char               *duplicate(char *s);
 
 #define FILEPATH_LEN_MAX 4096
 /* This turns on E's internal stack tracking system for  coarse debugging */
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/eesh/alert.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- alert.c     19 Jan 2004 22:30:26 -0000      1.6
+++ alert.c     28 Feb 2004 15:13:57 -0000      1.7
@@ -77,7 +77,7 @@
    if (TitleText)
       Efree(TitleText);
    TitleText = NULL;
-   TitleText = duplicate(text);
+   TitleText = Estrdup(text);
 }
 
 void
@@ -86,7 +86,7 @@
    if (IgnoreText)
       Efree(IgnoreText);
    IgnoreText = NULL;
-   IgnoreText = duplicate(text);
+   IgnoreText = Estrdup(text);
 }
 
 void
@@ -95,7 +95,7 @@
    if (RestartText)
       Efree(RestartText);
    RestartText = NULL;
-   RestartText = duplicate(text);
+   RestartText = Estrdup(text);
 }
 
 void
@@ -104,7 +104,7 @@
    if (ExitText)
       Efree(ExitText);
    ExitText = NULL;
-   ExitText = duplicate(text);
+   ExitText = Estrdup(text);
 }
 
 void
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/eesh/comms.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- comms.c     19 Jan 2004 22:30:26 -0000      1.8
+++ comms.c     28 Feb 2004 15:13:57 -0000      1.9
@@ -148,7 +148,7 @@
        if (!cl)
           EDBUG_RETURN(NULL);
        sprintf(st, "%8x", (int)win);
-       cl->name = duplicate(st);
+       cl->name = Estrdup(st);
        AddItem((void *)cl, st, cl->win, LIST_TYPE_CLIENT);
        XSelectInput(disp, win, StructureNotifyMask | SubstructureNotifyMask);
      }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/eesh/file.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- file.c      18 Feb 2004 22:18:40 -0000      1.9
+++ file.c      28 Feb 2004 15:13:57 -0000      1.10
@@ -280,7 +280,7 @@
 
    EDBUG(9, "cwd");
    getcwd(ss, FILEPATH_LEN_MAX);
-   s = duplicate(ss);
+   s = Estrdup(ss);
    EDBUG_RETURN(s);
 }
 
@@ -333,11 +333,11 @@
    pwd = getpwuid(uid);
    if (pwd)
      {
-       s = duplicate(pwd->pw_name);
+       s = Estrdup(pwd->pw_name);
 /*      Efree(pwd); */
        EDBUG_RETURN(s);
      }
-   EDBUG_RETURN(duplicate("unknown"));
+   EDBUG_RETURN(Estrdup("unknown"));
 }
 
 char               *
@@ -350,11 +350,11 @@
    pwd = getpwuid(uid);
    if (pwd)
      {
-       s = duplicate(pwd->pw_dir);
+       s = Estrdup(pwd->pw_dir);
 /*      Efree(pwd); */
        EDBUG_RETURN(s);
      }
-   EDBUG_RETURN(duplicate("/tmp"));
+   EDBUG_RETURN(Estrdup("/tmp"));
 }
 
 char               *
@@ -367,11 +367,11 @@
    pwd = getpwuid(uid);
    if (pwd)
      {
-       s = duplicate(pwd->pw_shell);
+       s = Estrdup(pwd->pw_shell);
 /*      Efree(pwd); */
        EDBUG_RETURN(s);
      }
-   EDBUG_RETURN(duplicate("/bin/sh"));
+   EDBUG_RETURN(Estrdup("/bin/sh"));
 }
 
 char               *
@@ -534,7 +534,7 @@
    for (i = 0; i < (p2 - p1 - 1); i++)
       ss[i] = s[p1 + 1 + i];
    ss[i] = 0;
-   EDBUG_RETURN(duplicate(ss));
+   EDBUG_RETURN(Estrdup(ss));
 }
 
 char               *
@@ -555,7 +555,7 @@
    for (i = 0; i < (p2 - p1 - 1); i++)
       ss[i] = s[p1 + 1 + i];
    ss[i] = 0;
-   EDBUG_RETURN(duplicate(ss));
+   EDBUG_RETURN(Estrdup(ss));
 }
 
 char               *
@@ -569,11 +569,11 @@
    if (file[0] == '/')
      {
        if (canexec(file))
-          EDBUG_RETURN(duplicate(file));
+          EDBUG_RETURN(Estrdup(file));
      }
    p = getenv("PATH");
    if (!p)
-      EDBUG_RETURN(duplicate(file));
+      EDBUG_RETURN(Estrdup(file));
    if (!file)
       EDBUG_RETURN(NULL);
    cp = p;
@@ -622,11 +622,11 @@
    if (file[0] == '/')
      {
        if (exists(file))
-          EDBUG_RETURN(duplicate(file));
+          EDBUG_RETURN(Estrdup(file));
      }
    p = getenv("PATH");
    if (!p)
-      EDBUG_RETURN(duplicate(file));
+      EDBUG_RETURN(Estrdup(file));
    if (!file)
       EDBUG_RETURN(NULL);
    cp = p;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/eesh/lists.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- lists.c     19 Jan 2004 22:30:26 -0000      1.6
+++ lists.c     28 Feb 2004 15:13:57 -0000      1.7
@@ -81,7 +81,7 @@
    if (!ptr)
       EDBUG_RETURN_;
    ptr->item = item;
-   ptr->name = duplicate(name);
+   ptr->name = Estrdup(name);
    ptr->id = id;
    ptr->type = type;
    ptr->next = lists.next;
@@ -260,7 +260,7 @@
          {
             if (ptr->type == type)
               {
-                 list[i] = duplicate(ptr->name);
+                 list[i] = Estrdup(ptr->name);
                  i++;
               }
             ptr = ptr->next;
@@ -270,7 +270,7 @@
      {
        while (ptr)
          {
-            list[i] = duplicate(ptr->name);
+            list[i] = Estrdup(ptr->name);
             i++;
             ptr = ptr->next;
          }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/eesh/main.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- main.c      18 Feb 2004 22:18:40 -0000      1.15
+++ main.c      28 Feb 2004 15:13:57 -0000      1.16
@@ -70,7 +70,7 @@
        else if (!strcmp(argv[i], "-display"))
          {
             if (i != (argc - 1))
-               display_name = duplicate(argv[++i]);
+               display_name = Estrdup(argv[++i]);
          }
        else if ((!strcmp(argv[i], "-h")) ||
                 (!strcmp(argv[i], "--h")) ||
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/eesh/memory.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- memory.c    19 Jan 2004 22:30:26 -0000      1.5
+++ memory.c    28 Feb 2004 15:13:57 -0000      1.6
@@ -152,8 +152,9 @@
    EDBUG_RETURN_;
 }
 
+#if !(defined(USE_STRDUP) && defined(HAVE_STRDUP))
 char               *
-duplicate(char *s)
+Estrdup(const char *s)
 {
    char               *ss;
    int                 sz;
@@ -166,3 +167,4 @@
    strncpy(ss, s, sz + 1);
    EDBUG_RETURN(ss);
 }
+#endif




-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to