summaryrefslogtreecommitdiff
blob: a6e2822322232698144aee953efd602287c87c0a (plain)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
Revision: da62cad10eda55aa233ac124273f3db4f541137a
Parent:   65bcb8cf8b32f68a5b48629b328f6d65979e58df
Author:   Thomas Moschny <thomas.moschny@gmx.de>
Date:     07.05.2011 13:32:06
Branch:   net.venge.monotone

Changelog: 

* src/rcs_file.cc: Rename struct "file_handle" to "rcs_file_handle"
  to avoid a name clash with a struct of same name defined by newer
  glibc's "fcntl.h". For aesthetic reasons, also rename struct
  "file_source".

References:
https://code.monotone.ca/p/monotone/source/commit/da62cad10eda55aa233ac124273f3db4f541137a/
https://bugs.gentoo.org/396651

============================================================
--- src/rcs_file.cc	885b3fbe7b6cfed78816f0e57cd71d44616213c6
+++ src/rcs_file.cc	03cf68912a4a708545ebce3d415c0e970ddead0b
@@ -42,12 +42,12 @@ struct
 
 #ifdef HAVE_MMAP
 struct
-file_handle
+rcs_file_handle
 {
   string const & filename;
   off_t length;
   int fd;
-  file_handle(string const & fn) :
+  rcs_file_handle(string const & fn) :
     filename(fn),
     length(0),
     fd(-1)
@@ -60,13 +60,13 @@ file_handle
       if (fd == -1)
         throw oops("open of " + filename + " failed");
     }
-  ~file_handle()
+  ~rcs_file_handle()
     {
       if (close(fd) == -1)
         throw oops("close of " + filename + " failed");
     }
 };
-struct file_source
+struct rcs_file_source
 {
   string const & filename;
   int fd;
@@ -91,7 +91,7 @@ struct file_source
       ++pos;
     return good();
   }
-  file_source(string const & fn,
+  rcs_file_source(string const & fn,
               int f,
               off_t len) :
     filename(fn),
@@ -104,7 +104,7 @@ struct file_source
     if (mapping == MAP_FAILED)
       throw oops("mmap of " + filename + " failed");
   }
-  ~file_source()
+  ~rcs_file_source()
   {
     if (munmap(mapping, length) == -1)
       throw oops("munmapping " + filename + " failed, after reading RCS file");
@@ -112,12 +112,12 @@ struct
 };
 #elif defined(WIN32)
 struct
-file_handle
+rcs_file_handle
 {
   string const & filename;
   off_t length;
   HANDLE fd;
-  file_handle(string const & fn) :
+  rcs_file_handle(string const & fn) :
     filename(fn),
     length(0),
     fd(NULL)
@@ -134,7 +134,7 @@ file_handle
       if (fd == NULL)
         throw oops("open of " + filename + " failed");
     }
-  ~file_handle()
+  ~rcs_file_handle()
     {
       if (CloseHandle(fd)==0)
         throw oops("close of " + filename + " failed");
@@ -142,7 +142,7 @@ struct
 };
 
 struct
-file_source
+rcs_file_source
 {
   string const & filename;
   HANDLE fd,map;
@@ -167,7 +167,7 @@ file_source
       ++pos;
     return good();
   }
-  file_source(string const & fn,
+  rcs_file_source(string const & fn,
               HANDLE f,
               off_t len) :
     filename(fn),
@@ -183,7 +183,7 @@ file_source
     if (mapping==NULL)
       throw oops("MapViewOfFile of " + filename + " failed");
   }
-  ~file_source()
+  ~rcs_file_source()
   {
     if (UnmapViewOfFile(mapping)==0)
       throw oops("UnmapViewOfFile of " + filename + " failed");
@@ -193,7 +193,7 @@ file_source
 };
 #else
 // no mmap at all
-typedef istream file_source;
+typedef istream rcs_file_source;
 #endif
 
 typedef enum
@@ -220,7 +220,7 @@ static token_type
 }
 
 static token_type
-get_token(file_source & ist,
+get_token(rcs_file_source & ist,
           string & str,
           size_t & line,
           size_t & col)
@@ -303,14 +303,14 @@ struct parser
 
 struct parser
 {
-  file_source & ist;
+  rcs_file_source & ist;
   rcs_file & r;
   string token;
   token_type ttype;
 
   size_t line, col;
 
-  parser(file_source & s,
+  parser(rcs_file_source & s,
          rcs_file & r)
     : ist(s), r(r), line(1), col(1)
   {}
@@ -489,8 +489,8 @@ parse_rcs_file(string const & filename, 
 parse_rcs_file(string const & filename, rcs_file & r)
 {
 #if defined(HAVE_MMAP) || defined(WIN32)
-      file_handle handle(filename);
-      file_source ifs(filename, handle.fd, handle.length);
+      rcs_file_handle handle(filename);
+      rcs_file_source ifs(filename, handle.fd, handle.length);
 #else
       ifstream ifs(filename.c_str());
       ifs.unsetf(ios_base::skipws);