]> pd.if.org Git - zpackage/blobdiff - lib/jsw/jsw_hlib.c
remove c++isms from jsw code
[zpackage] / lib / jsw / jsw_hlib.c
index 6cc961ae791bebaa5f46d1f4c395d22e4c3c7e03..a3a7a138352892bc9e84cc8f8a2df2f0a484fa38 100644 (file)
@@ -8,14 +8,7 @@
 */
 #include "jsw_hlib.h"
 
-#ifdef __cplusplus
-#include <cstdlib>
-
-using std::malloc;
-using std::free;
-#else
 #include <stdlib.h>
-#endif
 
 typedef struct jsw_node {
   void            *key;  /* Key used for searching */
@@ -44,7 +37,7 @@ struct jsw_hash {
 
 static jsw_node_t *new_node ( void *key, void *item, jsw_node_t *next )
 {
-  jsw_node_t *node = (jsw_node_t *)malloc ( sizeof *node );
+  jsw_node_t *node = malloc ( sizeof *node );
 
   if ( node == NULL )
     return NULL;
@@ -58,7 +51,7 @@ static jsw_node_t *new_node ( void *key, void *item, jsw_node_t *next )
 
 static jsw_head_t *new_chain ( void )
 {
-  jsw_head_t *chain = (jsw_head_t *)malloc ( sizeof *chain );
+  jsw_head_t *chain = malloc ( sizeof *chain );
 
   if ( chain == NULL )
     return NULL;
@@ -79,13 +72,13 @@ jsw_hash_t  *jsw_hnew ( size_t size, hash_f hash, cmp_f cmp,
   keydup_f keydup, itemdup_f itemdup,
   keyrel_f keyrel, itemrel_f itemrel )
 {
-  jsw_hash_t *htab = (jsw_hash_t *)malloc ( sizeof *htab );
+  jsw_hash_t *htab = malloc ( sizeof *htab );
   size_t i;
 
   if ( htab == NULL )
     return NULL;
 
-  htab->table = (jsw_head_t **)malloc ( size * sizeof *htab->table );
+  htab->table = malloc ( size * sizeof *htab->table );
 
   if ( htab->table == NULL ) {
     free ( htab );
@@ -385,7 +378,7 @@ jsw_hstat_t *jsw_hstat ( jsw_hash_t *htab )
   if ( htab->size == 0 )
     return NULL;
 
-  stat = (jsw_hstat_t *)malloc ( sizeof *stat );
+  stat = malloc ( sizeof *stat );
 
   if ( stat == NULL )
     return NULL;