]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/recdb.c
LOC fix for non-ldap LOC where ldap is available
[irc/evilnet/x3.git] / src / recdb.c
index 41f82bd31d5322c5b9b4b45ea1505b7d969c4c9b..024bc9a7eb78c98161247f678fcf05bc012943eb 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,
@@ -240,6 +240,10 @@ database_get_path(dict_t db, const char *path)
 void*
 database_get_data(dict_t db, const char *path, enum recdb_type type)
 {
+    assert(path != NULL);
+    if(!path)
+        log_module(MAIN_LOG, LOG_WARNING, "Null path in database_get_data()");
+    /* log_module(MAIN_LOG, LOG_DEBUG, "Reading config option '%s'", path); */
     struct record_data *rd = database_get_path(db, path);
     return (rd && rd->type == type) ? rd->d.whatever : NULL;
 }
@@ -621,6 +625,7 @@ parse_database(const char *filename)
     /* 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) {