PennMUSH Community

Changeset 1254

Show
Ignore:
Timestamp:
09/11/08 21:12:11 (3 months ago)
Author:
shawnw
Message:

#7653: Make sure chat and mail get initialized on creation of a minimal db.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.3/branches/devel/src/db.c

    r1052 r1254  
    3737#include "privtab.h" 
    3838#include "htab.h" 
     39#include "extchat.h" 
    3940#include "extmail.h" 
    4041#include "confmagic.h" 
     
    19181919              god, desc_flags, 1); 
    19191920  current_state.rooms++; 
    1920 
     1921 
     1922 
     1923  init_chatdb(); 
     1924  mail_init(); 
     1925
  • 1.8.3/branches/devel/src/extchat.c

    r1247 r1254  
    198198init_chatdb(void) 
    199199{ 
    200   num_channels = 0; 
    201   channel_slab = slab_create("channels", sizeof(struct channel)); 
    202   chanuser_slab = slab_create("channel users", sizeof(struct chanuser)); 
    203   chanlist_slab = slab_create("channel lists", sizeof(struct chanlist)); 
    204   slab_set_opt(chanuser_slab, SLAB_ALLOC_BEST_FIT, 1); 
    205   slab_set_opt(chanlist_slab, SLAB_ALLOC_BEST_FIT, 1); 
    206   channels = NULL; 
     200  static bool init_called = 0; 
     201  if (!init_called) { 
     202    init_called = 1; 
     203    num_channels = 0; 
     204    channel_slab = slab_create("channels", sizeof(struct channel)); 
     205    chanuser_slab = slab_create("channel users", sizeof(struct chanuser)); 
     206    chanlist_slab = slab_create("channel lists", sizeof(struct chanlist)); 
     207    slab_set_opt(chanuser_slab, SLAB_ALLOC_BEST_FIT, 1); 
     208    slab_set_opt(chanlist_slab, SLAB_ALLOC_BEST_FIT, 1); 
     209    channels = NULL; 
     210  } 
    207211} 
    208212 
  • 1.8.3/branches/devel/src/extmail.c

    r1141 r1254  
    20192019mail_init(void) 
    20202020{ 
    2021   mdb_top = 0; 
    2022   mail_slab = slab_create("mail messages", sizeof(struct mail)); 
    2023   slab_set_opt(mail_slab, SLAB_HINTLESS_THRESHOLD, 5); 
    2024   HEAD = NULL; 
    2025   TAIL = NULL; 
     2021  static bool init_called = 0; 
     2022  if (!init_called) { 
     2023    init_called = 1; 
     2024    mdb_top = 0; 
     2025    mail_slab = slab_create("mail messages", sizeof(struct mail)); 
     2026    slab_set_opt(mail_slab, SLAB_HINTLESS_THRESHOLD, 5); 
     2027    HEAD = NULL; 
     2028    TAIL = NULL; 
     2029  } 
    20262030} 
    20272031