[cscope/f16] Resolves: bz829953

Neil Horman nhorman at fedoraproject.org
Tue Jul 10 20:20:13 UTC 2012


commit dd751f4a2ce45ca39cfac12f26c100aa5fffbc6d
Author: Neil Horman <nhorman at tuxdriver.com>
Date:   Tue Jul 10 16:19:57 2012 -0400

    Resolves: bz829953

 cscope-invindex-sizing.patch |   45 ++++++++++++++++++++++++++++++++++++++++++
 cscope.spec                  |    8 ++++++-
 2 files changed, 52 insertions(+), 1 deletions(-)
---
diff --git a/cscope-invindex-sizing.patch b/cscope-invindex-sizing.patch
new file mode 100644
index 0000000..b84aed2
--- /dev/null
+++ b/cscope-invindex-sizing.patch
@@ -0,0 +1,45 @@
+diff -u -r1.20 invlib.c
+--- src/invlib.c	12 Mar 2012 17:57:55 -0000	1.20
++++ src/invlib.c	10 Jul 2012 19:57:51 -0000
+@@ -169,8 +169,8 @@
+ 	numpost = 1;
+ 
+ 	/* set up as though a block had come and gone, i.e., set up for new block  */
+-	/* FIXME HBB: magic number alert (16) */
+-	amtused = 16; /* leave no space - init 3 words + one for luck */
++	/* 3 longs needed for: numinvitems, next block, and previous block */
++	amtused = 3 * sizeof(long);
+ 	numinvitems = 0;
+ 	numlogblk = 0;
+ 	lastinblk = sizeof(t_logicalblk);
+@@ -371,8 +371,10 @@
+ 	zipf[0]++;
+ #endif
+     len = strlen(thisterm);
++    /* length of term rounded up to long boundary */
+     wdlen = (len + (sizeof(long) - 1)) / sizeof(long);
+-    /* HBB FIXME 20060419: magic number: 3 */
++    /* each term needs 2 longs for its iteminfo and
++     * 1 long for its offset */
+     numwilluse = (wdlen + 3) * sizeof(long);
+     /* new block if at least 1 item in block */
+     if (numinvitems && numwilluse + amtused > sizeof(t_logicalblk)) {
+@@ -435,7 +437,8 @@
+ 	    invcannotwrite(indexfile);
+ 	    return(0);
+ 	}
+-	amtused = 16;
++	/* 3 longs needed for: numinvitems, next block, and previous block */
++	amtused = 3 * sizeof(long);
+ 	numlogblk++;
+ 	/* check if had to back up, if so do it */
+ 	if (backupflag) {
+@@ -468,7 +471,7 @@
+ 	    while (tptr3 > tptr)
+ 		*--tptr2 = *--tptr3;
+ 	    lastinblk -= j;
+-	    amtused += (8 * backupflag + j);
++	    amtused += ((2 * sizeof(long)) * backupflag + j);
+ 	    for (i = 3; i < (backupflag * 2 + 2); i += 2) {
+ 		iteminfo.packword[0] = logicalblk.invblk[i];
+ 		iteminfo.e.offset += (tptr2 - tptr3);
diff --git a/cscope.spec b/cscope.spec
index 7a5bbb3..5394456 100644
--- a/cscope.spec
+++ b/cscope.spec
@@ -1,7 +1,7 @@
 Summary: C source code tree search and browse tool 
 Name: cscope
 Version: 15.8
-Release: 1%{?dist}
+Release: 2%{?dist}
 Source0: https://downloads.sourceforge.net/project/%{name}/%{name}/%{version}/%{name}-%{version}.tar.bz2
 URL: http://cscope.sourceforge.net
 License: BSD and GPLv2+
@@ -15,6 +15,8 @@ Requires: emacs-filesystem xemacs-filesystem
 %define emacs_lisp_path %{_datadir}/emacs/site-lisp
 %define vim_plugin_path %{_datadir}/vim/vimfiles/plugin
 
+Patch0: cscope-invindex-sizing.patch
+
 %description
 cscope is a mature, ncurses based, C source code tree browsing tool.  It 
 allows users to search large source code bases for variables, functions,
@@ -24,6 +26,7 @@ matches for use in file editing.
 
 %prep
 %setup -q
+%patch0 -p0
 
 %build
 %configure
@@ -80,6 +83,9 @@ rm -f %{emacs_lisp_path}/xcscope.el
 rm -f %{vim_plugin_path}/cctree.vim
 
 %changelog
+* Tue Jul 10 2012 Neil Horman <nhorman at redhat.com> - 15.8-2
+- Fix inverted index sizing
+
 * Mon Jun 18 2012 Neil Horman <nhorman at redhat.com> - 15.8
 - Updated to latest upstream
 


More information about the scm-commits mailing list