OCI_HashTable * OCI_API OCI_HashCreate ( unsigned int size, unsigned int type ) { OCI_HashTable *table = NULL; OCI_LIB_CALL_ENTER(OCI_HashTable*, table) OCI_CHECK_ENUM_VALUE(NULL, NULL, type, HashTypeValues, OTEXT("Hash type")); /* allocate table structure */ table = (OCI_HashTable *) OCI_MemAlloc(OCI_IPC_HASHTABLE, sizeof(*table), (size_t) 1, TRUE); /* set up attributes and allocate internal array of hash entry pointers */ if (table) { table->type = type; table->size = 0; table->count = 0; table->items = (OCI_HashEntry **) OCI_MemAlloc(OCI_IPC_HASHENTRY_ARRAY, sizeof(*table->items), (size_t) size, TRUE); if (table->items) { table->size = size; call_status = TRUE; } } if (call_status) { call_retval = table; } else if (table) { OCI_HashFree(table); } OCI_LIB_CALL_EXIT() }
OCI_HashTable * OCI_API OCI_HashCreate ( unsigned int size, unsigned int type ) { OCI_HashTable *table = NULL; boolean res = TRUE; /* allocate table structure */ table = (OCI_HashTable *) OCI_MemAlloc(OCI_IPC_HASHTABLE, sizeof(*table), (size_t) 1, TRUE); /* set up attributes and allocate internal array of hash entry pointers */ if (table != NULL) { table->size = size; table->type = type; table->count = 0; table->items = (OCI_HashEntry **) OCI_MemAlloc(OCI_IPC_HASHENTRY_ARRAY, sizeof(*table->items), (size_t) size, TRUE); res = (table->items != NULL); } else { res = FALSE; } if (res == FALSE) { OCI_HashFree(table); } OCI_RESULT(res); return table; }