]> git.pond.sub.org Git - empserver/commitdiff
empfile's init callback is now unused, remove
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 24 Feb 2008 10:19:51 +0000 (11:19 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Wed, 5 Mar 2008 21:48:24 +0000 (22:48 +0100)
include/file.h
src/lib/common/file.c
src/lib/global/file.c
src/lib/subs/fileinit.c

index 43a67f73315a3c6d406113c26062e284ced6b09a..2ad5e31c531b15f270fc3942012f36ba33b06c50 100644 (file)
@@ -60,7 +60,6 @@ struct empfile {
     /* flags bits EFF_PRIVATE, EFF_CUSTOM also vary */
 
     /* User callbacks */
     /* flags bits EFF_PRIVATE, EFF_CUSTOM also vary */
 
     /* User callbacks */
-    void (*init)(int, void *); /* called after entry creation, unless null */
     int (*postread)(int, void *); /* called after read, unless null */
     int (*prewrite)(int, void *); /* called before write, unless null */
 };
     int (*postread)(int, void *); /* called after read, unless null */
     int (*prewrite)(int, void *); /* called before write, unless null */
 };
index 2a3f26896632783f145c2020f28ce2c3964af5e5..1e74ba906d2a241978459673182894ea605aadde 100644 (file)
@@ -478,14 +478,12 @@ do_blank(struct empfile *ep, void *buf, int id, int count)
     struct emptypedstr *elt;
 
     memset(buf, 0, count * ep->size);
     struct emptypedstr *elt;
 
     memset(buf, 0, count * ep->size);
-    for (i = 0; i < count; i++) {
-       elt = (struct emptypedstr *)((char *)buf + i * ep->size);
-       if (ep->flags & EFF_TYPED) {
+    if (ep->flags & EFF_TYPED) {
+       for (i = 0; i < count; i++) {
+           elt = (struct emptypedstr *)((char *)buf + i * ep->size);
            elt->ef_type = ep->uid;
            elt->uid = id + i;
        }
            elt->ef_type = ep->uid;
            elt->uid = id + i;
        }
-       if (ep->init)
-           ep->init(id + i, (void *)elt);
     }
 }
 
     }
 }
 
index 5e6ec469b13c3eaf2d06899881c227a63d95b931..abca1ecdc87257cfb4f5cb5d0c017933e348e6bf 100644 (file)
 /* Initializers for members flags... */
 /* Unmapped cache */
 #define UNMAPPED_CACHE(type, flags) \
 /* Initializers for members flags... */
 /* Unmapped cache */
 #define UNMAPPED_CACHE(type, flags) \
-    sizeof(type), (flags), NULL, 0, 0, 0, 0, -1, NULL, NULL, NULL
+    sizeof(type), (flags), NULL, 0, 0, 0, 0, -1, NULL, NULL
 /*
  * Mapped cache, array with known size.
  * Members cids, fids are not set.
  */
 #define ARRAY_CACHE(array, flags) \
     sizeof(*(array)), (flags), (char *)(array), \
 /*
  * Mapped cache, array with known size.
  * Members cids, fids are not set.
  */
 #define ARRAY_CACHE(array, flags) \
     sizeof(*(array)), (flags), (char *)(array), \
-    SZ((array)), 0, 0, 0, -1, NULL, NULL, NULL
+    SZ((array)), 0, 0, 0, -1, NULL, NULL
 /*
  * Mapped cache, array with unknown size.
  * Members csize, cids, fids are not set.
  */
 #define PTR_CACHE(ptr, flags) \
     sizeof(*(ptr)), (flags), (char *)(ptr), \
 /*
  * Mapped cache, array with unknown size.
  * Members csize, cids, fids are not set.
  */
 #define PTR_CACHE(ptr, flags) \
     sizeof(*(ptr)), (flags), (char *)(ptr), \
-    0, 0, 0, 0, -1, NULL, NULL, NULL
+    0, 0, 0, 0, -1, NULL, NULL
 /*
  * Array-backed table.
  * The array's last element is the sentinel.
  */
 #define ARRAY_TABLE(array, flags) \
     sizeof(*(array)), (flags), (char *)(array), \
 /*
  * Array-backed table.
  * The array's last element is the sentinel.
  */
 #define ARRAY_TABLE(array, flags) \
     sizeof(*(array)), (flags), (char *)(array), \
