Enlightenment CVS committal

Author  : sebastid
Project : e17
Module  : libs/embryo

Dir     : e17/libs/embryo/src/bin


Modified Files:
        embryo_cc_sc1.c embryo_cc_sc2.c embryo_cc_sc6.c 
        embryo_cc_sc7.c 


Log Message:
Don't use strlen to check if a string is empty.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/embryo/src/bin/embryo_cc_sc1.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- embryo_cc_sc1.c     13 Apr 2005 20:27:02 -0000      1.30
+++ embryo_cc_sc1.c     4 Nov 2005 08:16:24 -0000       1.31
@@ -21,7 +21,7 @@
  *  must not be misrepresented as being the original software.
  *  3.  This notice may not be removed or altered from any source
  *  distribution.  
- *  Version: $Id: embryo_cc_sc1.c,v 1.30 2005/04/13 20:27:02 tsauerbeck Exp $
+ *  Version: $Id: embryo_cc_sc1.c,v 1.31 2005/11/04 08:16:24 sebastid Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -342,7 +342,7 @@
    sc_status = statFIRST;
    /* do the first pass through the file */
    inpfmark = sc_getpossrc(inpf);
-   if (strlen(incfname) > 0)
+   if (incfname[0] != '\0')
      {
        if (strcmp(incfname, sDEF_PREFIX) == 0)
          {
@@ -390,7 +390,7 @@
                                 * by resetglobals() */
    writeleader();
    setfile(inpfname, fnumber);
-   if (strlen(incfname) > 0)
+   if (incfname[0] != '\0')
      {
        if (strcmp(incfname, sDEF_PREFIX) == 0)
           plungefile(incfname, FALSE, TRUE);   /* parse "default.inc" (again) 
*/
@@ -601,19 +601,16 @@
       {
         /* include directory */
         i++;
-        snprintf(str, sizeof(str), "%s", argv[i]);
+        strncpy(str, argv[i], sizeof(str));
 
         len = strlen(str);
-        if (len > 0)
+        if (str[len - 1] != DIRSEP_CHAR)
         {
-           if (str[len - 1] != DIRSEP_CHAR)
-           {
-              str[len] = DIRSEP_CHAR;
-              str[len + 1] = '\0';
-           }
-
-           insert_path(str);
+           str[len] = DIRSEP_CHAR;
+           str[len + 1] = '\0';
         }
+
+        insert_path(str);
       }
       else if (!strcmp (argv[i], "-o") && *argv[i + 1])
       {
@@ -640,7 +637,7 @@
       else
       {
         /* only allow one input filename */
-        about ();
+        about();
       }
    }
 }
@@ -656,7 +653,7 @@
    strcpy(pname, sDEF_PREFIX);
 
    parseoptions(argc, argv, iname, oname, pname, rname);
-   if (strlen(iname) == 0)
+   if (iname[0] == '\0')
       about();
 }
 
@@ -1668,7 +1665,7 @@
    matchtoken(';');            /* eat an optional ; */
 
    /* set the enum name to the last value plus one */
-   if (strlen(enumname) > 0)
+   if (enumname[0] != '\0')
       add_constant(enumname, value, vclass, tag);
 }
 
@@ -1884,7 +1881,7 @@
       error(64);               /* cannot change predefined operators */
 
    /* change the operator name */
