Changeset 591

Show
Ignore:
Timestamp:
07/09/07 14:28:54 (2 years ago)
Author:
plindner
Message:

gcc -pedantic changes, comments, signed/unsigned changes. also convert expanded to bool

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/server/assoc.c

    r551 r591  
    154154#ifdef VALGRIND 
    155155    const uint8_t  *k8; 
    156 #endif // ifdef VALGRIND 
     156#endif /* ifdef VALGRIND */ 
    157157 
    158158    /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ 
     
    332332#ifdef VALGRIND 
    333333    const uint8_t  *k8; 
    334 #endif // ifdef VALGRIND 
     334#endif /* ifdef VALGRIND */ 
    335335 
    336336    /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ 
     
    450450 
    451451/* how many powers of 2's worth of buckets we use */ 
    452 static int hashpower = 16; 
     452static unsigned int hashpower = 16; 
    453453 
    454454#define hashsize(n) ((ub4)1<<(n)) 
     
    465465 
    466466/* Number of items in the hash table. */ 
    467 static int hash_items = 0; 
     467static unsigned int hash_items = 0; 
    468468 
    469469/* Flag: Are we in the middle of expanding now? */ 
    470 static int expanding = 0
     470static bool expanding = false
    471471 
    472472/* 
     
    474474 * far we've gotten so far. Ranges from 0 .. hashsize(hashpower - 1) - 1. 
    475475 */ 
    476 static int expand_bucket = 0; 
     476static unsigned int expand_bucket = 0; 
    477477 
    478478void assoc_init(void) { 
     
    489489    uint32_t hv = hash(key, nkey, 0); 
    490490    item *it; 
    491     int oldbucket; 
     491    unsigned int oldbucket; 
    492492 
    493493    if (expanding && 
     
    515515    uint32_t hv = hash(key, nkey, 0); 
    516516    item **pos; 
    517     int oldbucket; 
     517    unsigned int oldbucket; 
    518518 
    519519    if (expanding && 
     
    540540            fprintf(stderr, "Hash table expansion starting\n"); 
    541541        hashpower++; 
    542         expanding = 1
     542        expanding = true
    543543        expand_bucket = 0; 
    544544        do_assoc_move_next_bucket(); 
     
    567567        expand_bucket++; 
    568568        if (expand_bucket == hashsize(hashpower - 1)) { 
    569             expanding = 0
     569            expanding = false
    570570            free(old_hashtable); 
    571571            if (settings.verbose > 1) 
     
    578578int assoc_insert(item *it) { 
    579579    uint32_t hv; 
    580     int oldbucket; 
     580    unsigned int oldbucket; 
    581581 
    582582    assert(assoc_find(ITEM_key(it), it->nkey) == 0);  /* shouldn't have duplicately named things defined */ 
  • trunk/server/items.c

    r590 r591  
    5252#endif 
    5353 
    54 /* 
     54/** 
    5555 * Generates the variable-sized part of the header for an object. 
    5656 * 
     
    151151} 
    152152 
    153 /* 
     153/** 
    154154 * Returns true if an item will fit in the cache (its size does not exceed 
    155155 * the maximum for a cache entry.) 
     
    268268/*@null@*/ 
    269269char *do_item_cachedump(const unsigned int slabs_clsid, const unsigned int limit, unsigned int *bytes) { 
    270     int memlimit = 2 * 1024 * 1024;   /* 2MB max response size */ 
     270    unsigned int memlimit = 2 * 1024 * 1024;   /* 2MB max response size */ 
    271271    char *buffer; 
    272272    unsigned int bufcurr; 
    273273    item *it; 
    274     int len; 
    275     int shown = 0; 
     274    unsigned int len; 
     275    unsigned int shown = 0; 
    276276    char temp[512]; 
    277277 
     
    333333} 
    334334 
    335 /* dumps out a list of objects of each size, with granularity of 32 bytes */ 
     335/** dumps out a list of objects of each size, with granularity of 32 bytes */ 
    336336/*@null@*/ 
    337337char* do_item_stats_sizes(int *bytes) { 
     
    372372} 
    373373 
    374 /* returns true if a deleted item's delete-locked-time is over, and it 
    375    should be removed from the namespace */ 
     374/** returns true if a deleted item's delete-locked-time is over, and it 
     375    should be removed from the namespace */ 
    376376bool item_delete_lock_over (item *it) { 
    377377    assert(it->it_flags & ITEM_DELETED); 
     
    379379} 
    380380 
    381 /* wrapper around assoc_find which does the lazy expiration/deletion logic */ 
     381/** wrapper around assoc_find which does the lazy expiration/deletion logic */ 
    382382item *do_item_get_notedeleted(const char *key, const size_t nkey, bool *delete_locked) { 
    383383    item *it = assoc_find(key, nkey); 
     
    394394    if (it != NULL && settings.oldest_live != 0 && settings.oldest_live <= current_time && 
    395395        it->time <= settings.oldest_live) { 
    396         do_item_unlink(it);           // MTSAFE - cache_lock held 
     396        do_item_unlink(it);           /* MTSAFE - cache_lock held */ 
    397397        it = 0; 
    398398    } 
    399399    if (it != NULL && it->exptime != 0 && it->exptime <= current_time) { 
    400         do_item_unlink(it);           // MTSAFE - cache_lock held 
     400        do_item_unlink(it);           /* MTSAFE - cache_lock held */ 
    401401        it = 0; 
    402402    } 
     
    413413} 
    414414 
    415 /* returns an item whether or not it's delete-locked or expired. */ 
     415/** returns an item whether or not it's delete-locked or expired. */ 
    416416item *do_item_get_nocheck(const char *key, const size_t nkey) { 
    417417    item *it = assoc_find(key, nkey); 
  • trunk/server/slabs.c

    r551 r591  
    8989} 
    9090 
    91 /* 
     91/** 
    9292 * Determines the chunk sizes and initializes the slab class descriptors 
    9393 * accordingly. 
  • trunk/server/stats.c

    r515 r591  
    9999 
    100100    strncpy(pfs->prefix, key, length); 
    101     pfs->prefix[length] = '\0';      // because strncpy() sucks 
     101    pfs->prefix[length] = '\0';      /* because strncpy() sucks */ 
    102102    pfs->prefix_len = length; 
    103103 
  • trunk/server/thread.c

    r590 r591  
    633633    /* Wait for all the threads to set themselves up before returning. */ 
    634634    pthread_mutex_lock(&init_lock); 
    635     init_count++; // main thread 
     635    init_count++; /* main thread */ 
    636636    while (init_count < nthreads) { 
    637637        pthread_cond_wait(&init_cond, &init_lock);