-    SZ((array)), 0, SZ((array)) - 1, SZ((array)) - 1, -1, NULL, NULL, NULL
+    SZ((array)), 0, SZ((array)) - 1, SZ((array)) - 1, -1, NULL, NULL
 
 /* Common configuration table flags */
 #define EFF_CFG (EFF_PRIVATE | EFF_MEM | EFF_STATIC)
 
 /* Common configuration table flags */
 #define EFF_CFG (EFF_PRIVATE | EFF_MEM | EFF_STATIC)
@@ -142,9 +142,9 @@ struct empfile empfile[] = {
     {EF_LOAN, "loan", "loan", loan_ca,
      UNMAPPED_CACHE(struct lonstr, EFF_TYPED)},
     {EF_MAP, "map", "map", NULL,
     {EF_LOAN, "loan", "loan", loan_ca,
      UNMAPPED_CACHE(struct lonstr, EFF_TYPED)},
     {EF_MAP, "map", "map", NULL,
-     0, 0, NULL, 0, 0, 0, 0, -1, NULL, NULL, NULL},
+     0, 0, NULL, 0, 0, 0, 0, -1, NULL, NULL},
     {EF_BMAP, "bmap", "bmap", NULL,
     {EF_BMAP, "bmap", "bmap", NULL,
-     0, 0, NULL, 0, 0, 0, 0, -1, NULL, NULL, NULL},
+     0, 0, NULL, 0, 0, 0, 0, -1, NULL, NULL},
     {EF_COMM, "commodity", "commodity", commodity_ca,
      UNMAPPED_CACHE(struct comstr, EFF_TYPED | EFF_OWNER)},
     {EF_LOST, "lost", "lostitems", lost_ca,
     {EF_COMM, "commodity", "commodity", commodity_ca,
      UNMAPPED_CACHE(struct comstr, EFF_TYPED | EFF_OWNER)},
     {EF_LOST, "lost", "lostitems", lost_ca,
@@ -221,7 +221,7 @@ struct empfile empfile[] = {
      UNMAPPED_CACHE(struct natstr, EFF_TYPED | EFF_OWNER)},
 
     /* Sentinel */
      UNMAPPED_CACHE(struct natstr, EFF_TYPED | EFF_OWNER)},
 
     /* Sentinel */
-    {EF_BAD, NULL, NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, -1, NULL, NULL, NULL},
+    {EF_BAD, NULL, NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, -1, NULL, NULL},
 };
 
 static void
 };
 
 static void
index 4f26ce5988f92a4b5cbe685c0869867d19b1b8ea..4e6fb53517e1960c6d76206c67143c96259f202b 100644 (file)
 
 struct fileinit {
     int ef_type;
 
 struct fileinit {
     int ef_type;
-    void (*init) (int, void *);
     int (*postread) (int, void *);
     int (*prewrite) (int, void *);
 };
 
 static struct fileinit fileinit[] = {
     int (*postread) (int, void *);
     int (*prewrite) (int, void *);
 };
 
 static struct fileinit fileinit[] = {
-    {EF_SECTOR, NULL, sct_postread, sct_prewrite},
-    {EF_SHIP, NULL, shp_postread, shp_prewrite},
-    {EF_PLANE, NULL, pln_postread, pln_prewrite},
-    {EF_LAND, NULL, lnd_postread, lnd_prewrite},
-    {EF_NUKE, NULL, nuk_postread, nuk_prewrite}
+    {EF_SECTOR, sct_postread, sct_prewrite},
+    {EF_SHIP, shp_postread, shp_prewrite},
+    {EF_PLANE, pln_postread, pln_prewrite},
+    {EF_LAND, lnd_postread, lnd_prewrite},
+    {EF_NUKE, nuk_postread, nuk_prewrite}
 };
 
 static void ef_open_srv(void);
 };
 
 static void ef_open_srv(void);
@@ -65,7 +64,6 @@ ef_init_srv(void)
     unsigned i;
 
     for (i = 0; i < sizeof(fileinit) / sizeof(fileinit[0]); i++) {
     unsigned i;
 
     for (i = 0; i < sizeof(fileinit) / sizeof(fileinit[0]); i++) {
-       empfile[fileinit[i].ef_type].init = fileinit[i].init;
        empfile[fileinit[i].ef_type].postread = fileinit[i].postread;
        empfile[fileinit[i].ef_type].prewrite = fileinit[i].prewrite;
     }
        empfile[fileinit[i].ef_type].postread = fileinit[i].postread;
        empfile[fileinit[i].ef_type].prewrite = fileinit[i].prewrite;
     }