]> ruderich.org/simon Gitweb - nsscash/nsscash.git/blobdiff - nss/file.c
nss: improve comments
[nsscash/nsscash.git] / nss / file.c
index 6da0fd656663a6402db230d0f57a11b4abeb88d8..ba6c481a85daabae43873dd0e03a9fd95be51925 100644 (file)
@@ -41,8 +41,9 @@ bool map_file(const char *path, struct file *f) {
     if (fstat(f->fd, &s)) {
         goto fail;
     }
-    f->size = (size_t)s.st_size;
+    f->size = (size_t)s.st_size; // for munmap()
 
+    // mmap is used for speed and simple random access
     void *x = mmap(NULL, f->size, PROT_READ, MAP_PRIVATE, f->fd, 0);
     if (x == MAP_FAILED) {
         goto fail;