(Fvertical_motion): Restore hscroll before moving to goal column.
[bpt/emacs.git] / lib-src / etags.c
index 2fe0c63..f577c75 100644 (file)
@@ -34,10 +34,10 @@ Copyright (C) 1984, 1987, 1988, 1989, 1993, 1994, 1995, 1998, 1999,
 
 This file is not considered part of GNU Emacs.
 
-This program is free software; you can redistribute it and/or modify
+This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -45,9 +45,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program; see the file COPYING.  If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. */
+along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 /* NB To comply with the above BSD license, copyright information is
@@ -67,7 +65,7 @@ University of California, as described above. */
  * 1985        Emacs TAGS format by Richard Stallman.
  * 1989        Sam Kendall added C++.
  * 1992 Joseph B. Wells improved C and C++ parsing.
- * 1993        Francesco Potortì reorganised C and C++.
+ * 1993        Francesco Potortì reorganized C and C++.
  * 1994        Line-by-line regexp tags by Tom Tromey.
  * 2001 Nested classes by Francesco Potortì (concept by Mykola Dzyuba).
  * 2002 #line directives by Francesco Potortì.
@@ -1801,8 +1799,8 @@ process_file_name (file, lang)
     pfatal (file);
 
  cleanup:
-  if (compressed_name) free (compressed_name);
-  if (uncompressed_name) free (uncompressed_name);
+  free (compressed_name);
+  free (uncompressed_name);
   last_node = NULL;
   curfdp = NULL;
   return;
@@ -2181,8 +2179,7 @@ free_tree (np)
     {
       register node *node_right = np->right;
       free_tree (np->left);
-      if (np->name != NULL)
-       free (np->name);
+      free (np->name);
       free (np->regex);
       free (np);
       np = node_right;
@@ -2197,11 +2194,11 @@ static void
 free_fdesc (fdp)
      register fdesc *fdp;
 {
-  if (fdp->infname != NULL) free (fdp->infname);
-  if (fdp->infabsname != NULL) free (fdp->infabsname);
-  if (fdp->infabsdir != NULL) free (fdp->infabsdir);
-  if (fdp->taggedfname != NULL) free (fdp->taggedfname);
-  if (fdp->prop != NULL) free (fdp->prop);
+  free (fdp->infname);
+  free (fdp->infabsname);
+  free (fdp->infabsdir);
+  free (fdp->taggedfname);
+  free (fdp->prop);
   free (fdp);
 }
 
@@ -2846,8 +2843,7 @@ popclass_above (bracelev)
        nl >= 0 && cstack.bracelev[nl] >= bracelev;
        nl--)
     {
-      if (cstack.cname[nl] != NULL)
-       free (cstack.cname[nl]);
+      free (cstack.cname[nl]);
       cstack.nl = nl;
     }
 }
@@ -5523,8 +5519,7 @@ Prolog_functions (inf)
          last[len] = '\0';
        }
     }
-  if (last != NULL)
-    free (last);
+  free (last);
 }
 
 
@@ -5702,8 +5697,7 @@ Erlang_functions (inf)
          last[len] = '\0';
        }
     }
-  if (last != NULL)
-    free (last);
+  free (last);
 }
 
 
@@ -6792,8 +6786,14 @@ relative_filename (file, dir)
 
   /* Build a sequence of "../" strings for the resulting relative file name. */
   i = 0;
+  while (*dp == '/')
+    ++dp;
   while ((dp = etags_strchr (dp + 1, '/')) != NULL)
-    i += 1;
+    {
+      i += 1;
+      while (*dp == '/')
+       ++dp;
+    }
   res = xnew (3*i + strlen (fp + 1) + 1, char);
   res[0] = '\0';
   while (i-- > 0)