IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 26, 2004, 2:57:34 PM (22 years ago)
Author:
desonia
Message:

converted native C types to ps Types, where practical.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/collections/psHash.c

    r1842 r2204  
    1111*  @author George Gusciora, MHPCC
    1212*
    13 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-09-21 23:17:53 $
     13*  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-10-27 00:57:31 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1919#include <stdio.h>
    2020#include <string.h>
    21 #include <stdbool.h>
    2221#include "psHash.h"
    2322#include "psMemory.h"
     
    2928#include "psCollectionsErrors.h"
    3029
    31 static psHashBucket* hashBucketAlloc(const char *key, void *data, psHashBucket* next);
     30static psHashBucket* hashBucketAlloc(const char *key, psPtr data, psHashBucket* next);
    3231static void hashBucketFree(psHashBucket* bucket);
    33 static void *doHashWork(psHash* table, const char *key, void *data, bool remove
     32static psPtr doHashWork(psHash* table, const char *key, psPtr data, psBool remove
    3433                           );
    3534static void hashFree(psHash* table);
     
    4544psList* psHashKeyList(psHash* table)
    4645{
    47     int i = 0;                  // Loop index variable
     46    psS32 i = 0;                  // Loop index variable
    4847    psList* myLinkList = NULL;  // The output data structure
    4948    psHashBucket* ptr = NULL;   // Used to step thru linked list.
     
    8584 *****************************************************************************/
    8685static psHashBucket* hashBucketAlloc(const char *key,
    87                                      void *data,
     86                                     psPtr data,
    8887                                     psHashBucket* next)
    8988{
     
    135134    The new hash table.
    136135 *****************************************************************************/
    137 psHash* psHashAlloc(int nbucket)        // initial number of buckets
    138 {
    139     int i = 0;                  // loop index variable
     136psHash* psHashAlloc(psS32 nbucket)        // initial number of buckets
     137{
     138    psS32 i = 0;                  // loop index variable
    140139
    141140    // Create the new hash table.
     
    172171static void hashFree(psHash* table)
    173172{
    174     int i = 0;                  // Loop index variable.
     173    psS32 i = 0;                  // Loop index variable.
    175174
    176175    if (table == NULL) {
     
    212211there is little common code between those functions.
    213212  *****************************************************************************/
    214 static void *doHashWork(psHash* table,
     213static psPtr doHashWork(psHash* table,
    215214                        const char *key,
    216                         void *data, bool remove
     215                        psPtr data, psBool remove
    217216                           )
    218217{
    219     long int hash = 1;          // This will contain an integer value
     218    psS64 hash = 1;          // This will contain an integer value
    220219
    221220    // "hashed" from the key.
     
    236235    }
    237236    // NOTE: This is the originally supplied hash function.
    238     // for (int i = 0, len = strlen(key); i < len; i++) {
     237    // for (psS32 i = 0, len = strlen(key); i < len; i++) {
    239238    // hash = (hash << 1) ^ key[i];
    240239    // }
     
    273272                    // of removing an item from a single-linked list.
    274273
    275                     void *data = ptr->data;
     274                    psPtr data = ptr->data;
    276275
    277276                    optr->next = ptr->next;
     
    344343    boolean value defining success or failure
    345344 *****************************************************************************/
    346 bool psHashAdd(psHash* table,
    347                const char *key,
    348                void *data)
     345psBool psHashAdd(psHash* table,
     346                 const char *key,
     347                 psPtr data)
    349348{
    350349    if (table == NULL) {
     
    380379    The data associated with that key.
    381380 *****************************************************************************/
    382 void *psHashLookup(psHash* table,      // table to lookup key in
     381psPtr psHashLookup(psHash* table,      // table to lookup key in
    383382                   const char *key)     // key to lookup
    384383{
     
    409408    boolean value defining success or failure
    410409 *****************************************************************************/
    411 bool psHashRemove(psHash* table,
    412                   const char *key)
    413 {
    414     void *data = NULL;
    415     bool retVal = false;
     410psBool psHashRemove(psHash* table,
     411                    const char *key)
     412{
     413    psPtr data = NULL;
     414    psBool retVal = false;
    416415
    417416    if (table == NULL) {
Note: See TracChangeset for help on using the changeset viewer.