changeset 35:dc1e44b0d702 PR_univ

updated include paths
author Sean Halle <seanhalle@yahoo.com>
date Thu, 19 Sep 2013 23:59:36 -0700
parents 049a8d8917c5
children fd25f8700c9c
files PrivateHash.c PrivateHash.h prhash.h
diffstat 3 files changed, 98 insertions(+), 98 deletions(-) [+]
line diff
     1.1 --- a/PrivateHash.c	Tue Jul 23 07:38:54 2013 -0700
     1.2 +++ b/PrivateHash.c	Thu Sep 19 23:59:36 2013 -0700
     1.3 @@ -6,8 +6,8 @@
     1.4   * Author: seanhalle@yahoo.com
     1.5   */
     1.6  
     1.7 -#include "PrivateHash.h"
     1.8 -#include "PR__common_includes/Services_offered_by_PR/Memory_Handling/vmalloc__wrapper_library.h"
     1.9 +#include <PR__include/prhash.h>
    1.10 +#include <PR__include/prmalloc.h>
    1.11  
    1.12  HashTable *
    1.13  makeHashTable( int numHashSlots, FreeEntryContentFnPtr freeFn )
     2.1 --- a/PrivateHash.h	Tue Jul 23 07:38:54 2013 -0700
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,96 +0,0 @@
     2.4 -/*
     2.5 - *  Copyright 2009 OpenSourceResearchInstitute.org
     2.6 - *  Licensed under GNU General Public License version 2
     2.7 - *
     2.8 - * Author: seanhalle@yahoo.com
     2.9 - */
    2.10 -
    2.11 -#ifndef _PRIVATE_HASH_H
    2.12 -#define	_PRIVATE_HASH_H
    2.13 -
    2.14 -#include <stdio.h>
    2.15 -#include <string.h>
    2.16 -#include <errno.h>
    2.17 -#include <stdlib.h>
    2.18 -
    2.19 -#include "PR__common_includes/PR__primitive_data_types.h"
    2.20 -
    2.21 -//=====================  defines  =====================
    2.22 -#define TRUE     1
    2.23 -#define FALSE    0
    2.24 -
    2.25 -#define DEFAULT_HASH_TABLE_SIZE 1 << 10
    2.26 -#define DEFAULT_POWER_OF_2_TABLE_SIZE 10
    2.27 -
    2.28 -
    2.29 -//=====================  structs  =====================
    2.30 -union hashkey_t{
    2.31 -    char hashable[8];
    2.32 -    int32 parts[2];
    2.33 -};
    2.34 -
    2.35 -typedef union hashkey_t hashkey_t;
    2.36 -
    2.37 -typedef struct _HashEntry HashEntry;
    2.38 -
    2.39 -struct _HashEntry
    2.40 - {
    2.41 -   char       *key;
    2.42 -   void       *content;
    2.43 -   HashEntry  *next;
    2.44 - };
    2.45 -
    2.46 -typedef void (*FreeEntryContentFnPtr)    ( void * );
    2.47 -
    2.48 -typedef struct
    2.49 - { int32       tableSz;
    2.50 -   int32       numEntries;
    2.51 -   HashEntry* *entries;
    2.52 -   int32       hashMask;
    2.53 -   int32       prevHash;
    2.54 -   FreeEntryContentFnPtr freeEntryContentFn;
    2.55 - }
    2.56 -HashTable;
    2.57 -
    2.58 -
    2.59 -//===========================================================================
    2.60 -//   Public functions
    2.61 -HashTable   *makeHashTable( int numHashSlots, FreeEntryContentFnPtr freeFn );
    2.62 -
    2.63 -int32        putEntryIntoTable( HashEntry *entry, HashTable *table);
    2.64 -int32        addValueIntoTable( char* key, void *value, HashTable *table);
    2.65 -HashEntry   *getEntryFromTable( char *key, HashTable *table );
    2.66 -void        *getValueFromTable( char *key, HashTable *table );
    2.67 -
    2.68 -bool8        deleteEntryFromTable( char *key, HashTable *table );
    2.69 -bool8        deleteThisEntryFromTable( HashEntry *entry, HashTable *table );
    2.70 -bool8        deleteEntrysValueInTable( char *key, HashTable *table );
    2.71 -bool8        deleteEntryFromTableAndFreeValue( char *key, HashTable *table );
    2.72 -void         freeHashTable( HashTable *table );
    2.73 -//char        *paramBagToString( ParamBag * bag )
    2.74 -
    2.75 -//================= Same Fns, but for 32b array key hash fn ================
    2.76 -HashTable *makeHashTable32(int32 powerOf2OfSz, FreeEntryContentFnPtr freeFn);
    2.77 -HashTable *makeDefaultSizeHashTable32( FreeEntryContentFnPtr freeFn );
    2.78 -
    2.79 -int32      putEntryIntoTable32( HashEntry *entry, HashTable *table);
    2.80 -HashEntry *addValueIntoTable32( uint32 key[], void *value, HashTable *table);
    2.81 -HashEntry *getEntryFromTable32( uint32 key[], HashTable *table );
    2.82 -void      *getValueFromTable32( uint32 key[], HashTable *table );
    2.83 -
    2.84 -bool32     deleteEntryFromTable32( uint32 key[], HashTable *table );
    2.85 -
    2.86 -//===========================================================================
    2.87 -//   Internal functions
    2.88 -void         freeHashEntryUsing( HashEntry *entry, HashTable *table );
    2.89 -unsigned int hashThisKey( char *s, int hashSz );
    2.90 -void         nullOutTablesArray( HashTable *table );
    2.91 -void         doubleTableSize( HashTable *table );
    2.92 -void         freeHashEntryButNotContent( HashEntry *entry );
    2.93 -
    2.94 -uint32 
    2.95 -jenkHash32( const uint32  *key,     /* array of uint32 values */
    2.96 -                   int32   length);  /* num uint32 in the key */
    2.97 -        
    2.98 -#endif	/* _PRIVATE_HASH_H */
    2.99 -
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/prhash.h	Thu Sep 19 23:59:36 2013 -0700
     3.3 @@ -0,0 +1,96 @@
     3.4 +/*
     3.5 + *  Copyright 2009 OpenSourceResearchInstitute.org
     3.6 + *  Licensed under GNU General Public License version 2
     3.7 + *
     3.8 + * Author: seanhalle@yahoo.com
     3.9 + */
    3.10 +
    3.11 +#ifndef _PRHASH_H
    3.12 +#define	_PRHASH_H
    3.13 +
    3.14 +#include <stdio.h>
    3.15 +#include <string.h>
    3.16 +#include <errno.h>
    3.17 +#include <stdlib.h>
    3.18 +
    3.19 +#include <PR__include/PR__primitive_data_types.h>
    3.20 +
    3.21 +//=====================  defines  =====================
    3.22 +#define TRUE     1
    3.23 +#define FALSE    0
    3.24 +
    3.25 +#define DEFAULT_HASH_TABLE_SIZE 1 << 10
    3.26 +#define DEFAULT_POWER_OF_2_TABLE_SIZE 10
    3.27 +
    3.28 +
    3.29 +//=====================  structs  =====================
    3.30 +union hashkey_t{
    3.31 +    char hashable[8];
    3.32 +    int32 parts[2];
    3.33 +};
    3.34 +
    3.35 +typedef union hashkey_t hashkey_t;
    3.36 +
    3.37 +typedef struct _HashEntry HashEntry;
    3.38 +
    3.39 +struct _HashEntry
    3.40 + {
    3.41 +   char       *key;
    3.42 +   void       *content;
    3.43 +   HashEntry  *next;
    3.44 + };
    3.45 +
    3.46 +typedef void (*FreeEntryContentFnPtr)    ( void * );
    3.47 +
    3.48 +typedef struct
    3.49 + { int32       tableSz;
    3.50 +   int32       numEntries;
    3.51 +   HashEntry* *entries;
    3.52 +   int32       hashMask;
    3.53 +   int32       prevHash;
    3.54 +   FreeEntryContentFnPtr freeEntryContentFn;
    3.55 + }
    3.56 +HashTable;
    3.57 +
    3.58 +
    3.59 +//===========================================================================
    3.60 +//   Public functions
    3.61 +HashTable   *makeHashTable( int numHashSlots, FreeEntryContentFnPtr freeFn );
    3.62 +
    3.63 +int32        putEntryIntoTable( HashEntry *entry, HashTable *table);
    3.64 +int32        addValueIntoTable( char* key, void *value, HashTable *table);
    3.65 +HashEntry   *getEntryFromTable( char *key, HashTable *table );
    3.66 +void        *getValueFromTable( char *key, HashTable *table );
    3.67 +
    3.68 +bool8        deleteEntryFromTable( char *key, HashTable *table );
    3.69 +bool8        deleteThisEntryFromTable( HashEntry *entry, HashTable *table );
    3.70 +bool8        deleteEntrysValueInTable( char *key, HashTable *table );
    3.71 +bool8        deleteEntryFromTableAndFreeValue( char *key, HashTable *table );
    3.72 +void         freeHashTable( HashTable *table );
    3.73 +//char        *paramBagToString( ParamBag * bag )
    3.74 +
    3.75 +//================= Same Fns, but for 32b array key hash fn ================
    3.76 +HashTable *makeHashTable32(int32 powerOf2OfSz, FreeEntryContentFnPtr freeFn);
    3.77 +HashTable *makeDefaultSizeHashTable32( FreeEntryContentFnPtr freeFn );
    3.78 +
    3.79 +int32      putEntryIntoTable32( HashEntry *entry, HashTable *table);
    3.80 +HashEntry *addValueIntoTable32( uint32 key[], void *value, HashTable *table);
    3.81 +HashEntry *getEntryFromTable32( uint32 key[], HashTable *table );
    3.82 +void      *getValueFromTable32( uint32 key[], HashTable *table );
    3.83 +
    3.84 +bool32     deleteEntryFromTable32( uint32 key[], HashTable *table );
    3.85 +
    3.86 +//===========================================================================
    3.87 +//   Internal functions
    3.88 +void         freeHashEntryUsing( HashEntry *entry, HashTable *table );
    3.89 +unsigned int hashThisKey( char *s, int hashSz );
    3.90 +void         nullOutTablesArray( HashTable *table );
    3.91 +void         doubleTableSize( HashTable *table );
    3.92 +void         freeHashEntryButNotContent( HashEntry *entry );
    3.93 +
    3.94 +uint32 
    3.95 +jenkHash32( const uint32  *key,     /* array of uint32 values */
    3.96 +                   int32   length);  /* num uint32 in the key */
    3.97 +        
    3.98 +#endif	/* _PRIVATE_HASH_H */
    3.99 +