cvs-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Cvs-cvs] ccvs/src ChangeLog commit.c edit.c recurse.c re...


From: Derek Robert Price
Subject: [Cvs-cvs] ccvs/src ChangeLog commit.c edit.c recurse.c re...
Date: Wed, 12 Sep 2007 19:14:28 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Changes by:     Derek Robert Price <dprice>     07/09/12 19:14:27

Modified files:
        src            : ChangeLog commit.c edit.c recurse.c recurse.h 

Log message:
        * commit.c: Misc cleanup.  Use GNULIB's quote(), if not consistently.
        * edit.c: Alphabetize includes.
        * recurse.c (start_recursion): Use new enum lock_type and make
        UPDATE_PRELOAD const.  Use TRACE_NULL in traces.
        * recurse.h (enum lock_type): New type replacing...
        (CVS_LOCK_NONE, CVS_LOCK_READ, CVS_LOCK_WRITE): ...these macros.
        (W_LOCAL, W_ATTIC, W_REPOS): Clean up.
        (start_recursion): Update prototype per recurse.c.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/ChangeLog?cvsroot=cvs&r1=1.3541&r2=1.3542
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/commit.c?cvsroot=cvs&r1=1.277&r2=1.278
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/edit.c?cvsroot=cvs&r1=1.102&r2=1.103
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/recurse.c?cvsroot=cvs&r1=1.123&r2=1.124
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/recurse.h?cvsroot=cvs&r1=1.2&r2=1.3

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/ChangeLog,v
retrieving revision 1.3541
retrieving revision 1.3542
diff -u -b -r1.3541 -r1.3542
--- ChangeLog   12 Sep 2007 18:27:06 -0000      1.3541
+++ ChangeLog   12 Sep 2007 19:14:26 -0000      1.3542
@@ -1,5 +1,14 @@
 2007-09-12  Derek Price  <address@hidden>
 
+       * commit.c: Misc cleanup.  Use GNULIB's quote(), if not consistently.
+       * edit.c: Alphabetize includes.
+       * recurse.c (start_recursion): Use new enum lock_type and make
+       UPDATE_PRELOAD const.  Use TRACE_NULL in traces.
+       * recurse.h (enum lock_type): New type replacing...
+       (CVS_LOCK_NONE, CVS_LOCK_READ, CVS_LOCK_WRITE): ...these macros.
+       (W_LOCAL, W_ATTIC, W_REPOS): Clean up.
+       (start_recursion): Update prototype per recurse.c.
+
        * subr.h (STRNEQ): New macro.
        * add.c, admin.c, checkout.c, client.c, commit.c, create_adm.c,
        cvsrc.c, edit.c, entries.c, fileattr.c, find_names.c, history.c,

Index: commit.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/commit.c,v
retrieving revision 1.277
retrieving revision 1.278
diff -u -b -r1.277 -r1.278
--- commit.c    12 Sep 2007 18:27:07 -0000      1.277
+++ commit.c    12 Sep 2007 19:14:27 -0000      1.278
@@ -24,9 +24,13 @@
 # include <config.h>
 #endif
 
-/* CVS headers.  */
+/* GNULIB */
+#include "quote.h"
+
+/* CVS */
 #include "edit.h"
 #include "fileattr.h"
+#include "hardlink.h"
 #include "ignore.h"
 #include "lock.h"
 #include "logmsg.h"
@@ -35,7 +39,6 @@
 #include "wrapper.h"
 
 #include "cvs.h"
