PennMUSH Community

Changeset 1213

Show
Ignore:
Timestamp:
01/28/08 20:19:55 (8 months ago)
Author:
shawnw
Message:

Ran make indent

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.3/branches/devel/hdrs/attrib.h

    r1206 r1213  
    8888 
    8989int can_read_attr_internal(dbref player, dbref obj, ATTR *attr); 
    90 int can_write_attr_internal(dbref player, dbref obj, ATTR *attr, 
    91                             int safe); 
     90int can_write_attr_internal(dbref player, dbref obj, ATTR *attr, int safe); 
    9291bool can_edit_attr(dbref player, dbref thing, const char *attrname); 
    9392unsigned const char *atr_get_compressed_data(ATTR *atr); 
  • 1.8.3/branches/devel/hdrs/intmap.h

    r1211 r1213  
    1111typedef struct intmap intmap; 
    1212 
    13 intmap* im_new(void); 
    14 void im_destroy(intmap*); 
     13intmap *im_new(void); 
     14void im_destroy(intmap *); 
    1515 
    16 int im_count(intmap*); 
     16int im_count(intmap *); 
    1717 
    18 bool im_insert(intmap*, uint32_t, void*); 
    19 void *im_find(intmap*, uint32_t); 
    20 bool im_exists(intmap*, uint32_t); 
    21 bool im_delete(intmap*, uint32_t); 
    22 void im_dump_graph(intmap*, const char *); 
     18bool im_insert(intmap *, uint32_t, void *); 
     19void *im_find(intmap *, uint32_t); 
     20bool im_exists(intmap *, uint32_t); 
     21bool im_delete(intmap *, uint32_t); 
     22void im_dump_graph(intmap *, const char *); 
    2323void im_stats_header(dbref); 
    24 void im_stats(dbref, intmap*, const char *); 
    25 #endif /* INTMAP_H */ 
     24void im_stats(dbref, intmap *, const char *); 
     25#endif                          /* INTMAP_H */ 
  • 1.8.3/branches/devel/src/access.c

    r1203 r1213  
    600600    } 
    601601  } 
    602    
     602 
    603603  while (ap) { 
    604604    rulenum++; 
    605605    next = ap->next; 
    606606    if (deletethis == -1 ? (strcasecmp(pattern, ap->host) == 0) 
    607    : deletethis == rulenum) { 
     607        : deletethis == rulenum) { 
    608608      n++; 
    609609      if (ap->re) 
    610    free(ap->re); 
     610        free(ap->re); 
    611611      mush_free(ap, "sitelock.rule"); 
    612612      if (prev) 
    613    prev->next = next; 
     613        prev->next = next; 
    614614      else 
    615    access_top = next; 
     615        access_top = next; 
    616616      if (deletethis >= 0) 
    617    break; 
     617        break; 
    618618    } else { 
    619619      prev = ap; 
     
    621621    ap = next; 
    622622  } 
    623    
     623 
    624624  return n; 
    625625} 
  • 1.8.3/branches/devel/src/bsd.c

    r1208 r1213  
    11111111 
    11121112      if (notify_fd >= 0 && FD_ISSET(notify_fd, &input_set)) 
    1113    file_watch_event(notify_fd); 
     1113        file_watch_event(notify_fd); 
    11141114 
    11151115      for (d = descriptor_list; d; d = dnext) { 
     
    47374737{ 
    47384738  do_rawlog(LT_TRACE, 
    4739        "Reloading help indexes and cached files after detecting a change."); 
     4739            "Reloading help indexes and cached files after detecting a change."); 
    47404740  fcache_load(NOTHING); 
    47414741  help_reindex(NOTHING); 
     
    47574757        (name), strerror(errno));               \ 
    47584758  } while (0) 
    4759        
     4759 
    47604760  do_rawlog(LT_TRACE, 
    4761        "'No such file or directory' errors immediately following are probably harmless."); 
     4761            "'No such file or directory' errors immediately following are probably harmless."); 
    47624762  for (n = 0; n < 2; n++) { 
    47634763    WATCH(options.connect_file[n]); 
     
    47704770    WATCH(options.guest_file[n]); 
    47714771  } 
    4772    
    4773   for (h = hash_firstentry(&help_files); h; h = hash_nextentry(&help_files))  
     4772 
     4773  for (h = hash_firstentry(&help_files); h; h = hash_nextentry(&help_files)) 
    47744774    WATCH(h->file); 
    47754775 
     
    47824782  int fd = inotify_init(); 
    47834783 
    4784  if (fd < 0) { 
     4784  if (fd < 0) { 
    47854785    penn_perror("file_watch_init:inotify_init"); 
    47864786    return -1; 
     
    48294829  if (!gamedir) { 
    48304830    do_rawlog(LT_TRACE, 
    4831          "file_watch_init: Unable to get GAMEDIR environment variable."); 
     4831              "file_watch_init: Unable to get GAMEDIR environment variable."); 
    48324832    return -1; 
    48334833  } 
    4834    
     4834 
    48354835  if (FAMOpen(&famc) < 0) { 
    48364836    do_rawlog(LT_TRACE, "file_watch_init: FAMOpen: %s", FamErrlist[FAMErrno]); 
    48374837    return -1; 
    48384838  } 
    4839  
    48404839#define WATCH(name) do { \ 
    48414840    const char *fullname = tprintf("%s/%s", gamedir, (name));    \ 
     
    48454844        (name), FamErrlist[FAMErrno]);              \ 
    48464845  } while (0) 
    4847        
     4846 
    48484847  do_rawlog(LT_TRACE, 
    4849        "'No such file or directory' errors immediately following are probably harmless."); 
     4848            "'No such file or directory' errors immediately following are probably harmless."); 
    48504849  for (n = 0; n < 2; n++) { 
    48514850    WATCH(options.connect_file[n]); 
     
    48584857    WATCH(options.guest_file[n]); 
    48594858  } 
    4860    
    4861   for (h = hash_firstentry(&help_files); h; h = hash_nextentry(&help_files))  
     4859 
     4860  for (h = hash_firstentry(&help_files); h; h = hash_nextentry(&help_files)) 
    48624861    WATCH(h->file); 
    48634862 
    48644863#undef WATCH 
    4865    
     4864 
    48664865  return FAMCONNECTION_GETFD(&famc); 
    48674866} 
     
    48744873  while (FAMPending(&famc)) { 
    48754874    FAMEvent famev; 
    4876      
     4875 
    48774876    memset(&famev, 0, sizeof famev); 
    4878      
     4877 
    48794878    if (FAMNextEvent(&famc, &famev) < 0) { 
    48804879      do_rawlog(LT_TRACE, "file_watch_event: FAMNextEvent: %s", 
    4881        FamErrlist[FAMErrno]); 
     4880                FamErrlist[FAMErrno]); 
    48824881      break; 
    48834882    } 
    4884      
     4883 
    48854884    do_rawlog(LT_TRACE, "Code is: %d for %s", famev.code, famev.filename); 
    48864885 
     
    49174916 */ 
    49184917void 
    4919 file_watch_event(int fd __attribute__((__unused__))) 
     4918file_watch_event(int fd __attribute__ ((__unused__))) 
    49204919{ 
    49214920#ifdef HAVE_INOTIFY 
  • 1.8.3/branches/devel/src/cmds.c

    r1208 r1213  
    10771077COMMAND(cmd_wait) 
    10781078{ 
    1079   if (SW_BY_NAME(sw, "PID"))  
     1079  if (SW_BY_NAME(sw, "PID")) 
    10801080    do_waitpid(player, arg_left, arg_right, SW_ISSET(sw, SWITCH_UNTIL)); 
    10811081  else 
  • 1.8.3/branches/devel/src/conf.c

    r1187 r1213  
    17101710 
    17111711#ifdef HAVE_INOTIFY 
    1712   notify(player, 
    1713      T(" Changed help files will be automatically reindexed.")); 
     1712  notify(player, T(" Changed help files will be automatically reindexed.")); 
    17141713#endif 
    17151714 
  • 1.8.3/branches/devel/src/cque.c

    r1212 r1213  
    965965  pid = parse_uint32(pidstr, NULL, 10); 
    966966  q = im_find(queue_map, pid); 
    967    
     967 
    968968  if (!q) { 
    969969    notify(player, T("That is not a valid pid!")); 
     
    978978  if (q->sem != NOTHING && q->left == 0) { 
    979979    notify(player, 
    980       T("You cannot adjust the timeout of an indefinite semaphore.")); 
     980           T("You cannot adjust the timeout of an indefinite semaphore.")); 
    981981    return; 
    982982  } 
     
    988988 
    989989  if (until) { 
    990     int when;     
     990    int when; 
    991991 
    992992    when = parse_integer(timestr); 
     
    10021002    /* If timestr looks like +NNN or -NNN, add or subtract a number 
    10031003       of seconds to the current timeout. Otherwise, change timeout.  
    1004     */ 
     1004    */ 
    10051005    if (timestr[0] == '+' || timestr[0] == '-') 
    10061006      q->left += offset; 
     
    10181018    if (tmp == q) { 
    10191019      if (last) 
    1020    last->next = q->next; 
     1020        last->next = q->next; 
    10211021      else 
    1022    qwait = qwait->next; 
     1022        qwait = qwait->next; 
    10231023      found = true; 
    10241024      break; 
     
    10411041    } 
    10421042    if (!found) { 
    1043       if (last)  
     1043      if (last) 
    10441044        last->next = q; 
    10451045      else 
     
    10751075        case 2:                /* semaphore queue */ 
    10761076          if (tmp->left != 0) { 
    1077             notify_format(player, "(Pid: %u) [#%d/%s/%ld]%s: %s", tmp->pid, tmp->sem, 
    1078                           tmp->semattr, (long) difftime(tmp->left, mudtime), 
     1077            notify_format(player, "(Pid: %u) [#%d/%s/%ld]%s: %s", tmp->pid, 
     1078                          tmp->sem, tmp->semattr, (long) difftime(tmp->left, 
     1079                                                                  mudtime), 
    10791080                          unparse_object(player, tmp->player), tmp->comm); 
    10801081          } else { 
    1081             notify_format(player, "(Pid: %u) [#%d/%s]%s: %s", tmp->pid, tmp->sem, 
    1082                           tmp->semattr, unparse_object(player, tmp->player), 
     1082            notify_format(player, "(Pid: %u) [#%d/%s]%s: %s", tmp->pid, 
     1083                          tmp->sem, tmp->semattr, unparse_object(player, 
     1084                                                                 tmp->player), 
    10831085                          tmp->comm); 
    10841086          } 
    10851087          break; 
    10861088        default:               /* player or object queue */ 
    1087           notify_format(player, "(Pid: %u) %s: %s", tmp->pid, unparse_object(player, 
    1088                                                          tmp->player), 
    1089                         tmp->comm); 
     1089          notify_format(player, "(Pid: %u) %s: %s", tmp->pid, 
     1090                        unparse_object(player, tmp->player), tmp->comm); 
    10901091        } 
    10911092      } 
     
    13041305 * \param arg1 string representing the pid to halt. 
    13051306 */ 
    1306 void  
     1307void 
    13071308do_haltpid(dbref player, const char *arg1) 
    13081309{ 
     
    13221323  if (!q) { 
    13231324    notify(player, T("That is not a valid pid!")); 
    1324     return; 
     1325    return; 
    13251326  } 
    13261327 
     
    13301331    return; 
    13311332  } 
    1332    
     1333 
    13331334  /* Instead of trying to track what queue this entry currently 
    13341335     belongs too, flag it as halted and just not execute it when its 
     
    13391340  if (q->semattr) { 
    13401341    BQUE *last = NULL, *tmp; 
    1341      
     1342 
    13421343    for (tmp = qsemfirst; tmp; last = tmp, tmp = tmp->next) { 
    13431344      if (tmp == q) { 
    1344    if (last) 
    1345      last->next = tmp->next; 
    1346    else 
    1347      qsemfirst = tmp->next; 
    1348      
    1349    if (qsemlast == tmp) 
    1350      qsemlast = last; 
    1351      
    1352    break; 
     1345        if (last) 
     1346          last->next = tmp->next; 
     1347        else 
     1348          qsemfirst = tmp->next; 
     1349 
     1350        if (qsemlast == tmp) 
     1351          qsemlast = last; 
     1352 
     1353        break; 
    13531354      } 
    13541355    } 
     
    13611362  notify_format(player, T("Queue entry with pid %u halted."), pid); 
    13621363} 
    1363  
    13641364 
    13651365 
  • 1.8.3/branches/devel/src/help.c

    r1194 r1213  
    368368  if ((rfp = fopen(h->file, FOPEN_READ)) == NULL) { 
    369369    do_rawlog(LT_ERR, T("Can't open %s for reading: %s"), h->file, 
    370          strerror(errno)); 
     370              strerror(errno)); 
    371371    return; 
    372372  } 
  • 1.8.3/branches/devel/src/intmap.c

    r1211 r1213  
    5757#include "mymalloc.h" 
    5858#include "intmap.h" 
    59 #include "confmagic.h"  
     59#include "confmagic.h" 
    6060 
    6161/** Structure that represents a node in a patricia tree. */ 
     
    7979/** Return the number of elements in an integer map. */ 
    8080int 
    81 im_count(intmap *im) 
     81im_count(intmap * im) 
    8282{ 
    8383  if (im) 
     
    8888 
    8989/** Allocate and initialize a new integer map. */ 
    90 intmap
     90intmap
    9191im_new(void) 
    9292{ 
     
    103103 
    104104static void 
    105 pat_destroy(patricia *node) 
     105pat_destroy(patricia * node) 
    106106{ 
    107107  int n; 
     
    110110    return; 
    111111 
    112   for (n = 0; n < 2; n++)  
     112  for (n = 0; n < 2; n++) 
    113113    if (node->links[n]->bit > node->bit) 
    114114      pat_destroy(node->links[n]); 
     
    123123 */ 
    124124void 
    125 im_destroy(intmap *im) 
     125im_destroy(intmap * im) 
    126126{ 
    127127  if (im) { 
     
    138138 
    139139/* Returns the node matching the key or its prefix */ 
    140 static patricia
    141 pat_search(patricia *node, uint32_t key, int bit) 
     140static patricia
     141pat_search(patricia * node, uint32_t key, int bit) 
    142142{ 
    143143  assert(node); 
     
    154154 * \returns the value of the data stored under that key, or NULL 
    155155 */ 
    156 void
    157 im_find(intmap *im, uint32_t key) 
     156void
     157im_find(intmap * im, uint32_t key) 
    158158{ 
    159159  patricia *node; 
     
    161161  if (!im->root) 
    162162    return NULL; 
    163    
     163 
    164164  node = pat_search(im->root, key, -1); 
    165165 
     
    176176 */ 
    177177bool 
    178 im_exists(intmap *im, uint32_t key) 
     178im_exists(intmap * im, uint32_t key) 
    179179{ 
    180180  patricia *node; 
     
    193193 */ 
    194194bool 
    195 im_insert(intmap *im, uint32_t key, void *data) 
     195im_insert(intmap * im, uint32_t key, void *data) 
    196196{ 
    197197  patricia *here, *newnode, *prev = NULL; 
     
    232232    return true; 
    233233  } 
    234    
    235   for (here = im->root; ;) { 
     234 
     235  for (here = im->root;;) { 
    236236    int i; 
    237237    if (here->bit == bit) { 
     
    249249      return true; 
    250250    } 
    251      
     251 
    252252    prev = here; 
    253253    i = digit(key, here->bit); 
     
    255255    prevbit = i; 
    256256  } 
    257   
     257 
    258258  /* Not reached */ 
    259259  assert(0); 
     
    268268 */ 
    269269bool 
    270 im_delete(intmap *im, uint32_t key) 
     270im_delete(intmap * im, uint32_t key) 
    271271{ 
    272272  patricia *parent = NULL, *firstparent = NULL, *grandparent = NULL; 
    273273  patricia *here = im->root; 
    274    
     274 
    275275  if (!here) 
    276276    return false; 
     
    282282    parent = here; 
    283283    here = here->links[x]; 
    284      
     284 
    285285    assert(here); 
    286      
     286 
    287287    if (here->key == key && !firstparent) 
    288288      firstparent = parent; 
     
    312312    i = (here->links[0] == here); 
    313313    replacement = here->links[i]; 
    314      
     314 
    315315    if (replacement != here) { 
    316316      if (!grandparent || grandparent == here) 
    317    im->root = replacement; 
     317        im->root = replacement; 
    318318      else 
    319    grandparent->links[grandparent->links[1] == parent] = replacement; 
    320     } else  
     319        grandparent->links[grandparent->links[1] == parent] = replacement; 
     320    } else 
    321321      grandparent->links[grandparent->links[1] == parent] = grandparent; 
    322322 
     
    346346      parent->links[1 - i] = other; 
    347347      if (parent->links[0] == here) 
    348    parent->links[0] = parent; 
     348        parent->links[0] = parent; 
    349349      if (parent->links[1] == here) 
    350    parent->links[1] = parent; 
     350        parent->links[1] = parent; 
    351351      parent->bit = here->bit; 
    352352      slab_free(intmap_slab, here); 
     
    355355      return true; 
    356356    } 
    357      
     357 
    358358    grandparent->links[grandparent->links[1] == parent] = otherlink; 
    359359    parent->links[0] = here->links[0]; 
     
    374374 
    375375static void 
    376 pat_list_nodes(patricia *node, FILE *fp) 
     376pat_list_nodes(patricia * node, FILE * fp) 
    377377{ 
    378378  int n; 
     
    387387 
    388388  fprintf(fp, 
    389      "node%u [label=\"{ <key> key = 0b%s (%u) | bit = %d | { <b0> 0 | <b1> 1 } }\", ", 
    390      node->key, tmpbuf, node->key, node->bit); 
    391   if (node->links[0]->bit > node->bit && node->links[1]->bit > node->bit)  
     389          "node%u [label=\"{ <key> key = 0b%s (%u) | bit = %d | { <b0> 0 | <b1> 1 } }\", ", 
     390          node->key, tmpbuf, node->key, node->bit); 
     391  if (node->links[0]->bit > node->bit && node->links[1]->bit > node->bit) 
    392392    fputs("fillcolor=1", fp); 
    393393  else if (node->links[0]->bit <= node->bit && node->links[1]->bit <= node->bit) 
     
    395395  else 
    396396    fputs("fillcolor=2", fp); 
    397    
     397 
    398398  fputs("];\n", fp); 
    399399 
     
    405405 
    406406static void 
    407 pat_list_links(patricia *node, FILE *fp) 
     407pat_list_links(patricia * node, FILE * fp) 
    408408{ 
    409409  int i; 
    410410  const char *edge_styles[] = { "style=dashed,arrowhead=open", 
    411                 "style=solid,arrowhead=normal" }; 
     411    "style=solid,arrowhead=normal" 
     412  }; 
    412413 
    413414  if (!node) 
     
    416417  for (i = 0; i < 2; i++) { 
    417418    if (node->links[i]) { 
    418       fprintf(fp, "node%u:b%d -> node%u:key [%s];\n", node->key, i,  
    419          node->links[i]->key, 
    420          edge_styles[node->links[i]->bit > node->bit]); 
     419      fprintf(fp, "node%u:b%d -> node%u:key [%s];\n", node->key, i, 
     420              node->links[i]->key, 
     421              edge_styles[node->links[i]->bit > node->bit]); 
    421422      if (node->links[i]->bit > node->bit) 
    422    pat_list_links(node->links[i], fp); 
     423        pat_list_links(node->links[i], fp); 
    423424    } 
    424425  } 
     
    439440 */ 
    440441void 
    441 im_dump_graph(intmap *im, const char *filename) 
     442im_dump_graph(intmap * im, const char *filename) 
    442443{ 
    443444  FILE *fp; 
     
    452453    return; 
    453454  } 
    454   
     455 
    455456  fputs("digraph patricia { \n", fp); 
    456457  fputs("node [shape=Mrecord, colorscheme=blues3, style=filled];\n", fp); 
     
    470471/** @stats/tables line */ 
    471472void 
    472 im_stats(dbref player, intmap *im, const char *name) 
     473im_stats(dbref player, intmap * im, const char *name) 
    473474{ 
    474475  notify_format(player, "%-11s %7d %7u", name, im->count, 
    475                 (unsigned int)(sizeof(*im) + (sizeof(patricia) * im->count))); 
    476 } 
     476                (unsigned int) (sizeof(*im) + (sizeof(patricia) * im->count))); 
     477}