Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        buttons.c fx.c snaps.c windowmatch.c 


Log Message:
Eliminate use of word() and atword().

===================================================================
RCS file: /cvs/e/e16/e/src/buttons.c,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -3 -r1.100 -r1.101
--- buttons.c   17 Jan 2007 01:10:42 -0000      1.100
+++ buttons.c   25 Feb 2007 19:03:19 -0000      1.101
@@ -32,7 +32,6 @@
 #include "file.h"
 #include "grabs.h"
 #include "iclass.h"
-#include "parse.h"
 #include "tclass.h"
 #include "tooltips.h"
 #include "xwin.h"
@@ -712,14 +711,14 @@
    char                sticky = 0;
    char                show = 1;
    char                internal = 0;
-   int                 fields;
-   const char         *ss;
+   int                 fields, len;
 
    while (GetLine(s, sizeof(s), ConfigFile))
      {
        s2[0] = 0;
        i1 = CONFIG_INVALID;
-       fields = sscanf(s, "%i %4000s", &i1, s2);
+       len = 0;
+       fields = sscanf(s, "%i %4000s %n", &i1, s2, &len);
 
        if (fields < 1)
          {
@@ -762,8 +761,7 @@
             break;
          case BUTTON_LABEL:
             _EFREE(label);
-            ss = atword(s, 2);
-            label = Estrdup(ss);
+            label = Estrdup(s + len);
             if (pbt)
               {
                  _EFREE(pbt->label);
@@ -1047,10 +1045,11 @@
 static void
 doHideShowButton(const char *params)
 {
-   Button             *b;
    char                s[1024];
    const char         *ss;
+   int                 len;
    button_match_data   bmd = { -1, 1, NULL };
+   Button             *b;
 
    if (!params)
      {
@@ -1059,7 +1058,11 @@
        goto done;
      }
 
-   sscanf(params, "%1000s", s);
+   s[0] = '\0';
+   len = 0;
+   sscanf(params, "%1000s %n", s, &len);
+   ss = (len > 0) ? params + len : NULL;
+
    if (!strcmp(s, "button"))
      {
        sscanf(params, "%*s %1000s", s);
@@ -1069,7 +1072,6 @@
      }
    else if (!strcmp(s, "buttons"))
      {
-       ss = atword(params, 2);
        if (!ss)
           return;
 
@@ -1078,7 +1080,6 @@
      }
    else if (!strcmp(s, "all_buttons_except"))
      {
-       ss = atword(params, 2);
        if (!ss)
           return;
 
===================================================================
RCS file: /cvs/e/e16/e/src/fx.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -3 -r1.78 -r1.79
--- fx.c        17 Jan 2007 01:10:43 -0000      1.78
+++ fx.c        25 Feb 2007 19:03:19 -0000      1.79
@@ -25,7 +25,6 @@
 #include "dialog.h"
 #include "eimage.h"
 #include "emodule.h"
-#include "parse.h"
 #include "settings.h"
 #include "timers.h"
 #include "xwin.h"
@@ -927,21 +926,18 @@
 static void
 FxIpc(const char *params, Client * c __UNUSED__)
 {
-   char                word1[FILEPATH_LEN_MAX];
-   char                word2[FILEPATH_LEN_MAX];
+   char                word1[1024];
+   char                word2[1024];
 
    if (!params)
       return;
 
-   word1[0] = '\0';
-   word2[0] = '\0';
-
-   word(params, 1, word1);
+   word1[0] = word2[0] = '\0';
+   sscanf(params, "%1000s %1000s", word1, word2);
 
    if (!strcmp(word1, "raindrops") || !strcmp(word1, "ripples") ||
        !strcmp(word1, "waves"))
      {
-       word(params, 2, word2);
        if (!strcmp(word2, ""))
           FX_Op(word1, FX_OP_TOGGLE);
        else if (!strcmp(word2, "on"))
===================================================================
RCS file: /cvs/e/e16/e/src/snaps.c,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -3 -r1.130 -r1.131
--- snaps.c     17 Jan 2007 01:10:43 -0000      1.130
+++ snaps.c     25 Feb 2007 19:03:19 -0000      1.131
@@ -29,7 +29,6 @@
 #include "ewins.h"
 #include "file.h"
 #include "groups.h"
-#include "parse.h"
 #include "settings.h"
 #include "snaps.h"
 #include "timers.h"
@@ -1538,16 +1537,26 @@
 void
 SnapshotEwinParse(EWin * ewin, const char *params)
 {
-   char                param[FILEPATH_LEN_MAX];
+   char                param[1024];
+   const char         *p;
+   int                 len;
    unsigned int        match_flags, use_flags;
 
+   p = params;
+   if (!p)
+      return;
+
    match_flags = SNAP_MATCH_DEFAULT;
    use_flags = 0;
 
-   for (; params;)
+   for (;;)
      {
-       param[0] = 0;
-       word(params, 1, param);
+       param[0] = '\0';
+       len = 0;
+       sscanf(p, "%s %n", param, &len);
+       if (len <= 0)
+          break;
+       p += len;
 
        if (!strcmp(param, "all"))
          {
@@ -1586,8 +1595,6 @@
 #endif
        else if (!strcmp(param, "group"))
           use_flags |= SNAP_USE_GROUPS;
-
-       params = atword(params, 2);
      }
 
    if (ewin->snap)
===================================================================
RCS file: /cvs/e/e16/e/src/windowmatch.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -3 -r1.59 -r1.60
--- windowmatch.c       17 Jan 2007 01:10:43 -0000      1.59
+++ windowmatch.c       25 Feb 2007 19:03:19 -0000      1.60
@@ -29,7 +29,6 @@
 #include "emodule.h"
 #include "ewins.h"
 #include "ewin-ops.h"
-#include "parse.h"
 #include "windowmatch.h"
 
 typedef struct _windowmatch WindowMatch;
@@ -143,15 +142,15 @@
    WindowMatch        *wm = 0;
    char                s[FILEPATH_LEN_MAX];
    char                s2[FILEPATH_LEN_MAX];
-   const char         *ss;
    int                 i1;
-   int                 fields;
+   int                 fields, len;
 
    while (GetLine(s, sizeof(s), fs))
      {
        s2[0] = 0;
        i1 = CONFIG_INVALID;
-       fields = sscanf(s, "%i %4000s", &i1, s2);
+       len = 0;
+       fields = sscanf(s, "%i %4000s %n", &i1, s2, &len);
 
        if (fields < 1)
           i1 = CONFIG_INVALID;
@@ -191,22 +190,19 @@
             if (!wm)
                break;
             wm->match = MATCH_TYPE_TITLE;
-            ss = atword(s, 2);
-            wm->value = Estrdup(ss);
+            wm->value = Estrdup(s + len);
             break;
          case WINDOWMATCH_MATCHNAME:
             if (!wm)
                break;
             wm->match = MATCH_TYPE_WM_NAME;
-            ss = atword(s, 2);
-            wm->value = Estrdup(ss);
+            wm->value = Estrdup(s + len);
             break;
          case WINDOWMATCH_MATCHCLASS:
             if (!wm)
                break;
             wm->match = MATCH_TYPE_WM_CLASS;
-            ss = atword(s, 2);
-            wm->value = Estrdup(ss);
+            wm->value = Estrdup(s + len);
             break;
 
          case WINDOWMATCH_WIDTH:



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to