]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/recdb.c
make regex case sensitive, and old memoserv fix
[irc/evilnet/x3.git] / src / recdb.c
index 5399622555f7e2881e11e82947a4664a9246a9d4..18f57de830d38eefa9fabbf2db8a0877f7f03582 100644 (file)
@@ -3,9 +3,9 @@
  *
  * This file is part of x3.
  *
- * srvx is free software; you can redistribute it and/or modify
+ * x3 is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -93,7 +93,7 @@ typedef struct recdb_outfile {
 } RECDB_OUT;
 
 #ifdef HAVE_MMAP
-static int mmap_error=0;
+static int mmap_error;
 #endif
 
 #define EOL '\n'
@@ -620,11 +620,15 @@ parse_database(const char *filename)
         return NULL;
     }
     recdb.length = (size_t)statinfo.st_size;
+    if (recdb.length == 0) {
+        return alloc_database();
+    }
 
 #ifdef HAVE_MMAP
     /* Try mmap */
     if (!mmap_error && (recdb.s = mmap(NULL, recdb.length, PROT_READ|PROT_WRITE, MAP_PRIVATE, fileno(recdb.f), 0)) != MAP_FAILED) {
         recdb.type = RECDB_MMAP;
+        madvise(recdb.s, recdb.length, MADV_SEQUENTIAL);
     } else {
         /* Fall back to stdio */
         if (!mmap_error) {