resolves: bz 799643

This commit is contained in:
Neil Horman 2012-03-05 14:35:22 -05:00
parent e26dff6c0f
commit 3eedd0b4fe
2 changed files with 96 additions and 73 deletions

View File

@ -1,6 +1,19 @@
--- cscope-15.6/src/display.c.orig 2006-09-30 04:13:00.000000000 -0400 diff -up ./src/constants.h.orig ./src/constants.h
+++ cscope-15.6/src/display.c 2007-05-25 10:15:14.000000000 -0400 --- ./src/constants.h.orig 2012-03-05 14:05:26.468554970 -0500
@@ -113,6 +113,7 @@ +++ ./src/constants.h 2012-03-05 14:04:40.606295032 -0500
@@ -101,7 +101,7 @@
#define REGEXP 6
#define FILENAME 7
#define INCLUDES 8
-#define FIELDS 9
+#define FIELDS 11
#if (BSD || V9) && !__NetBSD__ && !__FreeBSD__
# define TERMINFO 0 /* no terminfo curses */
diff -up ./src/display.c.orig ./src/display.c
--- ./src/display.c.orig 2012-03-05 14:05:26.479555276 -0500
+++ ./src/display.c 2012-03-05 14:04:40.605295003 -0500
@@ -113,6 +113,7 @@ static struct { /* text of input fields
{"Find this", "file", findfile}, {"Find this", "file", findfile},
{"Find", "files #including this file", findinclude}, {"Find", "files #including this file", findinclude},
{"Find all", "function definitions", findallfcns}, /* samuel only */ {"Find all", "function definitions", findallfcns}, /* samuel only */
@ -8,19 +21,10 @@
}; };
/* Internal prototypes: */ /* Internal prototypes: */
--- cscope-15.6/src/global.h.orig 2006-09-30 04:13:00.000000000 -0400 diff -up ./src/find.c.orig ./src/find.c
+++ cscope-15.6/src/global.h 2007-05-25 10:15:14.000000000 -0400 --- ./src/find.c.orig 2012-03-05 14:05:26.475555165 -0500
@@ -327,6 +327,7 @@ +++ ./src/find.c 2012-03-05 14:04:57.661762442 -0500
char *findfile(char *dummy); @@ -79,6 +79,8 @@ static char *lcasify(char *s);
char *findinclude(char *pattern);
char *findsymbol(char *pattern);
+char *findassign(char *pattern);
char *findregexp(char *egreppat);
char *findstring(char *pattern);
char *inviewpath(char *file);
--- cscope-15.6/src/find.c.orig 2006-09-30 04:13:00.000000000 -0400
+++ cscope-15.6/src/find.c 2007-05-25 10:15:27.000000000 -0400
@@ -79,6 +79,8 @@
static void findcalledbysub(char *file, BOOL macro); static void findcalledbysub(char *file, BOOL macro);
static void findterm(char *pattern); static void findterm(char *pattern);
static void putline(FILE *output); static void putline(FILE *output);
@ -29,7 +33,7 @@
static void putpostingref(POSTING *p, char *pat); static void putpostingref(POSTING *p, char *pat);
static void putref(int seemore, char *file, char *func); static void putref(int seemore, char *file, char *func);
static void putsource(int seemore, FILE *output); static void putsource(int seemore, FILE *output);
@@ -88,6 +90,77 @@ @@ -88,6 +90,77 @@ static void putsource(int seemore, FILE
char * char *
findsymbol(char *pattern) findsymbol(char *pattern)
{ {
@ -52,51 +56,51 @@
+ * assignment or not Do this by examining the next character + * assignment or not Do this by examining the next character
+ * or two in blockp */ + * or two in blockp */
+ char *asgn_char = blockp; + char *asgn_char = blockp;
+ int i = 1; /*skip any leading \n*/ + unsigned int i = 0;
+ +
+ while(1) { + while (isspace((unsigned char) asgn_char[i])) {
+ if (asgn_char[i] == blockmark) { + /* skip any whitespace or \n */
+ /* get the next block when we reach the end of + i++;
+ * the current block */ + }
+ asgn_char = read_block(); + if (asgn_char[i] == '\0') {
+ i=0; + /* get the next block when we reach the end of
+ } + * the current block */
+ while (isspace((unsigned char) asgn_char[i])) { + asgn_char = read_block();
+ /* skip any whitespace or \n */ + if (asgn_char == NULL) return NO;
+ i++; + i=0;
+ } + }
+ /* this next character better be one of the assignment +
+ * characters, ie: =, +=, -=, *=, %=, /=, &=, |=, ^=, + /* this next character better be one of the assignment
+ * ~= if not, then its a notmatched case */ + * characters, ie: =, +=, -=, *=, %=, /=, &=, |=, ^=,
+ if ((asgn_char[i] != '=') && + * ~= if not, then its a notmatched case */
+ (asgn_char[i] != '+') && + if ((asgn_char[i] != '=') &&
+ (asgn_char[i] != '-') && + (asgn_char[i] != '+') &&
+ (asgn_char[i] != '*') && + (asgn_char[i] != '-') &&
+ (asgn_char[i] != '/') && + (asgn_char[i] != '*') &&
+ (asgn_char[i] != '%') && + (asgn_char[i] != '/') &&
+ (asgn_char[i] != '&') && + (asgn_char[i] != '%') &&
+ (asgn_char[i] != '|') && + (asgn_char[i] != '&') &&
+ (asgn_char[i] != '^') && + (asgn_char[i] != '|') &&
+ (asgn_char[i] != '~')) { + (asgn_char[i] != '^') &&
+ return NO; + (asgn_char[i] != '~')) {
+ } else { + return NO;
+ /* if the first found character is = and the + } else {
+ * next found character is also =, then this + /* if the first found character is = and the
+ * is not an assignment. likewise if the + * next found character is also =, then this
+ * first character is not = (i.e. one of the + * is not an assignment. likewise if the
+ * +,-,*,etc. chars and the next character is + * first character is not = (i.e. one of the
+ * not =, then this is not an assignment */ + * +,-,*,etc. chars and the next character is
+ if ((((asgn_char[i] == '=') + * not =, then this is not an assignment */
+ && (asgn_char[i+1] == '='))) + if ((((asgn_char[i] == '=')
+ || ((asgn_char[i] != '=') + && (asgn_char[i+1] == '=')))
+ || ((asgn_char[i] != '=')
+ && (asgn_char[i+1] != '='))) { + && (asgn_char[i+1] != '='))) {
+ return NO; + return NO;
+ } + }
+ /* if we pass all these filters then this is + /* if we pass all these filters then this is
+ * an assignment */ + * an assignment */
+ return YES; + return YES;
+ } /* else(operator char?) */ + } /* else(operator char?) */
+ } /* while(endless) */
+} +}
+ +
+ /* The actual routine that does the work for findsymbol() and + /* The actual routine that does the work for findsymbol() and
@ -107,7 +111,7 @@
char file[PATHLEN + 1]; /* source file name */ char file[PATHLEN + 1]; /* source file name */
char function[PATLEN + 1]; /* function name */ char function[PATLEN + 1]; /* function name */
char macro[PATLEN + 1]; /* macro name */ char macro[PATLEN + 1]; /* macro name */
@@ -249,6 +322,14 @@ @@ -249,6 +322,14 @@ findsymbol(char *pattern)
if (matchrest()) { if (matchrest()) {
s = NULL; s = NULL;
matched: matched:
@ -122,14 +126,30 @@
/* output the file, function or macro, and source line */ /* output the file, function or macro, and source line */
if (strcmp(macro, global) && s != macro) { if (strcmp(macro, global) && s != macro) {
putref(0, file, macro); putref(0, file, macro);
--- cscope-15.6/src/constants.h.orig 2006-09-30 04:13:00.000000000 -0400 @@ -260,11 +341,12 @@ findsymbol(char *pattern)
+++ cscope-15.6/src/constants.h 2007-05-25 10:15:14.000000000 -0400 else {
@@ -101,7 +101,7 @@ putref(0, file, global);
#define REGEXP 6 }
#define FILENAME 7 - if (blockp == NULL) {
#define INCLUDES 8 - return NULL;
-#define FIELDS 9 - }
+#define FIELDS 11 }
notmatched:
#if (BSD || V9) && !__NetBSD__ && !__FreeBSD__ + if (blockp == NULL) {
# define TERMINFO 0 /* no terminfo curses */ + return NULL;
+ }
+ fcndef = NO;
cp = blockp;
}
}
diff -up ./src/global.h.orig ./src/global.h
--- ./src/global.h.orig 2012-03-05 14:05:26.471555052 -0500
+++ ./src/global.h 2012-03-05 14:04:40.605295003 -0500
@@ -343,6 +343,7 @@ char *finddef(char *pattern);
char *findfile(char *dummy);
char *findinclude(char *pattern);
char *findsymbol(char *pattern);
+char *findassign(char *pattern);
char *findregexp(char *egreppat);
char *findstring(char *pattern);
char *inviewpath(char *file);

View File

@ -1,7 +1,7 @@
Summary: C source code tree search and browse tool Summary: C source code tree search and browse tool
Name: cscope Name: cscope
Version: 15.7a Version: 15.7a
Release: 8%{?dist} Release: 9%{?dist}
Source0: http://unc.dl.sourceforge.net/sourceforge/cscope/cscope-15.7a.tar.bz2 Source0: http://unc.dl.sourceforge.net/sourceforge/cscope/cscope-15.7a.tar.bz2
URL: http://cscope.sourceforge.net URL: http://cscope.sourceforge.net
License: BSD and GPLv2+ License: BSD and GPLv2+
@ -93,6 +93,9 @@ rm -f %{emacs_lisp_path}/xcscope.el
rm -f %{vim_plugin_path}/cctree.vim rm -f %{vim_plugin_path}/cctree.vim
%changelog %changelog
* Mon Mar 05 2012 Neil Horman <nhorman@redhat.com> 15.7a-9
- Fixed a segfault in the symbol assignment search (bz 799643)
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 15.7a-8 * Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 15.7a-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild