[PATCH] slight reorganization of freevers_ts() in commit.c

Alexey Mahotkin <[email protected]>
Newsgroups gmane.comp.version-control.cvs.bugs
Message-ID <[email protected]>
2003-04-24  Alexey Mahotkin <[email protected]>

Free &vers in single place


 src/commit.c |   31 ++++++++++++++-----------------
 1 files changed, 14 insertions(+), 17 deletions(-)

--- ccvs/src/commit.c~freevers_ts	Thu Apr 24 23:42:11 2003
+++ ccvs-alexm/src/commit.c	Thu Apr 24 23:42:11 2003
@@ -786,6 +786,7 @@ check_fileproc (callerdat, finfo)
     Vers_TS *vers;
     struct commit_info *ci;
     struct logfile_info *li;
+    int retval = 1;
 
     size_t cvsroot_len = strlen (current_parsed_root->directory);
 
@@ -824,8 +825,7 @@ check_fileproc (callerdat, finfo)
 	case T_CONFLICT:
 	case T_REMOVE_ENTRY:
 	    error (0, 0, "Up-to-date check failed for `%s'", finfo->fullname);
-	    freevers_ts (&vers);
-	    return (1);
+	    goto out;
 	case T_MODIFIED:
 	case T_ADDED:
 	case T_REMOVED:
@@ -849,8 +849,7 @@ check_fileproc (callerdat, finfo)
 		    error (0, 0,
 			   "cannot commit with sticky date for file `%s'",
 			   finfo->fullname);
-		    freevers_ts (&vers);
-		    return (1);
+		    goto out;
 		}
 		if (status == T_MODIFIED && vers->tag &&
 		    !RCS_isbranch (finfo->rcs, vers->tag))
@@ -858,8 +857,7 @@ check_fileproc (callerdat, finfo)
 		    error (0, 0,
 			   "sticky tag `%s' for file `%s' is not a branch",
 			   vers->tag, finfo->fullname);
-		    freevers_ts (&vers);
-		    return (1);
+		    goto out;
 		}
 	    }
 	    if (status == T_MODIFIED && !force_ci && vers->ts_conflict)
@@ -875,8 +873,7 @@ check_fileproc (callerdat, finfo)
 		    error (0, 0,
 			  "file `%s' had a conflict and has not been modified",
 			   finfo->fullname);
-		    freevers_ts (&vers);
-		    return (1);
+		    goto out;
 		}
 
 		if (file_has_markers (finfo))
@@ -910,8 +907,7 @@ warning: file `%s' seems to still contai
 		error (0, 0,
 	"cannot remove file `%s' which has a numeric sticky tag of `%s'",
 			   finfo->fullname, vers->tag);
-		freevers_ts (&vers);
-		return (1);
+		goto out;
 	    }
 	    if (status == T_ADDED)
 	    {
@@ -923,8 +919,7 @@ warning: file `%s' seems to still contai
 			error (0, 0,
 		    "cannot add file `%s' when RCS file `%s' already exists",
 			       finfo->fullname, finfo->rcs->path);
-			freevers_ts (&vers);
-			return (1);
+			goto out;
 		    }
 		}
 		else if (isdigit ((unsigned char) *vers->tag) &&
@@ -933,8 +928,7 @@ warning: file `%s' seems to still contai
 		    error (0, 0,
 		"cannot add file `%s' with revision `%s'; must be on trunk",
 			       finfo->fullname, vers->tag);
-		    freevers_ts (&vers);
-		    return (1);
+		    goto out;
 		}
 	    }
 
@@ -1036,8 +1030,7 @@ warning: file `%s' seems to still contai
 	    break;
 	case T_UNKNOWN:
 	    error (0, 0, "nothing known about `%s'", finfo->fullname);
-	    freevers_ts (&vers);
-	    return (1);
+	    goto out;
 	case T_UPTODATE:
 	    break;
 	default:
@@ -1045,8 +1038,12 @@ warning: file `%s' seems to still contai
 	    break;
     }
 
+    retval = 0;
+
+ out:
+
     freevers_ts (&vers);
-    return (0);
+    return retval;
 }
 
 /*

_


--alexm
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.