-
Notifications
You must be signed in to change notification settings - Fork 4
/
elvis-2.2_0.patch
75 lines (69 loc) · 1.86 KB
/
elvis-2.2_0.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* With this patch, elvis doesn't sort the output of global(1).
*
* This file is placed into the public domain by the author,
* Shigio Yamaguchi <[email protected]>
*/
diff -c elvis-2.2_0-org/main.c elvis-2.2_0/main.c
*** elvis-2.2_0-org/main.c Tue Oct 21 11:32:25 2003
--- elvis-2.2_0/main.c Fri Dec 9 22:02:58 2011
***************
*** 808,813 ****
--- 808,820 ----
/* Execute the initialization buffer (which may create some windows) */
doexrc();
+ /* Not to sort tag-list generated by global(1) */
+ if (o_tagprg) {
+ if (!strncmp(o_tagprg, "elvis-global ", strlen("elvis-global ")) ||
+ !strncmp(o_tagprg, "global ", strlen("global ")))
+ usegtags = 1;
+ }
+
/* Load the verbose messages, plus a few others */
if (((lc = getenv("LC_ALL")) != NULL && *lc)
|| ((lc = getenv("LC_MESSAGES")) != NULL && *lc)
diff -c elvis-2.2_0-org/tag.c elvis-2.2_0/tag.c
*** elvis-2.2_0-org/tag.c Tue Oct 21 11:32:25 2003
--- elvis-2.2_0/tag.c Fri Dec 9 20:56:59 2011
***************
*** 22,27 ****
--- 22,31 ----
*/
TAG *taglist;
+ /* For GNU GLOBAL */
+ TAG *taglast;
+ int usegtags;
+
/* Tag comparison function, returns non-zero if t1 should be inserted before t2.
*/
static ELVBOOL tagbefore(t1, t2)
***************
*** 170,175 ****
--- 174,190 ----
TAG *tag;
{
TAG *scan;
+
+ /* Don't sort global's output */
+ if (usegtags) {
+ if (!taglist) {
+ taglist = taglast = tag;
+ } else {
+ taglast->next = tag;
+ taglast = tag;
+ }
+ return;
+ }
/* if empty list, this is easy */
if (!taglist)
diff -c elvis-2.2_0-org/tag.h elvis-2.2_0/tag.h
*** elvis-2.2_0-org/tag.h Tue Oct 21 11:32:25 2003
--- elvis-2.2_0/tag.h Fri Dec 9 20:53:36 2011
***************
*** 28,33 ****
--- 28,34 ----
extern char *tagattrname[MAXATTR];
extern TAG *taglist;
+ extern int usegtags;
extern ELVBOOL tagforward;
BEGIN_EXTERNC