To: vim-dev@vim.org Subject: patch 5.5.010 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.5.010 Problem: Ctags freed a memory block twice when exiting. When out of memory, a misleading error message was given. Solution: Update to ctags 3.3.2. Also fixes a few other problems. (Darren Hiebert) Files: src/ctags/* diff -cr ../vim-5.5.9/src/ctags/INSTALL src/ctags/INSTALL *** ../vim-5.5.9/src/ctags/INSTALL Wed Sep 22 10:06:15 1999 --- src/ctags/INSTALL Fri Sep 24 06:55:26 1999 *************** *** 5,15 **** autoconf, read the "Basic Installation" section below; then return here. The configure script in this package supports the following custom options: - --disable-external-sort Use this option to force use of an internal - sort algorithm. On UNIX-like systems, ctags - uses the sort utility of the operating system - by default because it is more memory efficient. - --disable-etags By default, "make install" will install one binary, "ctags", one man page, "ctags.1", and create links to these two files by the names --- 5,10 ---- *************** *** 25,30 **** --- 20,40 ---- default behavior of ctags to disable use of these extension flags (i.e. use the original tag file format). + + --disable-external-sort Use this option to force use of an internal + sort algorithm. On UNIX-like systems, ctags + uses the sort utility of the operating system + by default because it is more memory efficient. + + --enable-custom-config Defines a custom option configuration file to + establish site-wide defaults. Ctags will read + the following files at startup for options: + /etc/ctags.conf, /usr/local/etc/ctags.conf, + $HOME/.ctags, and .ctags. If you need a + different file, set this option to the full + path name of the file you want to be read, and + it will be read immediately before reading + $HOME/.ctags. --enable-macro-patterns By default, line numbers are used in the tag file for #define objects, in order to remain diff -cr ../vim-5.5.9/src/ctags/Makefile.bcc src/ctags/Makefile.bcc *** ../vim-5.5.9/src/ctags/Makefile.bcc Wed Sep 22 10:06:15 1999 --- src/ctags/Makefile.bcc Fri Sep 24 07:26:18 1999 *************** *** 17,25 **** # replace -1- with -2 to produce code for a 80286 or higher # replace -1- with -3 to produce code for a 80386 or higher # add -v for source debugging ! OPTIMIZE= -1- -Ox ! CFLAGS = -DMSDOS -mc -w-ccc -w-par -w-pia -w-rch -w-sus $(INC) LFLAGS = $(LIB) $(EXTRA) ctags.exe: $(SOURCES) respbcc --- 17,25 ---- # replace -1- with -2 to produce code for a 80286 or higher # replace -1- with -3 to produce code for a 80386 or higher # add -v for source debugging ! OPTIMIZE= -1- -O1 ! CFLAGS = -DMSDOS -mc -d -w-ccc -w-par -w-pia -w-rch -w-sus $(INC) LFLAGS = $(LIB) $(EXTRA) ctags.exe: $(SOURCES) respbcc diff -cr ../vim-5.5.9/src/ctags/NEWS src/ctags/NEWS *** ../vim-5.5.9/src/ctags/NEWS Wed Sep 22 10:06:15 1999 --- src/ctags/NEWS Fri Sep 24 07:28:54 1999 *************** *** 1,4 **** ! Current Version: 3.3 ctags-3.3 (Fri Sep 17 1999) * Fixed missing class-qualified tags [Java]. --- 1,16 ---- ! Current Version: 3.3.2 ! ! ctags-3.3.2 (Fri Sep 24 1999) ! * Fixed compile problem on AIX 4.1. ! * Improved recovery from syntax error [Fortran]. ! * Changed name of configure option (now --enable-custom-config). ! * Changed Makefile.bcc to optimize for space, since code size exceeded 64KB. ! ! ! ctags-3.3.1 (Mon Sep 20 1999) ! * Fixed segmentation violation occurring when directory recursion was selected. ! * Fixed misleading message when out of memory during internal sort. ! ctags-3.3 (Fri Sep 17 1999) * Fixed missing class-qualified tags [Java]. diff -cr ../vim-5.5.9/src/ctags/args.c src/ctags/args.c *** ../vim-5.5.9/src/ctags/args.c Wed Sep 22 10:06:15 1999 --- src/ctags/args.c Wed Sep 22 07:00:13 1999 *************** *** 1,5 **** /***************************************************************************** ! * $Id: args.c,v 8.9 1999/09/16 05:03:29 darren Exp $ * * Copyright (c) 1996-1999, Darren Hiebert * --- 1,5 ---- /***************************************************************************** ! * $Id: args.c,v 8.11 1999/09/22 05:00:13 darren Exp $ * * Copyright (c) 1996-1999, Darren Hiebert * *************** *** 209,215 **** return current->item; } ! extern const boolean argOff( current ) const Arguments* const current; { Assert(current != NULL); --- 209,215 ---- return current->item; } ! extern boolean argOff( current ) const Arguments* const current; { Assert(current != NULL); *************** *** 262,268 **** Arguments* const current; { Assert(current != NULL); ! if (current->type == ARG_STRING) free(current->item); memset(current, 0, sizeof(Arguments)); free(current); --- 262,268 ---- Arguments* const current; { Assert(current != NULL); ! if (current->type == ARG_STRING && current->item != NULL) free(current->item); memset(current, 0, sizeof(Arguments)); free(current); diff -cr ../vim-5.5.9/src/ctags/args.h src/ctags/args.h *** ../vim-5.5.9/src/ctags/args.h Wed Sep 22 10:06:15 1999 --- src/ctags/args.h Wed Sep 22 07:00:13 1999 *************** *** 1,5 **** /***************************************************************************** ! * $Id: args.h,v 8.6 1999/09/14 03:43:26 darren Exp $ * * Copyright (c) 1998-1999, Darren Hiebert * --- 1,5 ---- /***************************************************************************** ! * $Id: args.h,v 8.7 1999/09/22 05:00:13 darren Exp $ * * Copyright (c) 1998-1999, Darren Hiebert * *************** *** 48,54 **** extern Arguments* argNewFromArgv __ARGS((char* const* const argv)); extern Arguments* argNewFromFile __ARGS((FILE* const fp)); extern char *argItem __ARGS((const Arguments* const current)); ! extern const boolean argOff __ARGS((const Arguments* const current)); extern void argSetWordMode __ARGS((Arguments* const current)); extern void argSetLineMode __ARGS((Arguments* const current)); extern void argForth __ARGS((Arguments* const current)); --- 48,54 ---- extern Arguments* argNewFromArgv __ARGS((char* const* const argv)); extern Arguments* argNewFromFile __ARGS((FILE* const fp)); extern char *argItem __ARGS((const Arguments* const current)); ! extern boolean argOff __ARGS((const Arguments* const current)); extern void argSetWordMode __ARGS((Arguments* const current)); extern void argSetLineMode __ARGS((Arguments* const current)); extern void argForth __ARGS((Arguments* const current)); diff -cr ../vim-5.5.9/src/ctags/configure src/ctags/configure *** ../vim-5.5.9/src/ctags/configure Wed Sep 22 10:06:16 1999 --- src/ctags/configure Fri Sep 24 07:28:56 1999 *************** *** 16,22 **** ac_help="$ac_help --disable-external-sort use internal sort algorithm instead of sort program" ac_help="$ac_help ! --enable-custom-conf=FILE enable custom config file for site-wide defaults" ac_help="$ac_help --enable-macro-patterns use patterns as default method to locate macros --- 16,22 ---- ac_help="$ac_help --disable-external-sort use internal sort algorithm instead of sort program" ac_help="$ac_help ! --enable-custom-config=FILE enable custom config file for site-wide defaults" ac_help="$ac_help --enable-macro-patterns use patterns as default method to locate macros *************** *** 540,546 **** ! echo 'Exuberant Ctags, version 3.3' uname -mrsv 2>/dev/null --- 540,546 ---- ! echo 'Exuberant Ctags, version 3.3.2' uname -mrsv 2>/dev/null *************** *** 564,572 **** fi ! # Check whether --enable-custom-conf or --disable-custom-conf was given. ! if test "${enable_custom_conf+set}" = set; then ! enableval="$enable_custom_conf" : fi --- 564,572 ---- fi ! # Check whether --enable-custom-config or --disable-custom-config was given. ! if test "${enable_custom_config+set}" = set; then ! enableval="$enable_custom_config" : fi *************** *** 615,628 **** fi ! if test "$enable_custom_conf" = no -o "$enable_custom_conf" = yes ; then echo "$ac_t""no name supplied for custom configuration file" 1>&6 ! elif test -n "$enable_custom_conf" ; then cat >> confdefs.h <&6 fi if test "$enable_macro_patterns" = yes ; then --- 615,628 ---- fi ! if test "$enable_custom_config" = no -o "$enable_custom_config" = yes ; then echo "$ac_t""no name supplied for custom configuration file" 1>&6 ! elif test -n "$enable_custom_config" ; then cat >> confdefs.h <&6 fi if test "$enable_macro_patterns" = yes ; then diff -cr ../vim-5.5.9/src/ctags/configure.in src/ctags/configure.in *** ../vim-5.5.9/src/ctags/configure.in Wed Sep 22 10:06:16 1999 --- src/ctags/configure.in Fri Sep 24 07:28:54 1999 *************** *** 1,4 **** ! dnl $Id: configure.in,v 8.4 1999/09/11 17:54:22 darren Exp $ dnl Copyright (c) 1996-1999, Darren Hiebert dnl --- 1,4 ---- ! dnl $Id: configure.in,v 8.5 1999/09/24 04:59:51 darren Exp $ dnl Copyright (c) 1996-1999, Darren Hiebert dnl *************** *** 13,19 **** dnl Report system info dnl ------------------ ! echo 'Exuberant Ctags, version 3.3' uname -mrsv 2>/dev/null dnl Define convenience macros --- 13,19 ---- dnl Report system info dnl ------------------ ! echo 'Exuberant Ctags, version 3.3.2' uname -mrsv 2>/dev/null dnl Define convenience macros *************** *** 46,53 **** [ --disable-external-sort use internal sort algorithm instead of sort program],, enable_external_sort=yes) ! AC_ARG_ENABLE(custom-conf, ! [ --enable-custom-conf=FILE enable custom config file for site-wide defaults]) AC_ARG_ENABLE(macro-patterns, --- 46,53 ---- [ --disable-external-sort use internal sort algorithm instead of sort program],, enable_external_sort=yes) ! AC_ARG_ENABLE(custom-config, ! [ --enable-custom-config=FILE enable custom config file for site-wide defaults]) AC_ARG_ENABLE(macro-patterns, *************** *** 81,91 **** fi AC_SUBST(install_targets) ! if test "$enable_custom_conf" = no -o "$enable_custom_conf" = yes ; then AC_MSG_RESULT(no name supplied for custom configuration file) ! elif test -n "$enable_custom_conf" ; then ! AC_DEFINE_UNQUOTED(CUSTOM_CONFIGURATION_FILE, "$enable_custom_conf") ! AC_MSG_RESULT($enable_custom_conf will be used as custom configuration file) fi if test "$enable_macro_patterns" = yes ; then --- 81,91 ---- fi AC_SUBST(install_targets) ! if test "$enable_custom_config" = no -o "$enable_custom_config" = yes ; then AC_MSG_RESULT(no name supplied for custom configuration file) ! elif test -n "$enable_custom_config" ; then ! AC_DEFINE_UNQUOTED(CUSTOM_CONFIGURATION_FILE, "$enable_custom_config") ! AC_MSG_RESULT($enable_custom_config will be used as custom configuration file) fi if test "$enable_macro_patterns" = yes ; then diff -cr ../vim-5.5.9/src/ctags/ctags.1 src/ctags/ctags.1 *** ../vim-5.5.9/src/ctags/ctags.1 Wed Sep 22 10:06:16 1999 --- src/ctags/ctags.1 Fri Sep 24 07:28:54 1999 *************** *** 1,4 **** ! .TH CTAGS 1 "Version 3.3" "Darren Hiebert" .SH NAME --- 1,4 ---- ! .TH CTAGS 1 "Version 3.3.2" "Darren Hiebert" .SH NAME diff -cr ../vim-5.5.9/src/ctags/ctags.h src/ctags/ctags.h *** ../vim-5.5.9/src/ctags/ctags.h Wed Sep 22 10:06:16 1999 --- src/ctags/ctags.h Fri Sep 24 07:28:54 1999 *************** *** 22,28 **** = General defines ============================================================================*/ #ifndef PROGRAM_VERSION ! # define PROGRAM_VERSION "3.3" #endif #define PROGRAM_NAME "Exuberant Ctags" #define PROGRAM_URL "http://darren.hiebert.com/ctags/" --- 22,28 ---- = General defines ============================================================================*/ #ifndef PROGRAM_VERSION ! # define PROGRAM_VERSION "3.3.2" #endif #define PROGRAM_NAME "Exuberant Ctags" #define PROGRAM_URL "http://darren.hiebert.com/ctags/" diff -cr ../vim-5.5.9/src/ctags/ctags.lsm src/ctags/ctags.lsm *** ../vim-5.5.9/src/ctags/ctags.lsm Wed Sep 22 10:06:16 1999 --- src/ctags/ctags.lsm Fri Sep 24 07:28:54 1999 *************** *** 1,7 **** Begin3 Title: Exuberant Ctags ! Version: 3.3 ! Entered-date: 17SEP99 Description: A better ctags with support for C, C++, Eiffel, Fortran and Java. It is capable of generating tags for all of the following language constructs: --- 1,7 ---- Begin3 Title: Exuberant Ctags ! Version: 3.3.2 ! Entered-date: 24SEP99 Description: A better ctags with support for C, C++, Eiffel, Fortran and Java. It is capable of generating tags for all of the following language constructs: *************** *** 26,36 **** tool utility source index Author: darren@hiebert.com (Darren Hiebert) Primary-site: sunsite.unc.edu /pub/Linux/devel/lang/c ! 133kB ctags-3.3.tar.gz Alternate-site: ftp://ftp.revnet.com/pub/ctags ! 133kB ctags-3.3.tar.gz Original-site: http://darren.hiebert.com/ctags ! 133kB archives/ctags-3.3.tar.gz Platforms: UNIX, MSDOS, Windows 95/NT, OS/2, QNX, Amiga, QDOS, VMS Copying-policy: GNU General Public License End --- 26,36 ---- tool utility source index Author: darren@hiebert.com (Darren Hiebert) Primary-site: sunsite.unc.edu /pub/Linux/devel/lang/c ! 133kB ctags-3.3.2.tar.gz Alternate-site: ftp://ftp.revnet.com/pub/ctags ! 133kB ctags-3.3.2.tar.gz Original-site: http://darren.hiebert.com/ctags ! 133kB archives/ctags-3.3.2.tar.gz Platforms: UNIX, MSDOS, Windows 95/NT, OS/2, QNX, Amiga, QDOS, VMS Copying-policy: GNU General Public License End diff -cr ../vim-5.5.9/src/ctags/fortran.c src/ctags/fortran.c *** ../vim-5.5.9/src/ctags/fortran.c Wed Sep 22 10:06:17 1999 --- src/ctags/fortran.c Thu Sep 23 05:36:38 1999 *************** *** 1,5 **** /***************************************************************************** ! * $Id: fortran.c,v 8.8 1999/09/17 06:32:39 darren Exp $ * * Copyright (c) 1998-1999, Darren Hiebert * --- 1,5 ---- /***************************************************************************** ! * $Id: fortran.c,v 8.9 1999/09/23 03:36:38 darren Exp $ * * Copyright (c) 1998-1999, Darren Hiebert * *************** *** 786,792 **** --- 786,795 ---- token->type = TOKEN_OPERATOR; } else + { + ungetChar(c); token->type = TOKEN_UNDEFINED; + } break; case ':': diff -cr ../vim-5.5.9/src/ctags/main.c src/ctags/main.c *** ../vim-5.5.9/src/ctags/main.c Wed Sep 22 10:06:17 1999 --- src/ctags/main.c Tue Sep 21 03:51:16 1999 *************** *** 1,5 **** /***************************************************************************** ! * $Id: main.c,v 8.20 1999/09/17 07:34:00 darren Exp $ * * Copyright (c) 1996-1999, Darren Hiebert * --- 1,5 ---- /***************************************************************************** ! * $Id: main.c,v 8.21 1999/09/21 01:51:16 darren Exp $ * * Copyright (c) 1996-1999, Darren Hiebert * *************** *** 196,202 **** static boolean createTagsFromListFile __ARGS((const char* const fileName)); static boolean createTagsForArgs __ARGS((cookedArgs* const args)); static void printTotals __ARGS((const clock_t *const timeStamps)); - static boolean areFilesAvailable __ARGS((cookedArgs* args)); static void makeTags __ARGS((cookedArgs* arg)); static void setExecutableName __ARGS((const char *const path)); --- 196,201 ---- *************** *** 265,271 **** void *buffer = malloc(size); if (buffer == NULL) ! error(FATAL | PERROR, "out of memory"); return buffer; } --- 264,270 ---- void *buffer = malloc(size); if (buffer == NULL) ! error(FATAL, "out of memory"); return buffer; } *************** *** 277,283 **** void *buffer = realloc(ptr, size); if (buffer == NULL) ! error(FATAL | PERROR, "out of memory"); return buffer; } --- 276,282 ---- void *buffer = realloc(ptr, size); if (buffer == NULL) ! error(FATAL, "out of memory"); return buffer; } *************** *** 946,977 **** #endif } - static boolean areFilesAvailable( args ) - cookedArgs* args; - { - return (boolean)(Option.filter || Option.fileList != NULL || !cArgOff(args)); - } - static void makeTags( args ) cookedArgs* args; { boolean resize = FALSE; clock_t timeStamps[3]; - if (! areFilesAvailable(args)) - { - if (Option.recurse) - { - Assert(cArgOff(args)); - cArgDelete(args); - args = cArgNewFromString("."); - } - else - error(FATAL, "No files specified. Try \"%s --help\".", - getExecutableName()); - } #define timeStamp(n) timeStamps[(n)] = (Option.printTotals ? clock():(clock_t)0) - if (! Option.filter) openTagFile(); --- 945,958 ---- #endif } static void makeTags( args ) cookedArgs* args; { boolean resize = FALSE; + boolean files = FALSE; clock_t timeStamps[3]; #define timeStamp(n) timeStamps[(n)] = (Option.printTotals ? clock():(clock_t)0) if (! Option.filter) openTagFile(); *************** *** 979,1001 **** if (! cArgOff(args)) { if (Option.verbose) printf("Reading command line arguments\n"); resize = createTagsForArgs(args); } - if (Option.fileList != NULL) { if (Option.verbose) printf("Reading list file\n"); resize = (boolean)(createTagsFromListFile(Option.fileList) || resize); } - if (Option.filter) { if (Option.verbose) ! printf("Reading filter input"); resize = (boolean)(createTagsFromFileInput(stdin, TRUE) || resize); } /******/ timeStamp(1); --- 960,995 ---- if (! cArgOff(args)) { + files = TRUE; if (Option.verbose) printf("Reading command line arguments\n"); resize = createTagsForArgs(args); } if (Option.fileList != NULL) { + files = TRUE; if (Option.verbose) printf("Reading list file\n"); resize = (boolean)(createTagsFromListFile(Option.fileList) || resize); } if (Option.filter) { + files = TRUE; if (Option.verbose) ! printf("Reading filter input\n"); resize = (boolean)(createTagsFromFileInput(stdin, TRUE) || resize); + } + if (! files) + { + if (Option.recurse) + { + cookedArgs* const dot = cArgNewFromString("."); + resize = createTagsForArgs(dot); + cArgDelete(dot); + } + else + error(FATAL, "No files specified. Try \"%s --help\".", + getExecutableName()); } /******/ timeStamp(1); diff -cr ../vim-5.5.9/src/ctags/sort.c src/ctags/sort.c *** ../vim-5.5.9/src/ctags/sort.c Wed Sep 22 10:06:17 1999 --- src/ctags/sort.c Tue Sep 21 03:31:00 1999 *************** *** 1,5 **** /***************************************************************************** ! * $Id: sort.c,v 8.5 1999/09/17 07:00:10 darren Exp $ * * Copyright (c) 1996-1999, Darren Hiebert * --- 1,5 ---- /***************************************************************************** ! * $Id: sort.c,v 8.6 1999/09/21 01:31:00 darren Exp $ * * Copyright (c) 1996-1999, Darren Hiebert * *************** *** 31,37 **** = Function prototypes ============================================================================*/ #ifndef EXTERNAL_SORT ! static void failedSort __ARGS((FILE *const fp)); static int compareTags __ARGS((const void *const one, const void *const two)); static void writeSortedTags __ARGS((char **const table, const size_t numTags, const boolean toStdout)); #endif --- 31,37 ---- = Function prototypes ============================================================================*/ #ifndef EXTERNAL_SORT ! static void failedSort __ARGS((FILE *const fp, const char* msg)); static int compareTags __ARGS((const void *const one, const void *const two)); static void writeSortedTags __ARGS((char **const table, const size_t numTags, const boolean toStdout)); #endif *************** *** 108,119 **** * so have lots of memory if you have large tag files. *--------------------------------------------------------------------------*/ ! static void failedSort( fp ) FILE *const fp; { if (fp != NULL) fclose(fp); ! error(FATAL | PERROR, "cannot sort tag file"); } static int compareTags( one, two ) --- 108,124 ---- * so have lots of memory if you have large tag files. *--------------------------------------------------------------------------*/ ! static void failedSort( fp, msg ) FILE *const fp; + const char* msg; { + const char* const cannotSort = "cannot sort tag file"; if (fp != NULL) fclose(fp); ! if (msg == NULL) ! error(FATAL | PERROR, cannotSort); ! else ! error(FATAL, "%s: %s", msg, cannotSort); } static int compareTags( one, two ) *************** *** 142,148 **** { fp = fopen(tagFileName(), "w"); if (fp == NULL) ! failedSort(fp); } for (i = 0 ; i < numTags ; ++i) { --- 147,153 ---- { fp = fopen(tagFileName(), "w"); if (fp == NULL) ! failedSort(fp, NULL); } for (i = 0 ; i < numTags ; ++i) { *************** *** 151,157 **** */ if (i == 0 || Option.xref || strcmp(table[i], table[i-1]) != 0) if (fputs(table[i], fp) == EOF) ! failedSort(fp); } if (toStdout) fflush(fp); --- 156,162 ---- */ if (i == 0 || Option.xref || strcmp(table[i], table[i-1]) != 0) if (fputs(table[i], fp) == EOF) ! failedSort(fp, NULL); } if (toStdout) fflush(fp); *************** *** 175,194 **** DebugStatement( size_t mallocSize = tableSize; ) /* cumulative total */ if (table == NULL) ! failedSort(fp); /* Open the tag file and place its lines into allocated buffers. */ fp = fopen(tagFileName(), "r"); if (fp == NULL) ! failedSort(fp); for (i = 0 ; i < numTags && ! feof(fp) ; ) { line = readLine(vLine, fp); if (line == NULL) { if (! feof(fp)) ! failedSort(fp); break; } else if (*line == '\0' || strcmp(line, "\n") == 0) --- 180,199 ---- DebugStatement( size_t mallocSize = tableSize; ) /* cumulative total */ if (table == NULL) ! failedSort(fp, "out of memory"); /* Open the tag file and place its lines into allocated buffers. */ fp = fopen(tagFileName(), "r"); if (fp == NULL) ! failedSort(fp, NULL); for (i = 0 ; i < numTags && ! feof(fp) ; ) { line = readLine(vLine, fp); if (line == NULL) { if (! feof(fp)) ! failedSort(fp, NULL); break; } else if (*line == '\0' || strcmp(line, "\n") == 0) *************** *** 199,205 **** table[i] = (char *)malloc(stringSize); if (table[i] == NULL) ! failedSort(fp); DebugStatement( mallocSize += stringSize; ) strcpy(table[i], line); ++i; --- 204,210 ---- table[i] = (char *)malloc(stringSize); if (table[i] == NULL) ! failedSort(fp, "out of memory"); DebugStatement( mallocSize += stringSize; ) strcpy(table[i], line); ++i; *** ../vim-5.5.9/src/version.c Sun Sep 26 14:24:09 1999 --- src/version.c Tue Sep 28 21:26:26 1999 *************** *** 420,420 **** --- 420,421 ---- { /* Add new patch number below this line */ + 10, -- hundred-and-one symptoms of being an internet addict: 198. You read all the quotes at Netaholics Anonymous and keep thinking "What's wrong with that?" --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\-- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /