Fix more warning-addition fallout

I'm normally a big fan of small atomic commits, but I also want to get
things done this afternoon...

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=687441
Reviewed-by: Colin Walters <walters@verbum.org>
This commit is contained in:
Simon McVittie 2012-11-02 15:45:14 +00:00
parent 733acc2316
commit 837db1a026
8 changed files with 33 additions and 24 deletions

View File

@ -51,7 +51,7 @@ gint alive;
char *argv0; char *argv0;
#endif #endif
GPid static GPid
get_a_child (gint ttl) get_a_child (gint ttl)
{ {
GPid pid; GPid pid;
@ -89,7 +89,7 @@ get_a_child (gint ttl)
#endif /* G_OS_WIN32 */ #endif /* G_OS_WIN32 */
} }
gboolean static gboolean
child_watch_callback (GPid pid, gint status, gpointer data) child_watch_callback (GPid pid, gint status, gpointer data)
{ {
#ifdef VERBOSE #ifdef VERBOSE

View File

@ -15,7 +15,7 @@ static void
test_small_writes (void) test_small_writes (void)
{ {
GIOChannel *io; GIOChannel *io;
GIOStatus status; GIOStatus status = G_IO_STATUS_ERROR;
guint cnt; guint cnt;
gchar tmp; gchar tmp;
GError *error = NULL; GError *error = NULL;

View File

@ -54,7 +54,7 @@ struct _TestData
static void cleanup_crawlers (GMainContext *context); static void cleanup_crawlers (GMainContext *context);
gboolean static gboolean
read_all (GIOChannel *channel, char *buf, gsize len) read_all (GIOChannel *channel, char *buf, gsize len)
{ {
gsize bytes_read = 0; gsize bytes_read = 0;
@ -78,7 +78,7 @@ read_all (GIOChannel *channel, char *buf, gsize len)
return TRUE; return TRUE;
} }
gboolean static gboolean
write_all (GIOChannel *channel, char *buf, gsize len) write_all (GIOChannel *channel, char *buf, gsize len)
{ {
gsize bytes_written = 0; gsize bytes_written = 0;
@ -97,7 +97,7 @@ write_all (GIOChannel *channel, char *buf, gsize len)
return TRUE; return TRUE;
} }
gboolean static gboolean
adder_callback (GIOChannel *source, adder_callback (GIOChannel *source,
GIOCondition condition, GIOCondition condition,
gpointer data) gpointer data)
@ -122,7 +122,7 @@ adder_callback (GIOChannel *source,
return TRUE; return TRUE;
} }
gboolean static gboolean
timeout_callback (gpointer data) timeout_callback (gpointer data)
{ {
AddrData *addr_data = data; AddrData *addr_data = data;
@ -132,7 +132,7 @@ timeout_callback (gpointer data)
return TRUE; return TRUE;
} }
gpointer static gpointer
adder_thread (gpointer data) adder_thread (gpointer data)
{ {
GMainContext *context; GMainContext *context;
@ -194,7 +194,7 @@ adder_thread (gpointer data)
return NULL; return NULL;
} }
void static void
io_pipe (GIOChannel **channels) io_pipe (GIOChannel **channels)
{ {
gint fds[2]; gint fds[2];
@ -212,7 +212,7 @@ io_pipe (GIOChannel **channels)
g_io_channel_set_close_on_unref (channels[1], TRUE); g_io_channel_set_close_on_unref (channels[1], TRUE);
} }
void static void
do_add (GIOChannel *in, gint a, gint b) do_add (GIOChannel *in, gint a, gint b)
{ {
char buf1[32]; char buf1[32];
@ -225,7 +225,7 @@ do_add (GIOChannel *in, gint a, gint b)
write_all (in, buf2, 32); write_all (in, buf2, 32);
} }
gboolean static gboolean
adder_response (GIOChannel *source, adder_response (GIOChannel *source,
GIOCondition condition, GIOCondition condition,
gpointer data) gpointer data)
@ -261,7 +261,7 @@ adder_response (GIOChannel *source,
return TRUE; return TRUE;
} }
void static void
create_adder_thread (void) create_adder_thread (void)
{ {
GError *err = NULL; GError *err = NULL;

View File

@ -32,6 +32,8 @@
gchar* global_state; gchar* global_state;
G_MODULE_EXPORT void g_clash_func (void);
G_MODULE_EXPORT void G_MODULE_EXPORT void
g_clash_func (void) g_clash_func (void)
{ {

View File

@ -112,13 +112,15 @@ int
main (int argc, main (int argc,
char *argv[]) char *argv[])
{ {
GThread *threads[N_THREADS]; G_GNUC_UNUSED GThread *threads[N_THREADS];
int i; int i;
void *p;
/* test simple initializer */ /* test simple initializer */
initializer1(); initializer1();
initializer1(); initializer1();
/* test pointer initializer */ /* test pointer initializer */
void *p = initializer2(); p = initializer2();
g_assert (p == &dummy_value); g_assert (p == &dummy_value);
p = initializer2(); p = initializer2();
g_assert (p == &dummy_value); g_assert (p == &dummy_value);

View File

@ -37,7 +37,7 @@ struct ThreadData
int n_freed; int n_freed;
} tdata[N_THREADS]; } tdata[N_THREADS];
void* static void *
thread_func (void *arg) thread_func (void *arg)
{ {
struct ThreadData *td = arg; struct ThreadData *td = arg;
@ -45,18 +45,23 @@ thread_func (void *arg)
/* g_print ("Thread %d starting\n", td->thread_id); */ /* g_print ("Thread %d starting\n", td->thread_id); */
for (i = 0; i < N_ALLOCS; i++) for (i = 0; i < N_ALLOCS; i++)
{ {
int bytes;
char *mem;
int f;
int t;
if (rand() % (N_ALLOCS / 20) == 0) if (rand() % (N_ALLOCS / 20) == 0)
g_print ("%c", 'a' - 1 + td->thread_id); g_print ("%c", 'a' - 1 + td->thread_id);
/* allocate block of random size and randomly fill */ /* allocate block of random size and randomly fill */
int bytes = rand() % MAX_BLOCK_SIZE + 1; bytes = rand() % MAX_BLOCK_SIZE + 1;
char *mem = g_slice_alloc (bytes); mem = g_slice_alloc (bytes);
int f;
for (f = 0; f < bytes; f++) for (f = 0; f < bytes; f++)
mem[f] = rand(); mem[f] = rand();
/* associate block with random thread */ /* associate block with random thread */
int t = rand() % N_THREADS; t = rand() % N_THREADS;
g_mutex_lock (&tdata[t].to_free_mutex); g_mutex_lock (&tdata[t].to_free_mutex);
tdata[t].to_free[tdata[t].n_to_free] = mem; tdata[t].to_free[tdata[t].n_to_free] = mem;
tdata[t].bytes_to_free[tdata[t].n_to_free] = bytes; tdata[t].bytes_to_free[tdata[t].n_to_free] = bytes;
@ -87,7 +92,7 @@ thread_func (void *arg)
} }
int int
main() main (void)
{ {
int t; int t;

View File

@ -277,7 +277,7 @@ test_g_static_rw_lock_thread (gpointer data)
} }
static void static void
test_g_static_rw_lock () test_g_static_rw_lock (void)
{ {
GThread *threads[THREADS]; GThread *threads[THREADS];
guint i; guint i;
@ -368,8 +368,8 @@ test_g_thread_once (void)
} }
/* run all the tests */ /* run all the tests */
void static void
run_all_tests() run_all_tests (void)
{ {
test_g_mutex (); test_g_mutex ();
test_g_static_rec_mutex (); test_g_static_rec_mutex ();

View File

@ -332,7 +332,7 @@ test_thread_idle_timeout (gpointer data)
} }
static void static void
test_thread_idle_time () test_thread_idle_time (void)
{ {
guint limit = 50; guint limit = 50;
guint interval = 10000; guint interval = 10000;