mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
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
This commit is contained in:
parent
9aadb1d583
commit
f9ba452081
@ -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;i<nedges;i++){
|
||||
printf("\nedge %d %d %d %d ",i,graph3->edges[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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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;i<nedges;i++){
|
||||
printf("\nedge %d %d %d %d ",i,graph3->edges[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));
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user