From 0007b3ec76bafa732201ad96eccdf8b5626fe3fd Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 2 Dec 2010 11:34:46 -0500 Subject: cmph: Squash a lot of gcc -Wall compiler warnings * Functions taking no parameters need to explicitly say (void). * Mark some functions as static that are * Comment out an unused function in bdz.c * Change loop indicies "i" to be unsigned if our limit is unsigned --- girepository/cmph/bdz.c | 8 +++++--- girepository/cmph/bdz.h | 2 +- girepository/cmph/bdz_ph.c | 4 ++-- girepository/cmph/bdz_ph.h | 2 +- girepository/cmph/bmz.c | 2 +- girepository/cmph/bmz.h | 2 +- girepository/cmph/bmz8.c | 2 +- girepository/cmph/bmz8.h | 2 +- girepository/cmph/brz.c | 2 +- girepository/cmph/brz.h | 2 +- girepository/cmph/buffer_entry.c | 2 +- girepository/cmph/chd_ph.c | 4 ++-- girepository/cmph/chd_ph.h | 2 +- girepository/cmph/chm.c | 2 +- girepository/cmph/chm.h | 2 +- girepository/cmph/fch.h | 2 +- girepository/cmph/fch_buckets.c | 2 +- girepository/cmph/jenkins_hash.c | 4 ++-- girepository/cmph/jenkins_hash.h | 2 +- girepository/cmph/vstack.c | 2 +- girepository/cmph/vstack.h | 2 +- 21 files changed, 28 insertions(+), 26 deletions(-) diff --git a/girepository/cmph/bdz.c b/girepository/cmph/bdz.c index f422c8f9..a57f70f8 100755 --- a/girepository/cmph/bdz.c +++ b/girepository/cmph/bdz.c @@ -107,7 +107,7 @@ static void bdz_add_edge(bdz_graph3_t * graph3, cmph_uint32 v0, cmph_uint32 v1, static void bdz_dump_graph(bdz_graph3_t* graph3, cmph_uint32 nedges, cmph_uint32 nvertices) { - int i; + cmph_uint32 i; for(i=0;iedges[i].vertices[0], graph3->edges[i].vertices[1],graph3->edges[i].vertices[2]); @@ -216,7 +216,7 @@ static void assigning(bdz_config_data_t *bdz, bdz_graph3_t* graph3, bdz_queue_t static void ranking(bdz_config_data_t *bdz); static cmph_uint32 rank(cmph_uint32 b, cmph_uint32 * ranktable, cmph_uint8 * g, cmph_uint32 vertex); -bdz_config_data_t *bdz_config_new() +bdz_config_data_t *bdz_config_new(void) { bdz_config_data_t *bdz; bdz = (bdz_config_data_t *)malloc(sizeof(bdz_config_data_t)); @@ -560,7 +560,8 @@ void bdz_load(FILE *f, cmph_t *mphf) } -cmph_uint32 bdz_search_ph(cmph_t *mphf, const char *key, cmph_uint32 keylen) +/* +static cmph_uint32 bdz_search_ph(cmph_t *mphf, const char *key, cmph_uint32 keylen) { bdz_data_t *bdz = mphf->data; cmph_uint32 hl[3]; @@ -572,6 +573,7 @@ cmph_uint32 bdz_search_ph(cmph_t *mphf, const char *key, cmph_uint32 keylen) vertex = hl[(GETVALUE(bdz->g, hl[0]) + GETVALUE(bdz->g, hl[1]) + GETVALUE(bdz->g, hl[2])) % 3]; return vertex; } +*/ static inline cmph_uint32 rank(cmph_uint32 b, cmph_uint32 * ranktable, cmph_uint8 * g, cmph_uint32 vertex) { diff --git a/girepository/cmph/bdz.h b/girepository/cmph/bdz.h index f2b7b89c..7116933b 100755 --- a/girepository/cmph/bdz.h +++ b/girepository/cmph/bdz.h @@ -6,7 +6,7 @@ typedef struct __bdz_data_t bdz_data_t; typedef struct __bdz_config_data_t bdz_config_data_t; -bdz_config_data_t *bdz_config_new(); +bdz_config_data_t *bdz_config_new(void); void bdz_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs); void bdz_config_destroy(cmph_config_t *mph); void bdz_config_set_b(cmph_config_t *mph, cmph_uint32 b); diff --git a/girepository/cmph/bdz_ph.c b/girepository/cmph/bdz_ph.c index 49cf5646..16257c0f 100755 --- a/girepository/cmph/bdz_ph.c +++ b/girepository/cmph/bdz_ph.c @@ -94,7 +94,7 @@ static void bdz_ph_add_edge(bdz_ph_graph3_t * graph3, cmph_uint32 v0, cmph_uint3 static void bdz_ph_dump_graph(bdz_ph_graph3_t* graph3, cmph_uint32 nedges, cmph_uint32 nvertices) { - int i; + cmph_uint32 i; for(i=0;iedges[i].vertices[0], graph3->edges[i].vertices[1],graph3->edges[i].vertices[2]); @@ -202,7 +202,7 @@ static int bdz_ph_mapping(cmph_config_t *mph, bdz_ph_graph3_t* graph3, bdz_ph_qu static void assigning(bdz_ph_config_data_t *bdz_ph, bdz_ph_graph3_t* graph3, bdz_ph_queue_t queue); static void bdz_ph_optimization(bdz_ph_config_data_t *bdz_ph); -bdz_ph_config_data_t *bdz_ph_config_new() +bdz_ph_config_data_t *bdz_ph_config_new(void) { bdz_ph_config_data_t *bdz_ph; bdz_ph = (bdz_ph_config_data_t *)malloc(sizeof(bdz_ph_config_data_t)); diff --git a/girepository/cmph/bdz_ph.h b/girepository/cmph/bdz_ph.h index 73cce2ed..67b1facb 100755 --- a/girepository/cmph/bdz_ph.h +++ b/girepository/cmph/bdz_ph.h @@ -6,7 +6,7 @@ typedef struct __bdz_ph_data_t bdz_ph_data_t; typedef struct __bdz_ph_config_data_t bdz_ph_config_data_t; -bdz_ph_config_data_t *bdz_ph_config_new(); +bdz_ph_config_data_t *bdz_ph_config_new(void); void bdz_ph_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs); void bdz_ph_config_destroy(cmph_config_t *mph); cmph_t *bdz_ph_new(cmph_config_t *mph, double c); diff --git a/girepository/cmph/bmz.c b/girepository/cmph/bmz.c index 51798a18..3eabfb7f 100644 --- a/girepository/cmph/bmz.c +++ b/girepository/cmph/bmz.c @@ -20,7 +20,7 @@ static cmph_uint8 bmz_traverse_critical_nodes(bmz_config_data_t *bmz, cmph_uint3 static cmph_uint8 bmz_traverse_critical_nodes_heuristic(bmz_config_data_t *bmz, cmph_uint32 v, cmph_uint32 * biggest_g_value, cmph_uint32 * biggest_edge_value, cmph_uint8 * used_edges, cmph_uint8 * visited); static void bmz_traverse_non_critical_nodes(bmz_config_data_t *bmz, cmph_uint8 * used_edges, cmph_uint8 * visited); -bmz_config_data_t *bmz_config_new() +bmz_config_data_t *bmz_config_new(void) { bmz_config_data_t *bmz = NULL; bmz = (bmz_config_data_t *)malloc(sizeof(bmz_config_data_t)); diff --git a/girepository/cmph/bmz.h b/girepository/cmph/bmz.h index ee5f61dd..9821aa88 100644 --- a/girepository/cmph/bmz.h +++ b/girepository/cmph/bmz.h @@ -6,7 +6,7 @@ typedef struct __bmz_data_t bmz_data_t; typedef struct __bmz_config_data_t bmz_config_data_t; -bmz_config_data_t *bmz_config_new(); +bmz_config_data_t *bmz_config_new(void); void bmz_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs); void bmz_config_destroy(cmph_config_t *mph); cmph_t *bmz_new(cmph_config_t *mph, double c); diff --git a/girepository/cmph/bmz8.c b/girepository/cmph/bmz8.c index 203f4fc1..4db4dfce 100644 --- a/girepository/cmph/bmz8.c +++ b/girepository/cmph/bmz8.c @@ -19,7 +19,7 @@ static cmph_uint8 bmz8_traverse_critical_nodes(bmz8_config_data_t *bmz8, cmph_ui static cmph_uint8 bmz8_traverse_critical_nodes_heuristic(bmz8_config_data_t *bmz8, cmph_uint32 v, cmph_uint8 * biggest_g_value, cmph_uint8 * biggest_edge_value, cmph_uint8 * used_edges, cmph_uint8 * visited); static void bmz8_traverse_non_critical_nodes(bmz8_config_data_t *bmz8, cmph_uint8 * used_edges, cmph_uint8 * visited); -bmz8_config_data_t *bmz8_config_new() +bmz8_config_data_t *bmz8_config_new(void) { bmz8_config_data_t *bmz8; bmz8 = (bmz8_config_data_t *)malloc(sizeof(bmz8_config_data_t)); diff --git a/girepository/cmph/bmz8.h b/girepository/cmph/bmz8.h index 5456759e..99f7e30d 100644 --- a/girepository/cmph/bmz8.h +++ b/girepository/cmph/bmz8.h @@ -6,7 +6,7 @@ typedef struct __bmz8_data_t bmz8_data_t; typedef struct __bmz8_config_data_t bmz8_config_data_t; -bmz8_config_data_t *bmz8_config_new(); +bmz8_config_data_t *bmz8_config_new(void); void bmz8_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs); void bmz8_config_destroy(cmph_config_t *mph); cmph_t *bmz8_new(cmph_config_t *mph, double c); diff --git a/girepository/cmph/brz.c b/girepository/cmph/brz.c index eb89ac06..f9c48ef7 100755 --- a/girepository/cmph/brz.c +++ b/girepository/cmph/brz.c @@ -24,7 +24,7 @@ static cmph_uint32 brz_min_index(cmph_uint32 * vector, cmph_uint32 n); static void brz_destroy_keys_vd(cmph_uint8 ** keys_vd, cmph_uint32 nkeys); static char * brz_copy_partial_fch_mphf(brz_config_data_t *brz, fch_data_t * fchf, cmph_uint32 index, cmph_uint32 *buflen); static char * brz_copy_partial_bmz8_mphf(brz_config_data_t *brz, bmz8_data_t * bmzf, cmph_uint32 index, cmph_uint32 *buflen); -brz_config_data_t *brz_config_new() +brz_config_data_t *brz_config_new(void) { brz_config_data_t *brz = NULL; brz = (brz_config_data_t *)malloc(sizeof(brz_config_data_t)); diff --git a/girepository/cmph/brz.h b/girepository/cmph/brz.h index ac07ed76..648f174b 100644 --- a/girepository/cmph/brz.h +++ b/girepository/cmph/brz.h @@ -6,7 +6,7 @@ typedef struct __brz_data_t brz_data_t; typedef struct __brz_config_data_t brz_config_data_t; -brz_config_data_t *brz_config_new(); +brz_config_data_t *brz_config_new(void); void brz_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs); void brz_config_set_tmp_dir(cmph_config_t *mph, cmph_uint8 *tmp_dir); void brz_config_set_mphf_fd(cmph_config_t *mph, FILE *mphf_fd); diff --git a/girepository/cmph/buffer_entry.c b/girepository/cmph/buffer_entry.c index 7f82aae1..5dcc4d57 100644 --- a/girepository/cmph/buffer_entry.c +++ b/girepository/cmph/buffer_entry.c @@ -43,7 +43,7 @@ cmph_uint32 buffer_entry_get_capacity(buffer_entry_t * buffer_entry) return buffer_entry->capacity; } -void buffer_entry_load(buffer_entry_t * buffer_entry) +static void buffer_entry_load(buffer_entry_t * buffer_entry) { free(buffer_entry->buff); buffer_entry->buff = (cmph_uint8 *)calloc((size_t)buffer_entry->capacity, sizeof(cmph_uint8)); diff --git a/girepository/cmph/chd_ph.c b/girepository/cmph/chd_ph.c index b34415b9..71f83fbd 100644 --- a/girepository/cmph/chd_ph.c +++ b/girepository/cmph/chd_ph.c @@ -77,7 +77,7 @@ void chd_ph_bucket_clean(chd_ph_bucket_t * buckets, cmph_uint32 nbuckets) for(i = 0; i < nbuckets; i++) buckets[i].size = 0; } -cmph_uint8 chd_ph_bucket_insert(chd_ph_bucket_t * buckets,chd_ph_map_item_t * map_items, chd_ph_item_t * items, +static cmph_uint8 chd_ph_bucket_insert(chd_ph_bucket_t * buckets,chd_ph_map_item_t * map_items, chd_ph_item_t * items, cmph_uint32 nbuckets,cmph_uint32 item_idx) { register cmph_uint32 i = 0; @@ -141,7 +141,7 @@ static inline double chd_ph_get_entropy(cmph_uint32 * disp_table, cmph_uint32 n, return entropy; }; -chd_ph_config_data_t *chd_ph_config_new() +chd_ph_config_data_t *chd_ph_config_new(void) { chd_ph_config_data_t *chd_ph; chd_ph = (chd_ph_config_data_t *)malloc(sizeof(chd_ph_config_data_t)); diff --git a/girepository/cmph/chd_ph.h b/girepository/cmph/chd_ph.h index d2bdb028..03e4087c 100644 --- a/girepository/cmph/chd_ph.h +++ b/girepository/cmph/chd_ph.h @@ -7,7 +7,7 @@ typedef struct __chd_ph_data_t chd_ph_data_t; typedef struct __chd_ph_config_data_t chd_ph_config_data_t; /* Config API */ -chd_ph_config_data_t *chd_ph_config_new(); +chd_ph_config_data_t *chd_ph_config_new(void); void chd_ph_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs); /** \fn void chd_ph_config_set_keys_per_bin(cmph_config_t *mph, cmph_uint32 keys_per_bin); diff --git a/girepository/cmph/chm.c b/girepository/cmph/chm.c index e03cca80..9cdbf41b 100644 --- a/girepository/cmph/chm.c +++ b/girepository/cmph/chm.c @@ -17,7 +17,7 @@ static int chm_gen_edges(cmph_config_t *mph); static void chm_traverse(chm_config_data_t *chm, cmph_uint8 *visited, cmph_uint32 v); -chm_config_data_t *chm_config_new() +chm_config_data_t *chm_config_new(void) { chm_config_data_t *chm = NULL; chm = (chm_config_data_t *)malloc(sizeof(chm_config_data_t)); diff --git a/girepository/cmph/chm.h b/girepository/cmph/chm.h index 341be29e..392d23aa 100644 --- a/girepository/cmph/chm.h +++ b/girepository/cmph/chm.h @@ -6,7 +6,7 @@ typedef struct __chm_data_t chm_data_t; typedef struct __chm_config_data_t chm_config_data_t; -chm_config_data_t *chm_config_new(); +chm_config_data_t *chm_config_new(void); void chm_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs); void chm_config_destroy(cmph_config_t *mph); cmph_t *chm_new(cmph_config_t *mph, double c); diff --git a/girepository/cmph/fch.h b/girepository/cmph/fch.h index ec4f0f5b..9d13a1c1 100644 --- a/girepository/cmph/fch.h +++ b/girepository/cmph/fch.h @@ -12,7 +12,7 @@ double fch_calc_p1(cmph_uint32 m); double fch_calc_p2(cmph_uint32 b); cmph_uint32 mixh10h11h12(cmph_uint32 b, double p1, double p2, cmph_uint32 initial_index); -fch_config_data_t *fch_config_new(); +fch_config_data_t *fch_config_new(void); void fch_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs); void fch_config_destroy(cmph_config_t *mph); cmph_t *fch_new(cmph_config_t *mph, double c); diff --git a/girepository/cmph/fch_buckets.c b/girepository/cmph/fch_buckets.c index 24b98e67..a588f147 100644 --- a/girepository/cmph/fch_buckets.c +++ b/girepository/cmph/fch_buckets.c @@ -172,7 +172,7 @@ cmph_uint32 fch_buckets_get_nbuckets(fch_buckets_t * buckets) cmph_uint32 * fch_buckets_get_indexes_sorted_by_size(fch_buckets_t * buckets) { - int i = 0; + cmph_uint32 i = 0; cmph_uint32 sum = 0, value; cmph_uint32 *nbuckets_size = (cmph_uint32 *) calloc((size_t)buckets->max_size + 1, sizeof(cmph_uint32)); cmph_uint32 * sorted_indexes = (cmph_uint32 *) calloc((size_t)buckets->nbuckets, sizeof(cmph_uint32)); diff --git a/girepository/cmph/jenkins_hash.c b/girepository/cmph/jenkins_hash.c index f5233a5a..65cdff95 100644 --- a/girepository/cmph/jenkins_hash.c +++ b/girepository/cmph/jenkins_hash.c @@ -97,7 +97,7 @@ void jenkins_state_destroy(jenkins_state_t *state) } -inline void __jenkins_hash_vector(cmph_uint32 seed, const char *k, cmph_uint32 keylen, cmph_uint32 * hashes) +static inline void __jenkins_hash_vector(cmph_uint32 seed, const char *k, cmph_uint32 keylen, cmph_uint32 * hashes) { register cmph_uint32 len, length; @@ -266,7 +266,7 @@ void jenkins_state_pack(jenkins_state_t *state, void *jenkins_packed) * \brief Return the amount of space needed to pack a jenkins function. * \return the size of the packed function or zero for failures */ -cmph_uint32 jenkins_state_packed_size() +cmph_uint32 jenkins_state_packed_size(void) { return sizeof(cmph_uint32); } diff --git a/girepository/cmph/jenkins_hash.h b/girepository/cmph/jenkins_hash.h index 8e8b9173..39626e20 100644 --- a/girepository/cmph/jenkins_hash.h +++ b/girepository/cmph/jenkins_hash.h @@ -43,7 +43,7 @@ void jenkins_state_pack(jenkins_state_t *state, void *jenkins_packed); * \brief Return the amount of space needed to pack a jenkins function. * \return the size of the packed function or zero for failures */ -cmph_uint32 jenkins_state_packed_size(); +cmph_uint32 jenkins_state_packed_size(void); /** \fn cmph_uint32 jenkins_hash_packed(void *jenkins_packed, const char *k, cmph_uint32 keylen); diff --git a/girepository/cmph/vstack.c b/girepository/cmph/vstack.c index 24555cd6..96f5380a 100644 --- a/girepository/cmph/vstack.c +++ b/girepository/cmph/vstack.c @@ -13,7 +13,7 @@ struct __vstack_t cmph_uint32 capacity; }; -vstack_t *vstack_new() +vstack_t *vstack_new(void) { vstack_t *stack = (vstack_t *)malloc(sizeof(vstack_t)); assert(stack); diff --git a/girepository/cmph/vstack.h b/girepository/cmph/vstack.h index 1cefaaff..fecc7d55 100644 --- a/girepository/cmph/vstack.h +++ b/girepository/cmph/vstack.h @@ -4,7 +4,7 @@ #include "cmph_types.h" typedef struct __vstack_t vstack_t; -vstack_t *vstack_new(); +vstack_t *vstack_new(void); void vstack_destroy(vstack_t *stack); void vstack_push(vstack_t *stack, cmph_uint32 val); -- cgit v1.2.1