Index: trunk/psLib/src/sysUtils/psHash.c
===================================================================
--- trunk/psLib/src/sysUtils/psHash.c	(revision 494)
+++ trunk/psLib/src/sysUtils/psHash.c	(revision 560)
@@ -13,28 +13,12 @@
 #include "psTrace.h"
 
-// A bucket that holds an item of data
-typedef struct HashBucket
-{
-    char *key;    // key for this item of data
-    void *data;    // the data itself
-    struct HashBucket *next;  // list of other possible keys
-}
-HashBucket;
-
-// An entire hash table
-struct HashTable
-{
-    int nbucket;   // number of buckets
-    HashBucket **buckets;  // the buckets themselves
-};
-
-/******************************************************************************
-    Con/Destruct buckets
- *****************************************************************************/
-static HashBucket *hashBucketAlloc(const char *key,
-                                   void *data,
-                                   HashBucket *next)
-{
-    HashBucket *bucket = psAlloc(sizeof(HashBucket));
+/******************************************************************************
+    Construct buckets
+ *****************************************************************************/
+static psHashBucket *hashBucketAlloc(const char *key,
+                                     void *data,
+                                     psHashBucket *next)
+{
+    psHashBucket *bucket = psAlloc(sizeof(psHashBucket));
 
     bucket->key = psStringCopy(key);
@@ -46,10 +30,8 @@
 
 /******************************************************************************
- 
- *****************************************************************************/
-static void hashBucketFree(
-    HashBucket *bucket,   // bucket to free
-    void (*itemFree)(void *item)) // how to free hashed data;
-// or NULL
+    Destruct buckets
+ *****************************************************************************/
+static void hashBucketFree(psHashBucket *bucket,   // bucket to free
+                           void (*itemFree)(void *item)) // how to free data;
 {
     if (bucket == NULL)
@@ -75,5 +57,5 @@
 {
     psHash *table = psAlloc(sizeof(psHash));
-    table->buckets = psAlloc(nbucket*sizeof(HashBucket *));
+    table->buckets = psAlloc(nbucket*sizeof(psHashBucket *));
     table->nbucket = nbucket;
 
@@ -104,7 +86,7 @@
     {
         if (table->buckets[i] != NULL) {
-            HashBucket *ptr = table->buckets[i];
+            psHashBucket *ptr = table->buckets[i];
             while (ptr != NULL) {
-                HashBucket *tmp = ptr->next;
+                psHashBucket *tmp = ptr->next;
                 hashBucketFree(ptr, itemFree);
                 ptr = tmp;
@@ -124,13 +106,12 @@
     N.b. this is NOT a good hash function! See Knuth for some better ones
  *****************************************************************************/
-static void *doHashWork(
-    psHash *table,   // table to insert in
-    const char *key,   // key to use
-    void *data,    // data to insert,
-    // or (if NULL) retrieve/remove
-    int remove
-        ,    // remove the item from the list?
-        void (*itemFree)(void *item)) // how to free hashed data
-    // or NULL
+static void *doHashWork(psHash     *table,   // table to insert in
+                        const char *key,     // key to use
+                        void       *data,    // data to insert,
+                        // or (if NULL) retrieve/remove
+                        int remove
+                            ,          // remove the item from the list?
+                            void (*itemFree)(void *item))
+    // how to free hashed data
 {
     long int hash = 1;
@@ -142,12 +123,11 @@
     hash &= (table->nbucket - 1);
 
-    HashBucket *ptr = table->buckets[hash];
-    /*
-     * We've found the correct hash bucket, now we need to know what to do
-     */
+    psHashBucket *ptr = table->buckets[hash];
+
+    // We've found the correct hash bucket, now we need to know what to do
     if (data == NULL) {   // retrieve/remove
         if (remove
            ) {
-            HashBucket *optr = ptr;
+            psHashBucket *optr = ptr;
             while (ptr != NULL) {
                 if (strcmp(key, ptr->key) == 0) { // found it!
@@ -196,7 +176,6 @@
             }
         }
-        /*
-         * Not found, so insert at the front of the list
-         */
+
+        // Not found, so insert at the front of the list
         table->buckets[hash] = hashBucketAlloc(key, data, table->buckets[hash]);
 
@@ -208,9 +187,8 @@
     Insert a value into a hash table
  *****************************************************************************/
-void *psHashInsert(psHash *table, // table to insert in
+void *psHashInsert(psHash *table,   // table to insert in
                    const char *key, // key to use
-                   void *data,  // data to insert
+                   void *data,      // data to insert
                    void (*itemFree)(void *item)) // how to free hashed data;
-// or NULL
 {
     return doHashWork(table, key, data, 0, itemFree);
@@ -220,5 +198,5 @@
     Lookup a value in a hash table
  *****************************************************************************/
-void *psHashLookup(psHash *table, // table to lookup key in
+void *psHashLookup(psHash *table,   // table to lookup key in
                    const char *key) // key to lookup
 {
@@ -229,5 +207,5 @@
     Remove and return a value from a hash table
  *****************************************************************************/
-void *psHashRemove(psHash *table, // table to lookup key in
+void *psHashRemove(psHash *table,   // table to lookup key in
                    const char *key) // key to lookup
 {
