]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
explain the mmap code a little
authorAndrew Tridgell <tridge@samba.org>
Wed, 27 Mar 2002 07:12:30 +0000 (08:12 +0100)
committerAndrew Tridgell <tridge@samba.org>
Wed, 27 Mar 2002 07:12:30 +0000 (08:12 +0100)
ccache.c
ccache.h

index 17c620260c83462f13cd71b6076eacfcc79f73af..05f54694d88f7b289578dc191590f962223d3eac 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -118,6 +118,9 @@ static void stabs_hash(const char *fname)
                failed();
        }
 
+       /* we use mmap() to make it easy to handle arbitraryily long
+           lines in preprocessor output. I have seen lines of over
+           100k in length, so this is well worth it */
        map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
        if (map == (void *)-1) {
                cc_log("Failed to mmap %s\n", fname);
@@ -131,6 +134,8 @@ static void stabs_hash(const char *fname)
                while (l_end < st.st_size && map[l_end] != '\n') {
                        l_end++;
                }
+               /* skip the hash on any lines that look like compiler line
+                  numbers */
                if ((l_end - l_start) > 2 &&
                    map[l_start] == '#' && map[l_start+1] == ' ' && 
                    isdigit(map[l_start+2])) {
index cf2b1bb095542c64f2a2584f3663c25f7c7402e2..3b51d77dfd4b5f97d04fab9d0b4ca5e1473c708f 100644 (file)
--- a/ccache.h
+++ b/ccache.h
@@ -19,8 +19,6 @@
 #define STATUS_FATAL 4
 #define STATUS_NOCACHE 5
 
-#define MAX_LINE_SIZE 102400
-
 typedef unsigned uint32;
 
 #include "mdfour.h"