-#include "hardlink.h"
 
 static Dtype check_direntproc (void *callerdat, const char *dir,
                                const char *repos, const char *update_dir,
@@ -251,23 +254,23 @@
     xfinfo.rcs = NULL;
 
     vers = Version_TS (&xfinfo, NULL, saved_tag, NULL, 0, 0);
-    if (vers->vn_user == NULL)
+    if (!vers->vn_user)
     {
-       if (vers->ts_user == NULL)
-           error (0, 0, "nothing known about `%s'", finfo->fullname);
+       if (!vers->ts_user)
+           error (0, 0, "nothing known about %s", quote (finfo->fullname));
        else
-           error (0, 0, "use `%s add' to create an entry for `%s'",
-                  program_name, finfo->fullname);
+           error (0, 0, "use `%s add' to create an entry for %s",
+                  program_name, quote (finfo->fullname));
        freevers_ts (&vers);
        return 1;
     }
     if (vers->vn_user[0] == '-')
     {
-       if (vers->ts_user != NULL)
+       if (vers->ts_user)
        {
            error (0, 0,
-                  "`%s' should be removed and is still there (or is back"
-                  " again)", finfo->fullname);
+                  "%s should be removed and is still there (or is back again)",
+                  quote (finfo->fullname));
            freevers_ts (&vers);
            return 1;
        }
@@ -276,7 +279,7 @@
     }
     else if (STREQ (vers->vn_user, "0"))
     {
-       if (vers->ts_user == NULL)
+       if (!vers->ts_user)
        {
            /* This happens when one has `cvs add'ed a file, but it no
               longer exists in the working directory at commit time.
@@ -291,7 +294,7 @@
        else
            status = T_ADDED;
     }
-    else if (vers->ts_user == NULL)
+    else if (!vers->ts_user)
     {
        /* FIXME: What classify_file does in this case is print
           "%s was lost".  We probably should do the same.  */
@@ -933,9 +936,9 @@
                   keyword expansion, because there is no -ko
                   analogue.  */
                error (0, 0,
-                      "\
-warning: file `%s' seems to still contain conflict indicators",
-                      finfo->fullname);
+                      "warning: file %s seems to still contain conflict"
+                      " indicators",
+                      quote (finfo->fullname));
            }
 
            if ((status == T_ADDED || status == T_MODIFIED)
@@ -956,7 +959,7 @@
 
            if (status == T_REMOVED)
            {
-               if (vers->ts_user != NULL)
+               if (vers->ts_user)
                {
                    error (0, 0,
                           "`%s' should be removed and is still there (or is"
@@ -980,33 +983,35 @@
            }
            if (status == T_ADDED)
            {
-               if (vers->tag == NULL)
+               if (!vers->tag)
                {
-                   if (finfo->rcs != NULL &&
-                       !RCS_isdead (finfo->rcs, finfo->rcs->head))
+                   if (finfo->rcs
+                       && !RCS_isdead (finfo->rcs, finfo->rcs->head))
                    {
                        error (0, 0,
-                   "cannot add file `%s' when RCS file `%s' already exists",
-                              finfo->fullname, finfo->rcs->path);
+                       "cannot add file %s when RCS file %s already exists",
+                              quote_n (0, finfo->fullname),
+                              quote_n (1, finfo->rcs->path));
                        goto out;
                    }
                }
-               else if (isdigit ((unsigned char) *vers->tag) &&
-                   numdots (vers->tag) > 1)
+               else if (isdigit ((unsigned char)*vers->tag)
+                                 && numdots (vers->tag) > 1)
                {
                    error (0, 0,
-               "cannot add file `%s' with revision `%s'; must be on trunk",
-                              finfo->fullname, vers->tag);
+                   "cannot add file %s with revision %s; must be on trunk",
+                              quote_n (0, finfo->fullname),
+                              quote_n (1, vers->tag));
                    goto out;
                }
            }
 
            /* done with consistency checks; now, to get on with the commit */
-           if (finfo->update_dir[0] == '\0')
+           if (!*finfo->update_dir)
                xdir = ".";
            else
                xdir = finfo->update_dir;
-           if ((p = findnode (mulist, xdir)) != NULL)
+           if (p = findnode (mulist, xdir))
            {
                ulist = ((struct master_lists *) p->data)->ulist;
                cilist = ((struct master_lists *) p->data)->cilist;
@@ -1041,7 +1046,7 @@
 
                editor = NULL;
                 editors = fileattr_get0 (finfo->file, "_editors");
-                if (editors != NULL)
+                if (editors)
                 {
                     char *caller = getcaller ();
                     char *p = NULL;
@@ -1052,7 +1057,7 @@
                     while (*p != '\0')
                     {
                         p = strchr (p, '>');
-                        if (p == NULL)
+                        if (!p)
                         {
                             break;
                         }
@@ -1062,7 +1067,7 @@
                             break;
                         }
                         p = strchr (p + 1, ',');
-                        if (p == NULL)
+                        if (!p)
                         {
                             break;
                         }
@@ -1079,10 +1084,10 @@
                 }
             }
 
-            if (check_valid_edit && editor == NULL)
+            if (check_valid_edit && !editor)
             {
                 error (0, 0, "Valid edit does not exist for %s",
-                       finfo->fullname);
+                       quote (finfo->fullname));
                if (li) free (li);
                if (p) freenode (p);
                 freevers_ts (&vers);
@@ -1132,7 +1137,7 @@
 
                /* If linkp is NULL, the file doesn't exist... maybe
                   we're doing a remove operation? */
-               if (linkp != NULL)
+               if (linkp)
                {
                    /* Create a new hardlink_info node, which will record
                       the current file's status and the links listed in its
@@ -1149,7 +1154,7 @@
         }
 
        case T_UNKNOWN:
-           error (0, 0, "nothing known about `%s'", finfo->fullname);
+           error (0, 0, "nothing known about %s", quote (finfo->fullname));
            goto out;
        case T_UPTODATE:
            break;

Index: edit.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/edit.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -b -r1.102 -r1.103
--- edit.c      12 Sep 2007 18:27:07 -0000      1.102
+++ edit.c      12 Sep 2007 19:14:27 -0000      1.103
@@ -26,8 +26,8 @@
 
 /* CVS headers.  */
 #include "base.h"
-#include "ignore.h"
 #include "fileattr.h"
+#include "ignore.h"
 #include "lock.h"
 #include "recurse.h"
 #include "repos.h"

Index: recurse.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/recurse.c,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -b -r1.123 -r1.124
--- recurse.c   12 Sep 2007 17:27:23 -0000      1.123
+++ recurse.c   12 Sep 2007 19:14:27 -0000      1.124
@@ -57,7 +57,7 @@
     Dtype flags;
     int which;
     int aflag;
-    int locktype;
+    enum lock_type locktype;
     int dosrcs;
     char *repository;                  /* Keep track of repository for rtag */
 };
@@ -190,8 +190,9 @@
 start_recursion (FILEPROC fileproc, FILESDONEPROC filesdoneproc,
                  DIRENTPROC direntproc, DIRLEAVEPROC dirleaveproc,
                  void *callerdat, int argc, char **argv, int local,
-                 int which, int aflag, int locktype,
-                 char *update_preload, int dosrcs, char *repository_in)
+                 int which, int aflag, enum lock_type locktype,
+                 const char *update_preload, int dosrcs,
+                char *repository_in)
 {
     int i, err = 0;
 #ifdef CLIENT_SUPPORT
@@ -201,8 +202,8 @@
     struct recursion_frame frame;
 
 #ifdef HAVE_PRINTF_PTR
-    TRACE ( TRACE_FLOW,
-           "start_recursion ( fileproc=%p, filesdoneproc=%p,\n"
+    TRACE (TRACE_FLOW,
+          "start_recursion (fileproc=%p, filesdoneproc=%p,\n"
        "                       direntproc=%p, dirleavproc=%p,\n"
        "                       callerdat=%p, argc=%d, argv=%p,\n"
        "                       local=%d, which=%d, aflag=%d,\n"
@@ -212,11 +213,11 @@
               (void *) direntproc, (void *) dirleaveproc,
               (void *) callerdat, argc, (void *) argv,
               local, which, aflag, locktype,
-              update_preload ? update_preload : "(null)", dosrcs,
-              repository_in ? repository_in : "(null)");
+          TRACE_NULL (update_preload), dosrcs,
+          TRACE_NULL (repository_in));
 #else
-    TRACE ( TRACE_FLOW,
-           "start_recursion ( fileproc=%lx, filesdoneproc=%lx,\n"
+    TRACE (TRACE_FLOW,
+          "start_recursion (fileproc=%lx, filesdoneproc=%lx,\n"
        "                       direntproc=%lx, dirleavproc=%lx,\n"
        "                       callerdat=%lx, argc=%d, argv=%lx,\n"
        "                       local=%d, which=%d, aflag=%d,\n"
@@ -226,8 +227,8 @@
               (unsigned long) direntproc, (unsigned long) dirleaveproc,
               (unsigned long) callerdat, argc, (unsigned long) argv,
               local, which, aflag, locktype,
-              update_preload ? update_preload : "(null)", dosrcs,
-              repository_in ? repository_in : "(null)");
+          TRACE_NULL (update_preload), dosrcs,
+          TRACE_NULL (repository_in));
 #endif
 
     frame.fileproc = fileproc;

Index: recurse.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/recurse.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- recurse.h   24 Apr 2006 18:50:27 -0000      1.2
+++ recurse.h   12 Sep 2007 19:14:27 -0000      1.3
@@ -22,9 +22,9 @@
 #include "rcs.h"       /* Get struct file_info.  */
 
 /* Flags for find_{names,dirs} routines */
-#define W_LOCAL                        0x01    /* look for files locally */
-#define W_REPOS                        0x02    /* look for files in the 
repository */
-#define W_ATTIC                        0x04    /* look for files in the attic 
*/
+#define W_LOCAL                (1 << 0)        /* look for files locally */
+#define W_REPOS                (1 << 1)        /* look for files in the 
repository */
+#define W_ATTIC                (1 << 2)        /* look for files in the attic 
*/
 
 /* Flags for return values of direnter procs for the recursion processor */
 enum direnter_type
@@ -41,9 +41,12 @@
 #endif
 
 /* Recursion processor lock types */
-#define CVS_LOCK_NONE  0
-#define CVS_LOCK_READ  1
-#define CVS_LOCK_WRITE 2
+enum lock_type
+{
+    CVS_LOCK_NONE,
+    CVS_LOCK_READ,
+    CVS_LOCK_WRITE
+};
 
 /* Callback functions.  */
 typedef        int (*FILEPROC) (void *callerdat, struct file_info *finfo);
@@ -58,9 +61,8 @@
 
 int start_recursion (FILEPROC fileproc, FILESDONEPROC filesdoneproc,
                     DIRENTPROC direntproc, DIRLEAVEPROC dirleaveproc,
-                    void *callerdat,
-                    int argc, char *argv[], int local, int which,
-                    int aflag, int locktype, char *update_preload,
-                    int dosrcs, char *repository);
+                    void *callerdat, int argc, char *argv[], int local,
+                    int which, int aflag, enum lock_type locktype,
+                    const char *update_preload, int dosrcs, char *repository);
 
 #endif /* RECURSE_H */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]