00001
00002
00003
00004
00005 #include "getentrieshashtable.h"
00006 #include "hashtable_private.h"
00007 #include "MALLOC.h"
00008 #include "hashtable_localization.h"
00009
00010 char **getTAGSinhashtable(struct hashtable *tableIN,int *numbersEntries)
00011 {
00012 char **return_entries=NULL;
00013 unsigned int i=0;
00014 unsigned int j=0;
00015 struct entry *e=NULL;
00016 struct entry **table = tableIN->table;
00017
00018 *numbersEntries=tableIN->entrycount;
00019 if (*numbersEntries>0)
00020 {
00021 return_entries=(char **)MALLOC(sizeof(char *)*tableIN->entrycount);
00022 if (return_entries)
00023 {
00024 j=0;
00025 for (i = 0; i < tableIN->tablelength; i++)
00026 {
00027 e = table[i];
00028 while (NULL != e)
00029 {
00030 struct key_string *Key=NULL;
00031 Key=e->k;
00032 return_entries[j]=(char *)MALLOC(sizeof(char)*(strlen(Key->Key_String)+1));
00033 if (return_entries[j]) strcpy(return_entries[j],Key->Key_String);
00034 e = e->next;
00035 j++;
00036 }
00037 }
00038 }
00039 }
00040 return return_entries;
00041 }
00042
00043 char **getSTRINGSinhashtable(struct hashtable *tableIN,int *numbersEntries)
00044 {
00045 char **return_entries=NULL;
00046 unsigned int i=0;
00047 unsigned int j=0;
00048 struct entry *e=NULL;
00049 struct entry **table = tableIN->table;
00050
00051 *numbersEntries=tableIN->entrycount;
00052 if (*numbersEntries>0)
00053 {
00054 return_entries=(char **)MALLOC(sizeof(char *)*tableIN->entrycount);
00055 if (return_entries)
00056 {
00057 j=0;
00058 for (i = 0; i < tableIN->tablelength; i++)
00059 {
00060 e = table[i];
00061 while (NULL != e)
00062 {
00063 struct value_string *Key=NULL;
00064 Key=e->v;
00065 return_entries[j]=(char *)MALLOC(sizeof(char)*(strlen(Key->Value_String)+1));
00066 if (return_entries[j]) strcpy(return_entries[j],Key->Value_String);
00067 e = e->next;
00068 j++;
00069 }
00070 }
00071 }
00072 }
00073 return return_entries;
00074 }
00075