-   assert(strlen(opername) > 0);
+   assert(opername[0] != '\0');
    operator_symname(tmpname, opername, tags[0], tags[1], count, resulttag);
    if ((oldsym = findglb(tmpname)) != NULL)
      {
@@ -1919,7 +1916,7 @@
 static int
 check_operatortag(int opertok, int resulttag, char *opername)
 {
-   assert(opername != NULL && strlen(opername) > 0);
+   assert(opername != NULL && opername[0] != '\0');
    switch (opertok)
      {
      case '!':
@@ -2891,7 +2888,7 @@
             if ((sym->usage & (uDEFINE | uREAD | uNATIVE | uSTOCK)) == uDEFINE)
               {
                  funcdisplayname(symname, sym->name);
-                 if (strlen(symname) > 0)
+                 if (symname[0] != '\0')
                     error(203, symname);       /* symbol isn't used ...
                                                 * (and not native/stock) */
               }                /* if */
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/embryo/src/bin/embryo_cc_sc2.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- embryo_cc_sc2.c     13 Apr 2005 20:27:03 -0000      1.20
+++ embryo_cc_sc2.c     4 Nov 2005 08:16:24 -0000       1.21
@@ -21,7 +21,7 @@
  *      misrepresented as being the original software.
  *  3.  This notice may not be removed or altered from any source distribution.
  *
- *  Version: $Id: embryo_cc_sc2.c,v 1.20 2005/04/13 20:27:03 tsauerbeck Exp $
+ *  Version: $Id: embryo_cc_sc2.c,v 1.21 2005/11/04 08:16:24 sebastid Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -931,7 +931,7 @@
             char                pathname[_MAX_PATH];
 
             lptr = getstring(pathname, sizeof pathname, lptr);
-            if (strlen(pathname) > 0)
+            if (pathname[0] != '\0')
               {
                  free(inpfname);
                  inpfname = strdup(pathname);
@@ -1000,7 +1000,7 @@
                               name[i] = *lptr;
                            name[i] = '\0';
                         }      /* if */
-                      if (strlen(name) == 0)
+                      if (name[0] == '\0')
                         {
                            curlibrary = NULL;
                         }
@@ -1308,7 +1308,7 @@
                     delete_subst(pattern, prefixlen);
                  }             /* if */
                /* add the pattern/substitution pair to the list */
-               assert(strlen(pattern) > 0);
+               assert(pattern[0] != '\0');
                insert_subst(pattern, substitution, prefixlen);
                free(pattern);
                free(substitution);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/embryo/src/bin/embryo_cc_sc6.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- embryo_cc_sc6.c     13 Apr 2005 20:01:22 -0000      1.10
+++ embryo_cc_sc6.c     4 Nov 2005 08:16:24 -0000       1.11
@@ -18,7 +18,7 @@
  *      misrepresented as being the original software.
  *  3.  This notice may not be removed or altered from any source distribution.
  *
- *  Version: $Id: embryo_cc_sc6.c,v 1.10 2005/04/13 20:01:22 tsauerbeck Exp $
+ *  Version: $Id: embryo_cc_sc6.c,v 1.11 2005/11/04 08:16:24 sebastid Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -710,7 +710,7 @@
          }                     /* if */
        if (match)
          {
-            assert(strlen(alias) > 0);
+            assert(alias[0] != '\0');
             nametablesize += strlen(alias) + 1;
          }                     /* if */
      }                         /* for */
@@ -723,7 +723,7 @@
      {
        if (constptr->value > 0)
          {
-            assert(strlen(constptr->name) > 0);
+            assert(constptr->name[0] != '\0');
             numlibraries++;
             nametablesize += strlen(constptr->name) + 1;
          }                     /* if */
@@ -736,7 +736,7 @@
      {
        if ((constptr->value & PUBLICTAG) != 0)
          {
-            assert(strlen(constptr->name) > 0);
+            assert(constptr->name[0] != '\0');
             numtags++;
             nametablesize += strlen(constptr->name) + 1;
          }                     /* if */
@@ -892,7 +892,7 @@
      {
        if (constptr->value > 0)
          {
-            assert(strlen(constptr->name) > 0);
+            assert(constptr->name[0] != '\0');
             func.address = 0;
             func.nameofs = nameofs;
 #ifdef WORDS_BIGENDIAN
@@ -938,7 +938,7 @@
      {
        if ((constptr->value & PUBLICTAG) != 0)
          {
-            assert(strlen(constptr->name) > 0);
+            assert(constptr->name[0] != '\0');
             func.address = constptr->value & TAGMASK;
             func.nameofs = nameofs;
 #ifdef WORDS_BIGENDIAN
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/embryo/src/bin/embryo_cc_sc7.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- embryo_cc_sc7.c     13 Apr 2005 20:01:23 -0000      1.7
+++ embryo_cc_sc7.c     4 Nov 2005 08:16:24 -0000       1.8
@@ -35,7 +35,7 @@
  *      misrepresented as being the original software.
  *  3.  This notice may not be removed or altered from any source distribution.
  *
- *  Version: $Id: embryo_cc_sc7.c,v 1.7 2005/04/13 20:01:23 tsauerbeck Exp $
+ *  Version: $Id: embryo_cc_sc7.c,v 1.8 2005/11/04 08:16:24 sebastid Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -360,7 +360,7 @@
        /* write any contents that may be put in the buffer by stgwrite()
         * when "staging" was 0
         */
-       if (strlen(stgbuf) > 0)
+       if (stgbuf[0] != '\0')
           filewrite(stgbuf);
      }                         /* if */
    stgbuf[0] = '\0';




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to