cvs-cvs
[Top][All Lists]
Advanced

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

[Cvs-cvs] ccvs/src ChangeLog checkout.c


From: Derek Robert Price
Subject: [Cvs-cvs] ccvs/src ChangeLog checkout.c
Date: Tue, 30 Sep 2008 20:16:48 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Changes by:     Derek Robert Price <dprice>     08/09/30 20:16:48

Modified files:
        src            : ChangeLog checkout.c 

Log message:
        * checkout.c (preload_update_dir): Eliminate global.  It was used in
        only one function which restored its state on exit, and it even
        uselessly duplicated the value of another variable within that
        function.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/ChangeLog?cvsroot=cvs&r1=1.3625&r2=1.3626
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/checkout.c?cvsroot=cvs&r1=1.155&r2=1.156

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/ChangeLog,v
retrieving revision 1.3625
retrieving revision 1.3626
diff -u -b -r1.3625 -r1.3626
--- ChangeLog   29 Sep 2008 18:16:15 -0000      1.3625
+++ ChangeLog   30 Sep 2008 20:16:47 -0000      1.3626
@@ -1,3 +1,10 @@
+2008-09-30  Derek R. Price  <address@hidden>
+
+       * checkout.c (preload_update_dir): Eliminate global.  It was used in
+       only one function which restored its state on exit, and it even
+       uselessly duplicated the value of another variable within that
+       function.
+
 2008-09-29  Derek R. Price  <address@hidden>
 
        * client.c (is_cvsroot_level): Replace a conditional with an

Index: checkout.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/checkout.c,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -b -r1.155 -r1.156
--- checkout.c  29 Sep 2008 02:56:36 -0000      1.155
+++ checkout.c  30 Sep 2008 20:16:48 -0000      1.156
@@ -113,7 +113,6 @@
 static char *join_rev1, *join_date1;
 static char *join_rev2, *join_date2;
 static bool join_tags_validated;
-static char *preload_update_dir;
 static char *history_name;
 static enum mtype m_type;
 
@@ -140,7 +139,7 @@
        options = NULL;
     }
     tag = date = join_rev1 = join_date1 = join_rev2 = join_date2 =
-         join_orig1 = join_orig2 = preload_update_dir = NULL;
+         join_orig1 = join_orig2 = NULL;
     history_name = NULL;
     tag_validated = join_tags_validated = false;
 
@@ -631,7 +630,6 @@
     int which;
     char *cp;
     char *repository;
-    char *oldupdate = NULL;
     char *where;
 
     assert (argc);
@@ -656,12 +654,6 @@
     repository = Xasprintf ("%s/%s", current_parsed_root->directory, argv[0]);
     Sanitize_Repository_Name (repository);
 
-
-    /* save the original value of preload_update_dir */
-    if (preload_update_dir != NULL)
-       oldupdate = xstrdup (preload_update_dir);
-
-
     /* Allocate space and set up the where variable.  We allocate more
        space than necessary here so that we don't have to keep
        reallocaing it later on. */
@@ -788,17 +780,6 @@
        free (path);
     }
 
-    if (preload_update_dir)
-    {
-       preload_update_dir =
-           xrealloc (preload_update_dir,
-                     strlen (preload_update_dir) + strlen (where) + 2);
-       strcat (preload_update_dir, "/");
-       strcat (preload_update_dir, where);
-    }
-    else
-       preload_update_dir = xstrdup (where);
-
     /*
      * At this point, where is the directory we want to build, repository is
      * the repository for the lowest level of the path.
@@ -972,7 +953,7 @@
                if (!isdir (repository))
                    error (1, 0, "there is no repository %s", repository);
 
-               Create_Admin (".", preload_update_dir, repository,
+               Create_Admin (".", where, repository,
                              NULL, NULL, 0, 0, m_type == CHECKOUT);
                fp = xfopen (CVSADM_ENTSTAT, "w+");
                if (fclose (fp) == EOF)
@@ -988,7 +969,7 @@
                if (!isdir (repository))
                    error (1, 0, "there is no repository %s", repository);
 
-               Create_Admin (".", preload_update_dir, repository, tag, date,
+               Create_Admin (".", where, repository, tag, date,
 
                              /* FIXME?  This is a guess.  If it is important
                                 for nonbranch to be set correctly here I
@@ -1007,7 +988,7 @@
                error (1, 0, "cannot export into working directory");
 
            /* get the contents of the previously existing repository */
-           repos = Name_Repository (NULL, preload_update_dir);
+           repos = Name_Repository (NULL, where);
            if (fncmp (repository, repos) != 0)
            {
                char *prepos = xstrdup (primary_root_inverse_translate (repos));
@@ -1080,32 +1061,28 @@
     if (!(local_specified || argc > 1))
     {
        if (!pipeout)
-           history_write (m_type == CHECKOUT ? 'O' : 'E', preload_update_dir,
+           history_write (m_type == CHECKOUT ? 'O' : 'E', where,
                           history_name, where, repository);
        err += do_update (0, NULL, options, tag, date,
                          force_tag_match, false /* !local */ ,
                          true /* update -d */ , aflag, checkout_prune_dirs,
                          pipeout, which, join_rev1, join_date1,
-                         join_rev2, join_date2,
-                         preload_update_dir, m_type == CHECKOUT,
+                         join_rev2, join_date2, where, m_type == CHECKOUT,
                          repository);
        goto out;
     }
 
     /* Don't log "export", just regular "checkouts" */
     if (m_type == CHECKOUT && !pipeout)
-       history_write ('O', preload_update_dir, history_name, where,
-                      repository);
+       history_write ('O', where, history_name, where, repository);
 
     /* go ahead and call update now that everything is set */
     err += do_update (argc - 1, argv + 1, options, tag, date,
                      force_tag_match, local_specified, true /* update -d */,
                      aflag, checkout_prune_dirs, pipeout, which, join_rev1,
-                     join_date1, join_rev2, join_date2, preload_update_dir,
+                     join_date1, join_rev2, join_date2, where,
                      m_type == CHECKOUT, repository);
 out:
-    free (preload_update_dir);
-    preload_update_dir = oldupdate;
     free (where);
     free (repository);
     return err;




reply via email to

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